[Haskell-beginners] Passing a file containing a list as an input

Olivier Revollat revollat at gmail.com
Fri Jul 6 07:33:32 UTC 2018


Hi,
Maybe you should try "interact"

main = io (map processIt)
io f = interact (unlines . f . lines)



Le jeu. 5 juil. 2018 à 22:21, Awsaf Rahman <awsafrahman1704 at gmail.com> a
écrit :

> Hello everyone!
>
> I am really struggling with Haskell I/O.
>
> I have written a mergesort program and as an input to that program I want
> to use a file containing a list of 1000 integers. Let's say the contents of
> the file look like this
>
> [120, 400, 500 , 20, 100 ..]
>
> How can I achieve that? I am trying to write a main function that takes
> the file as an input and passes the list to my mergesort function..
>
> Regards
> Awsaf Rahman
> _______________________________________________
> 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/20180706/3e6992ea/attachment.html>


More information about the Beginners mailing list