[Haskell-beginners] IO question

Thomas Jakway tjakway at nyu.edu
Tue Dec 12 18:44:24 UTC 2017


Personally I prefer <$> (infix fmap) to fmap, but is this confusing to
beginners?

On Dec 12, 2017 10:42 AM, "Vale Cofer-Shabica" <vale.cofershabica at gmail.com>
wrote:

> Just to add to David's answer, when I find myself in situations like:
> foo >>= return . bar
>
> hlint helpfully suggests:
> fmap bar foo
>
> So you could also have:
> fmap (splitOn ",") $ readFile "data.txt"
>
> -vale
>
> --
> vale cofer-shabica
> 401.267.8253 <(401)%20267-8253>
>
> On Mon, Dec 11, 2017 at 4:24 PM, mike h <mike_k_houghton at yahoo.co.uk>
> wrote:
>
>> Thank you David.  Before posting I tried readFile "data.txt" >>= … but
>> got errors as I didn’t use return.!!
>>
>> Mike
>>
>>
>>
>> On 11 Dec 2017, at 21:00, David McBride <toad3k at gmail.com> wrote:
>>
>> splitOn "," <$> readFile "data.txt"
>>
>> or perhaps
>>
>> readFile "data.txt" >>= return . splitOn ","
>>
>> On Mon, Dec 11, 2017 at 3:56 PM, mike h <mike_k_houghton at yahoo.co.uk>
>> wrote:
>>
>>> I have
>>>
>>>  input <- readFile “data.txt”
>>>  let  input’ = splitOn “,” input
>>> ….
>>>
>>> How do I make that into just one line?
>>>
>>> Thanks
>>>
>>> Mike
>>> _______________________________________________
>>> Beginners mailing list
>>> Beginners at haskell.org
>>> http://mail.haskell.org/cgi-bin/mailman/listinfo/beginners
>>>
>>
>> _______________________________________________
>> Beginners mailing list
>> Beginners at haskell.org
>> http://mail.haskell.org/cgi-bin/mailman/listinfo/beginners
>>
>>
>>
>> _______________________________________________
>> Beginners mailing list
>> Beginners at haskell.org
>> http://mail.haskell.org/cgi-bin/mailman/listinfo/beginners
>>
>>
>
> _______________________________________________
> Beginners mailing list
> Beginners at haskell.org
> http://mail.haskell.org/cgi-bin/mailman/listinfo/beginners
>
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mail.haskell.org/pipermail/beginners/attachments/20171212/fff5d40f/attachment-0001.html>


More information about the Beginners mailing list