From 50295 at web.de Mon Feb 1 17:28:27 2016 From: 50295 at web.de (Olumide) Date: Mon, 1 Feb 2016 17:28:27 +0000 Subject: [Haskell-beginners] Why does sequence (map print [1, 2, 3, 4, 5]) produce [(), (), (), (), ()] at the end? Message-ID: <56AF95BB.20307@web.de> Hello list, The question says it all. BTW, I'm studying LYH and I'm on the chapter on IO. The book offers and explanation but its not very clear -- to me at least. Thanks, - Olumide From toad3k at gmail.com Mon Feb 1 17:39:50 2016 From: toad3k at gmail.com (David McBride) Date: Mon, 1 Feb 2016 12:39:50 -0500 Subject: [Haskell-beginners] Why does sequence (map print [1, 2, 3, 4, 5]) produce [(), (), (), (), ()] at the end? In-Reply-To: <56AF95BB.20307@web.de> References: <56AF95BB.20307@web.de> Message-ID: map :: (a -> b) -> [a] -> [b] print :: Show a => a -> IO () map print :: Show a => [a] -> [IO ()] print takes a showable a and creates a procedure that prints it out (IO ()). So therefore map print causes each element in the array to become a procedure that prints out its element, thus the return value is [IO()]. Note that it has not actually printed them out. It merely has an array of as yet unexecuted actions. To print them you'd go like sequence (map print) [1,2,3], or better yet, sequence_ which returns () instead of [()] On Mon, Feb 1, 2016 at 12:28 PM, Olumide <50295 at web.de> wrote: > Hello list, > > The question says it all. > > BTW, I'm studying LYH and I'm on the chapter on IO. The book offers and > explanation but its not very clear -- to me at least. > > Thanks, > > - Olumide > > _______________________________________________ > Beginners mailing list > Beginners at haskell.org > http://mail.haskell.org/cgi-bin/mailman/listinfo/beginners > -------------- next part -------------- An HTML attachment was scrubbed... URL: From cwyang at aranetworks.com Tue Feb 2 01:32:10 2016 From: cwyang at aranetworks.com (Chul-Woong Yang) Date: Tue, 2 Feb 2016 10:32:10 +0900 Subject: [Haskell-beginners] foldr on infinite list to decide prime number Message-ID: Hi, all. While I know that foldr can be used on infinite list to generate infinite list, I'm having difficulty in understaind following code: isPrime n = n > 1 && -- from haskell wiki foldr (\p r -> p*p > n || ((n `rem` p) /= 0 && r)) True primes primes = 2 : filter isPrime [3,5..] primes is a infinite list of prime numbers, and isPrime does foldr to get a boolean value. What causes foldr to terminate folding? Any helps will be deeply appreciated. Thank you. Chul-Woong -------------- next part -------------- An HTML attachment was scrubbed... URL: From cwyang at aranetworks.com Tue Feb 2 01:36:03 2016 From: cwyang at aranetworks.com (Chul-Woong Yang) Date: Tue, 2 Feb 2016 10:36:03 +0900 Subject: [Haskell-beginners] foldr on infinite list to decide prime number In-Reply-To: References: Message-ID: I feel sorry for posting mis-formatted code. I re-post the question. -- Hi, all. While I know that foldr can be used on infinite list to generate infinite list, I'm having difficulty in understaind following code: isPrime n = n > 1 && -- from haskell wiki foldr (\p r -> p*p > n || ((n `rem` p) /= 0 && r)) True primes primes = 2 : filter isPrime [3,5..] primes is a infinite list of prime numbers, and isPrime does foldr to get a boolean value. What causes foldr to terminate folding? Any helps will be deeply appreciated. Thank you. 2016-02-02 10:32 GMT+09:00 Chul-Woong Yang : > Hi, all. > > While I know that foldr can be used on infinite list to generate infinite > list, > I'm having difficulty in understaind following code: > > isPrime n = n > 1 && -- from haskell wiki foldr (\p r -> p*p > n || ((n > `rem` p) /= 0 && r)) True primes primes = 2 : filter isPrime [3,5..] > > primes is a infinite list of prime numbers, and isPrime does foldr to get > a boolean value. > What causes foldr to terminate folding? > > Any helps will be deeply appreciated. > > Thank you. > > Chul-Woong > -------------- next part -------------- An HTML attachment was scrubbed... URL: From fa-ml at ariis.it Tue Feb 2 02:01:23 2016 From: fa-ml at ariis.it (Francesco Ariis) Date: Tue, 2 Feb 2016 03:01:23 +0100 Subject: [Haskell-beginners] foldr on infinite list to decide prime number In-Reply-To: References: Message-ID: <20160202020123.GA29140@casa.casa> On Tue, Feb 02, 2016 at 10:32:10AM +0900, Chul-Woong Yang wrote: > Hi, all. > > While I know that foldr can be used on infinite list to generate infinite > list, > I'm having difficulty in understaind following code: > > isPrime n = n > 1 && -- from haskell wiki foldr (\p r -> p*p > n || ((n > `rem` p) /= 0 && r)) True primes primes = 2 : filter isPrime [3,5..] > > primes is a infinite list of prime numbers, and isPrime does foldr to get a > boolean value. > What causes foldr to terminate folding? foldr _immediately_ calls the passed function, hence /it can short circuit/, that isn't the case for foldl. I wrote an article to explain it [1]. It was drafted in a time when foldr and friends were monomorphic (i.e. they only worked with lists), but it should illustrate the point nicely. Current polymorphic implementation of foldr is: foldr :: (a -> b -> b) -> b -> t a -> b foldr f z t = appEndo (foldMap (Endo #. f) t) z and I must admit I have problems explaining why it terminates early (as it does). [1] http://ariis.it/static/articles/haskell-laziness/page.html (more complex cases section) From cwyang at aranetworks.com Tue Feb 2 02:12:35 2016 From: cwyang at aranetworks.com (Chul-Woong Yang) Date: Tue, 2 Feb 2016 11:12:35 +0900 Subject: [Haskell-beginners] foldr on infinite list to decide prime number In-Reply-To: <20160202020123.GA29140@casa.casa> References: <20160202020123.GA29140@casa.casa> Message-ID: Aha! I see. Thank you for pointing the short-circuiting of (||), and for nice article. Regards, 2016-02-02 11:01 GMT+09:00 Francesco Ariis : > On Tue, Feb 02, 2016 at 10:32:10AM +0900, Chul-Woong Yang wrote: >> Hi, all. >> >> While I know that foldr can be used on infinite list to generate infinite >> list, >> I'm having difficulty in understaind following code: >> >> isPrime n = n > 1 && -- from haskell wiki foldr (\p r -> p*p > n || ((n >> `rem` p) /= 0 && r)) True primes primes = 2 : filter isPrime [3,5..] >> >> primes is a infinite list of prime numbers, and isPrime does foldr to get a >> boolean value. >> What causes foldr to terminate folding? > > foldr _immediately_ calls the passed function, hence /it can short > circuit/, that isn't the case for foldl. > > I wrote an article to explain it [1]. It was drafted in a time when > foldr and friends were monomorphic (i.e. they only worked with lists), > but it should illustrate the point nicely. > > Current polymorphic implementation of foldr is: > > foldr :: (a -> b -> b) -> b -> t a -> b > foldr f z t = appEndo (foldMap (Endo #. f) t) z > > and I must admit I have problems explaining why it terminates > early (as it does). > > [1] http://ariis.it/static/articles/haskell-laziness/page.html (more > complex cases section) > _______________________________________________ > Beginners mailing list > Beginners at haskell.org > http://mail.haskell.org/cgi-bin/mailman/listinfo/beginners From cwyang at aranetworks.com Tue Feb 2 07:15:47 2016 From: cwyang at aranetworks.com (Chul-Woong Yang) Date: Tue, 2 Feb 2016 16:15:47 +0900 Subject: [Haskell-beginners] foldr with short circuit and accumulator Message-ID: Hi, all. Can it be possible to do fold with short circuit and accumulator both? For example, can we find an element which is same value to adjacent one? findAdjacent [1,2..n, n, n+1, n+2.......] => n \__very long__/ Though there can be many ways to do it, Can we do it with fold[r|l]? I'll be happy to receive any comments. Chul-Woong From tanuki at gmail.com Tue Feb 2 08:47:02 2016 From: tanuki at gmail.com (Theodore Lief Gannon) Date: Tue, 2 Feb 2016 00:47:02 -0800 Subject: [Haskell-beginners] foldr with short circuit and accumulator In-Reply-To: References: Message-ID: If you mean is there any f and z for which this can be done with only "foldr f z xs", I believe the answer is no. If you don't mind extra parts, though: findAdjacent :: (Eq a) => [a] -> Maybe a findAdjacent xs = foldr f Nothing $ zip xs ps where ps = zipWith (==) (tail xs) xs f (x,p) next = if p then Just x else next On Mon, Feb 1, 2016 at 11:15 PM, Chul-Woong Yang wrote: > Hi, all. > > Can it be possible to do fold with short circuit and accumulator both? > For example, can we find an element which is same value to adjacent one? > > findAdjacent [1,2..n, n, n+1, n+2.......] => n > \__very long__/ > > Though there can be many ways to do it, Can we do it with fold[r|l]? > > I'll be happy to receive any comments. > > Chul-Woong > _______________________________________________ > Beginners mailing list > Beginners at haskell.org > http://mail.haskell.org/cgi-bin/mailman/listinfo/beginners > -------------- next part -------------- An HTML attachment was scrubbed... URL: From kwangyul.seo at gmail.com Tue Feb 2 09:03:00 2016 From: kwangyul.seo at gmail.com (KwangYul Seo) Date: Tue, 2 Feb 2016 18:03:00 +0900 Subject: [Haskell-beginners] foldr with short circuit and accumulator In-Reply-To: References: Message-ID: Hi, Implementing a short-circuiting fold was already discussed in the haskell-cafe mailing list. https://mail.haskell.org/pipermail/haskell-cafe/2007-April/024171.html On Tue, Feb 2, 2016 at 4:15 PM, Chul-Woong Yang wrote: > Hi, all. > > Can it be possible to do fold with short circuit and accumulator both? > For example, can we find an element which is same value to adjacent one? > > findAdjacent [1,2..n, n, n+1, n+2.......] => n > \__very long__/ > > Though there can be many ways to do it, Can we do it with fold[r|l]? > > I'll be happy to receive any comments. > > Chul-Woong > _______________________________________________ > Beginners mailing list > Beginners at haskell.org > http://mail.haskell.org/cgi-bin/mailman/listinfo/beginners > -------------- next part -------------- An HTML attachment was scrubbed... URL: From gesh at gesh.uni.cx Tue Feb 2 13:33:14 2016 From: gesh at gesh.uni.cx (Gesh) Date: Tue, 02 Feb 2016 15:33:14 +0200 Subject: [Haskell-beginners] foldr on infinite list to decide prime number In-Reply-To: References: Message-ID: On February 2, 2016 3:36:03 AM GMT+02:00, Chul-Woong Yang wrote: >I feel sorry for posting mis-formatted code. >I re-post the question. >-- > >Hi, all. > >While I know that foldr can be used on infinite list to generate >infinite >list, >I'm having difficulty in understaind following code: > >isPrime n = n > 1 && -- from haskell wiki > foldr (\p r -> p*p > n || ((n `rem` p) /= 0 && r)) True primes >primes = 2 : filter isPrime [3,5..] > >primes is a infinite list of prime numbers, and isPrime does foldr to >get a >boolean value. >What causes foldr to terminate folding? > >Any helps will be deeply appreciated. > >Thank you. > > >2016-02-02 10:32 GMT+09:00 Chul-Woong Yang : > >> Hi, all. >> >> While I know that foldr can be used on infinite list to generate >infinite >> list, >> I'm having difficulty in understaind following code: >> >> isPrime n = n > 1 && -- from haskell wiki foldr (\p r -> p*p > n || >((n >> `rem` p) /= 0 && r)) True primes primes = 2 : filter isPrime [3,5..] >> >> primes is a infinite list of prime numbers, and isPrime does foldr to >get >> a boolean value. >> What causes foldr to terminate folding? >> >> Any helps will be deeply appreciated. >> >> Thank you. >> >> Chul-Woong >> > > >------------------------------------------------------------------------ > >_______________________________________________ >Beginners mailing list >Beginners at haskell.org >http://mail.haskell.org/cgi-bin/mailman/listinfo/beginners Note that || is lazy, specifically: > True || _ = True > False || x = x Hence, once foldr reaches a prime larger than sqrt n, the first branch of || will be True, short-circuiting the entire infinite computation. HTH, Gesh From cwyang at aranetworks.com Wed Feb 3 00:36:00 2016 From: cwyang at aranetworks.com (Chul-Woong Yang) Date: Wed, 3 Feb 2016 09:36:00 +0900 Subject: [Haskell-beginners] foldr on infinite list to decide prime number In-Reply-To: References: Message-ID: Thank you for kind response. See you in another thread. :-) 2016-02-02 22:33 GMT+09:00 Gesh : > On February 2, 2016 3:36:03 AM GMT+02:00, Chul-Woong Yang wrote: >>I feel sorry for posting mis-formatted code. >>I re-post the question. >>-- >> >>Hi, all. >> >>While I know that foldr can be used on infinite list to generate >>infinite >>list, >>I'm having difficulty in understaind following code: >> >>isPrime n = n > 1 && -- from haskell wiki >> foldr (\p r -> p*p > n || ((n `rem` p) /= 0 && r)) True primes >>primes = 2 : filter isPrime [3,5..] >> >>primes is a infinite list of prime numbers, and isPrime does foldr to >>get a >>boolean value. >>What causes foldr to terminate folding? >> >>Any helps will be deeply appreciated. >> >>Thank you. >> >> >>2016-02-02 10:32 GMT+09:00 Chul-Woong Yang : >> >>> Hi, all. >>> >>> While I know that foldr can be used on infinite list to generate >>infinite >>> list, >>> I'm having difficulty in understaind following code: >>> >>> isPrime n = n > 1 && -- from haskell wiki foldr (\p r -> p*p > n || >>((n >>> `rem` p) /= 0 && r)) True primes primes = 2 : filter isPrime [3,5..] >>> >>> primes is a infinite list of prime numbers, and isPrime does foldr to >>get >>> a boolean value. >>> What causes foldr to terminate folding? >>> >>> Any helps will be deeply appreciated. >>> >>> Thank you. >>> >>> Chul-Woong >>> >> >> >>------------------------------------------------------------------------ >> >>_______________________________________________ >>Beginners mailing list >>Beginners at haskell.org >>http://mail.haskell.org/cgi-bin/mailman/listinfo/beginners > > Note that || is lazy, specifically: >> True || _ = True >> False || x = x > Hence, once foldr reaches a prime larger than sqrt n, the first branch of || will be True, short-circuiting the entire infinite computation. > > HTH, > Gesh > _______________________________________________ > Beginners mailing list > Beginners at haskell.org > http://mail.haskell.org/cgi-bin/mailman/listinfo/beginners From driemer.riemer at gmail.com Wed Feb 3 00:52:08 2016 From: driemer.riemer at gmail.com (derek riemer) Date: Tue, 2 Feb 2016 17:52:08 -0700 Subject: [Haskell-beginners] foldr on infinite list to decide prime number In-Reply-To: <20160202020123.GA29140@casa.casa> References: <20160202020123.GA29140@casa.casa> Message-ID: <56B14F38.6070703@gmail.com> Doesn't foldr have to "reach" to the far right of the list of infinite primes to get the last number since it consumes from the right? On 2/1/2016 7:01 PM, Francesco Ariis wrote: > On Tue, Feb 02, 2016 at 10:32:10AM +0900, Chul-Woong Yang wrote: >> Hi, all. >> >> While I know that foldr can be used on infinite list to generate infinite >> list, >> I'm having difficulty in understaind following code: >> >> isPrime n = n > 1 && -- from haskell wiki foldr (\p r -> p*p > n || ((n >> `rem` p) /= 0 && r)) True primes primes = 2 : filter isPrime [3,5..] >> >> primes is a infinite list of prime numbers, and isPrime does foldr to get a >> boolean value. >> What causes foldr to terminate folding? > foldr _immediately_ calls the passed function, hence /it can short > circuit/, that isn't the case for foldl. > > I wrote an article to explain it [1]. It was drafted in a time when > foldr and friends were monomorphic (i.e. they only worked with lists), > but it should illustrate the point nicely. > > Current polymorphic implementation of foldr is: > > foldr :: (a -> b -> b) -> b -> t a -> b > foldr f z t = appEndo (foldMap (Endo #. f) t) z > > and I must admit I have problems explaining why it terminates > early (as it does). > > [1] http://ariis.it/static/articles/haskell-laziness/page.html (more > complex cases section) > _______________________________________________ > Beginners mailing list > Beginners at haskell.org > http://mail.haskell.org/cgi-bin/mailman/listinfo/beginners -- ------------------------------------------------------------------------ Derek Riemer * Department of computer science, third year undergraduate student. * Proud user of the NVDA screen reader. * Open source enthusiast. * Member of Bridge Cu * Avid skiier. Websites: Honors portfolio Awesome little hand built weather app! email me at derek.riemer at colorado.edu Phone: (303) 906-2194 -------------- next part -------------- An HTML attachment was scrubbed... URL: From cwyang at aranetworks.com Wed Feb 3 00:53:13 2016 From: cwyang at aranetworks.com (Chul-Woong Yang) Date: Wed, 3 Feb 2016 09:53:13 +0900 Subject: [Haskell-beginners] foldr with short circuit and accumulator In-Reply-To: References: Message-ID: Thank you for introducing mind-blowing ssfold, which has step function with three argument: > ssfold p f a0 xs = foldr (\x xs a -> if p a then a else xs (f a x)) id xs a0 Having spent last night, I've yet to got it. What a slow person! Regards, 2016-02-02 18:03 GMT+09:00 KwangYul Seo : > Hi, > > Implementing a short-circuiting fold was already discussed in the > haskell-cafe mailing list. > > https://mail.haskell.org/pipermail/haskell-cafe/2007-April/024171.html > > > On Tue, Feb 2, 2016 at 4:15 PM, Chul-Woong Yang > wrote: >> >> Hi, all. >> >> Can it be possible to do fold with short circuit and accumulator both? >> For example, can we find an element which is same value to adjacent one? >> >> findAdjacent [1,2..n, n, n+1, n+2.......] => n >> \__very long__/ >> >> Though there can be many ways to do it, Can we do it with fold[r|l]? >> >> I'll be happy to receive any comments. >> >> Chul-Woong >> _______________________________________________ >> 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 > From cwyang at aranetworks.com Wed Feb 3 01:23:46 2016 From: cwyang at aranetworks.com (Chul-Woong Yang) Date: Wed, 3 Feb 2016 10:23:46 +0900 Subject: [Haskell-beginners] foldr with short circuit and accumulator In-Reply-To: References: Message-ID: Hi, Thanks for your reply. I've done zip'ing in those kinds of problem, also. I think it'd be better if we can do it without zip'ing, with folding only. With help of KwangYul Seo, I know now that short-circuiting with fold is possible, and I made ssfold version of findAdjacent: -- Spencer Janssen's ssfold, from haskell-cafe ssfold p f a0 xs = foldr (\x xs a -> if p a then a else xs (f a x)) id xs a0 findAdjacent :: [Int] -> Maybe Int findAdjacent = snd . ssfold (uncurry const) step (False, Nothing) where step acc@(True, _) _ = acc step (False, last) x = (if Just x == last then True else False, Just x) findAdjacent $ [1..10000] ++ [10000..] ==> 10000 It might be overkill for finding adjacent entry. It's better to use zip'ing. But I think ssfold can be useful in other cases. Any comments will be welcomed. Regards, Chul-Woong 2016-02-02 17:47 GMT+09:00 Theodore Lief Gannon : > If you mean is there any f and z for which this can be done with only "foldr > f z xs", I believe the answer is no. If you don't mind extra parts, though: > > findAdjacent :: (Eq a) => [a] -> Maybe a > findAdjacent xs = foldr f Nothing $ zip xs ps > where > ps = zipWith (==) (tail xs) xs > f (x,p) next = if p then Just x else next > > > On Mon, Feb 1, 2016 at 11:15 PM, Chul-Woong Yang > wrote: >> >> Hi, all. >> >> Can it be possible to do fold with short circuit and accumulator both? >> For example, can we find an element which is same value to adjacent one? >> >> findAdjacent [1,2..n, n, n+1, n+2.......] => n >> \__very long__/ >> >> Though there can be many ways to do it, Can we do it with fold[r|l]? >> >> I'll be happy to receive any comments. >> >> Chul-Woong >> _______________________________________________ >> 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 > From cwyang at aranetworks.com Wed Feb 3 01:56:29 2016 From: cwyang at aranetworks.com (Chul-Woong Yang) Date: Wed, 3 Feb 2016 10:56:29 +0900 Subject: [Haskell-beginners] foldr on infinite list to decide prime number In-Reply-To: <56B14F38.6070703@gmail.com> References: <20160202020123.GA29140@casa.casa> <56B14F38.6070703@gmail.com> Message-ID: Simple foldr'ing over infinite list: foldr (\x acc -> x || acc) False $ repeat True Under lazy evaluation, the foldr stops expansion when x has True value since (||) short-circuits evaluation. In strict evaluation, foldr should reach to the far right of the infinite list as you said. 2016-02-03 9:52 GMT+09:00 derek riemer : > Doesn't foldr have to "reach" to the far right of the list of infinite > primes to get the last number since it consumes from the right? > > > On 2/1/2016 7:01 PM, Francesco Ariis wrote: > > On Tue, Feb 02, 2016 at 10:32:10AM +0900, Chul-Woong Yang wrote: > > Hi, all. > > While I know that foldr can be used on infinite list to generate infinite > list, > I'm having difficulty in understaind following code: > > isPrime n = n > 1 && -- from haskell wiki foldr (\p r -> p*p > n || ((n > `rem` p) /= 0 && r)) True primes primes = 2 : filter isPrime [3,5..] > > primes is a infinite list of prime numbers, and isPrime does foldr to get a > boolean value. > What causes foldr to terminate folding? > > foldr _immediately_ calls the passed function, hence /it can short > circuit/, that isn't the case for foldl. > > I wrote an article to explain it [1]. It was drafted in a time when > foldr and friends were monomorphic (i.e. they only worked with lists), > but it should illustrate the point nicely. > > Current polymorphic implementation of foldr is: > > foldr :: (a -> b -> b) -> b -> t a -> b > foldr f z t = appEndo (foldMap (Endo #. f) t) z > > and I must admit I have problems explaining why it terminates > early (as it does). > > [1] http://ariis.it/static/articles/haskell-laziness/page.html (more > complex cases section) > _______________________________________________ > Beginners mailing list > Beginners at haskell.org > http://mail.haskell.org/cgi-bin/mailman/listinfo/beginners > > > -- > ________________________________ > > Derek Riemer > > Department of computer science, third year undergraduate student. > Proud user of the NVDA screen reader. > Open source enthusiast. > Member of Bridge Cu > Avid skiier. > > Websites: > Honors portfolio > Awesome little hand built weather app! > > email me at derek.riemer at colorado.edu > Phone: (303) 906-2194 > > > _______________________________________________ > Beginners mailing list > Beginners at haskell.org > http://mail.haskell.org/cgi-bin/mailman/listinfo/beginners > From fa-ml at ariis.it Wed Feb 3 01:55:09 2016 From: fa-ml at ariis.it (Francesco Ariis) Date: Wed, 3 Feb 2016 02:55:09 +0100 Subject: [Haskell-beginners] foldr on infinite list to decide prime number In-Reply-To: <56B14F38.6070703@gmail.com> References: <20160202020123.GA29140@casa.casa> <56B14F38.6070703@gmail.com> Message-ID: <20160203015509.GA11099@casa.casa> On Tue, Feb 02, 2016 at 05:52:08PM -0700, derek riemer wrote: > Doesn't foldr have to "reach" to the far right of the list of infinite > primes to get the last number since it consumes from the right? foldl is /left/ associative, foldr /right/ associative. ?> foldl1 (-) [1..3] -4 -- which is: ((1-2)-3) ?> foldr1 (-) [1..3] 2 -- which is (1-(2-3)) Haskell being non strict (i.e. "proceeding from the outside"), it will immediately short circuit on foldr but have to build the whole list first on foldl. From tkoster at gmail.com Wed Feb 3 01:59:09 2016 From: tkoster at gmail.com (Thomas Koster) Date: Wed, 3 Feb 2016 12:59:09 +1100 Subject: [Haskell-beginners] foldr on infinite list to decide prime number In-Reply-To: <56B14F38.6070703@gmail.com> References: <20160202020123.GA29140@casa.casa> <56B14F38.6070703@gmail.com> Message-ID: On 3 February 2016 at 11:52, derek riemer wrote: > Doesn't foldr have to "reach" to the far right of the list of infinite > primes to get the last number since it consumes from the right? foldr does not consume from the right. It is right-associative. See these simulations: http://foldr.com http://foldl.com Notice that the essential difference between foldr and foldl is the placement of the parentheses in the result, which the simulations show very well. Whether that expression "short-circuits" or not depends on the operator you used with your fold. Operators that are lazy in their second argument (at least some of the time), like "||" and ":", can short-circuit when used with foldr. A common mistake is to think the parentheses force an evaluation order, like "inside-out" for example. This is not the case for lazy languages like Haskell. This unfortunate confusion probably arises because parentheses often do prescribe evaluation order in basic arithmetic and strict languages like Java. Hope this helps, Thomas Koster From 50295 at web.de Wed Feb 3 10:35:17 2016 From: 50295 at web.de (Olumide) Date: Wed, 3 Feb 2016 10:35:17 +0000 Subject: [Haskell-beginners] Why does sequence (map print [1, 2, 3, 4, 5]) produce [(), (), (), (), ()] at the end? In-Reply-To: References: <56AF95BB.20307@web.de> Message-ID: <56B1D7E5.6080409@web.de> On 01/02/2016 17:39, David McBride wrote: > Note that it has not actually printed them out. I hope you don't mind me asking but why then does sequence (map print [1,2,3] ) return the numbers 1, 2, 3 (albeit followed by [(),(),()]). > It merely has an array of as yet unexecuted actions. To print them > you'd go like sequence (map print) [1,2,3] ... Erm ... sequence (map print) [1,2,3] returns an error. - Olumide From erlend at hamberg.no Wed Feb 3 11:30:02 2016 From: erlend at hamberg.no (Erlend Hamberg) Date: Wed, 3 Feb 2016 12:30:02 +0100 Subject: [Haskell-beginners] Why does sequence (map print [1, 2, 3, 4, 5]) produce [(), (), (), (), ()] at the end? In-Reply-To: <56B1D7E5.6080409@web.de> References: <56AF95BB.20307@web.de> <56B1D7E5.6080409@web.de> Message-ID: On 3 February 2016 at 11:35, Olumide <50295 at web.de> wrote: > Erm ... sequence (map print) [1,2,3] returns an error. That's because it will be parsed as `(sequence (map print) [1,2,3]`. If you use `sequence (map print [1,2,3])`, it should work. -------------- next part -------------- An HTML attachment was scrubbed... URL: From toad3k at gmail.com Wed Feb 3 13:11:34 2016 From: toad3k at gmail.com (David McBride) Date: Wed, 3 Feb 2016 08:11:34 -0500 Subject: [Haskell-beginners] Why does sequence (map print [1, 2, 3, 4, 5]) produce [(), (), (), (), ()] at the end? In-Reply-To: <56B1D7E5.6080409@web.de> References: <56AF95BB.20307@web.de> <56B1D7E5.6080409@web.de> Message-ID: In ghci, any statement that returns Show a => IO a (that is IO a where the a is showable) will be run in IO and the result a will be shown once it finishes. If a is not showable it will simply run the IO action, but not show the result. > :t sequence (map print [1,2,3]) sequence (map print [1,2,3]) :: IO [()] > :i Show instance Show a => Show [a] -- Defined in ?GHC.Show? instance Show () -- Defined in ?GHC.Show? On Wed, Feb 3, 2016 at 5:35 AM, Olumide <50295 at web.de> wrote: > On 01/02/2016 17:39, David McBride wrote: > >> Note that it has not actually printed them out. >> > > I hope you don't mind me asking but why then does sequence (map print > [1,2,3] ) return the numbers 1, 2, 3 (albeit followed by [(),(),()]). > > It merely has an array of as yet unexecuted actions. To print them >> you'd go like sequence (map print) [1,2,3] ... >> > > Erm ... sequence (map print) [1,2,3] returns an error. > > > - Olumide > > > _______________________________________________ > Beginners mailing list > Beginners at haskell.org > http://mail.haskell.org/cgi-bin/mailman/listinfo/beginners > -------------- next part -------------- An HTML attachment was scrubbed... URL: From hjgtuyl at chello.nl Thu Feb 4 10:59:40 2016 From: hjgtuyl at chello.nl (Henk-Jan van Tuyl) Date: Thu, 04 Feb 2016 11:59:40 +0100 Subject: [Haskell-beginners] generating object file for ARM In-Reply-To: <56AE7442.4050706@free.fr> References: <56AE7442.4050706@free.fr> Message-ID: On Sun, 31 Jan 2016 21:53:22 +0100, Fabien R wrote: > Hello, > > I would like to link my Haskell module with existing object files for > armv7-m. I use ghc 7.4.1 on debian/amd64. > > This command seems incorrect: > ghc -pgmcarm-none-eabi-gcc -pgmParm-none-eabi-cpp -pgmaarm-none-eabi-as > -pgmlarm-none-eabi-ld -keep-tmp-files HaskellModule.hs > > A lot of errors appeared: [...] Hello Fabien, If you are still interested in an answer, you could try asking the Haskell Caf?, as there are more people on that list. Regards, Henk-Jan van Tuyl -- Folding at home What if you could share your unused computer power to help find a cure? In just 5 minutes you can join the world's biggest networked computer and get us closer sooner. Watch the video. http://folding.stanford.edu/ http://Van.Tuyl.eu/ http://members.chello.nl/hjgtuyl/tourdemonad.html Haskell programming -- From mike_k_houghton at yahoo.co.uk Fri Feb 5 21:37:07 2016 From: mike_k_houghton at yahoo.co.uk (Mike Houghton) Date: Fri, 5 Feb 2016 21:37:07 +0000 Subject: [Haskell-beginners] tuple space Message-ID: Hi, I?m thinking about how to write a Tuple Space (TS) in Haskell. A tuple can have many fields of different types, in pseudo code something like T = (1, ?A string?, 3.4) i.e. an int, string and double. How can this (and the many variations) be done in Haskell? (In Java it would be a list of Object) Thanks Mike From imantc at gmail.com Fri Feb 5 21:43:42 2016 From: imantc at gmail.com (Imants Cekusins) Date: Fri, 5 Feb 2016 22:43:42 +0100 Subject: [Haskell-beginners] tuple space In-Reply-To: References: Message-ID: > T = (1, ?A string?, 3.4) i.e. an int, string and double. would this suit: data Object = Int' Int | Double' Double | String' String type T = [Object] ? From mike_k_houghton at yahoo.co.uk Fri Feb 5 21:58:30 2016 From: mike_k_houghton at yahoo.co.uk (Mike Houghton) Date: Fri, 5 Feb 2016 21:58:30 +0000 Subject: [Haskell-beginners] tuple space In-Reply-To: References: Message-ID: <1EC98F6E-7610-485B-A3F1-57BA62F3ADF0@yahoo.co.uk> Thanks for the quick reply! No, that wouldn?t work as that would tie a tuple to Int, Double,String for all tuples. (1,1,2,3,?string?, 4.5, ?string?, 1) is also valid tuple In Java I would use List so any number of (non-primitives) can be used. Thanks Mike > On 5 Feb 2016, at 21:43, Imants Cekusins wrote: > >> T = (1, ?A string?, 3.4) i.e. an int, string and double. > > would this suit: > > data Object = Int' Int | Double' Double | String' String > type T = [Object] > > ? > _______________________________________________ > Beginners mailing list > Beginners at haskell.org > http://mail.haskell.org/cgi-bin/mailman/listinfo/beginners From tmorris at tmorris.net Fri Feb 5 22:03:32 2016 From: tmorris at tmorris.net (Tony Morris) Date: Sat, 6 Feb 2016 08:03:32 +1000 Subject: [Haskell-beginners] tuple space In-Reply-To: <1EC98F6E-7610-485B-A3F1-57BA62F3ADF0@yahoo.co.uk> References: <1EC98F6E-7610-485B-A3F1-57BA62F3ADF0@yahoo.co.uk> Message-ID: HList. Also in Java, you'd use HList (never use Object). http://www.functionaljava.org/javadoc/4.0/fj/data/hlist/HList.html On Sat, Feb 6, 2016 at 7:58 AM, Mike Houghton wrote: > Thanks for the quick reply! > > No, that wouldn?t work as that would tie a tuple to Int, Double,String for > all tuples. > > (1,1,2,3,?string?, 4.5, ?string?, 1) is also valid tuple > > In Java I would use > List so any number of (non-primitives) can be used. > > Thanks > > Mike > > > > On 5 Feb 2016, at 21:43, Imants Cekusins wrote: > > > >> T = (1, ?A string?, 3.4) i.e. an int, string and double. > > > > would this suit: > > > > data Object = Int' Int | Double' Double | String' String > > type T = [Object] > > > > ? > > _______________________________________________ > > 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: From imantc at gmail.com Fri Feb 5 22:06:40 2016 From: imantc at gmail.com (Imants Cekusins) Date: Fri, 5 Feb 2016 23:06:40 +0100 Subject: [Haskell-beginners] tuple space In-Reply-To: <1EC98F6E-7610-485B-A3F1-57BA62F3ADF0@yahoo.co.uk> References: <1EC98F6E-7610-485B-A3F1-57BA62F3ADF0@yahoo.co.uk> Message-ID: > (1,1,2,3,?string?, 4.5, ?string?, 1) is also valid tuple [Int' 1, Int' 1, Int' 2, Int' 3, String' "string", Double' 4.5, String' "string", Int 1] not sure about Double but the rest should be ok. try it! From mike_k_houghton at yahoo.co.uk Fri Feb 5 22:10:04 2016 From: mike_k_houghton at yahoo.co.uk (Mike Houghton) Date: Fri, 5 Feb 2016 22:10:04 +0000 Subject: [Haskell-beginners] tuple space In-Reply-To: References: <1EC98F6E-7610-485B-A3F1-57BA62F3ADF0@yahoo.co.uk> Message-ID: Nice, thanks. > On 5 Feb 2016, at 22:03, Tony Morris wrote: > > HList. > > Also in Java, you'd use HList (never use Object). > http://www.functionaljava.org/javadoc/4.0/fj/data/hlist/HList.html > > On Sat, Feb 6, 2016 at 7:58 AM, Mike Houghton > wrote: > Thanks for the quick reply! > > No, that wouldn?t work as that would tie a tuple to Int, Double,String for all tuples. > > (1,1,2,3,?string?, 4.5, ?string?, 1) is also valid tuple > > In Java I would use > List so any number of (non-primitives) can be used. > > Thanks > > Mike > > > > On 5 Feb 2016, at 21:43, Imants Cekusins > wrote: > > > >> T = (1, ?A string?, 3.4) i.e. an int, string and double. > > > > would this suit: > > > > data Object = Int' Int | Double' Double | String' String > > type T = [Object] > > > > ? > > _______________________________________________ > > 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: From imantc at gmail.com Fri Feb 5 22:13:21 2016 From: imantc at gmail.com (Imants Cekusins) Date: Fri, 5 Feb 2016 23:13:21 +0100 Subject: [Haskell-beginners] tuple space In-Reply-To: References: <1EC98F6E-7610-485B-A3F1-57BA62F3ADF0@yahoo.co.uk> Message-ID: > in Java, you'd use HList (never use Object). this is new to me. How is it different from List? From mike_k_houghton at yahoo.co.uk Sat Feb 6 09:08:20 2016 From: mike_k_houghton at yahoo.co.uk (Mike Houghton) Date: Sat, 6 Feb 2016 09:08:20 +0000 Subject: [Haskell-beginners] tuple space In-Reply-To: References: <1EC98F6E-7610-485B-A3F1-57BA62F3ADF0@yahoo.co.uk> Message-ID: <7CCF3A9D-AEBB-472F-B147-AD39F1A0EED8@yahoo.co.uk> In Java List ensures all entries are of type T - so only one type allowed. List allows anything but you lose type safety. HList allows anything and retains the types. (but you do get a lot of <<< >>>>>> in declarations :) and really its pushing Java into something it isn?t. ) > On 5 Feb 2016, at 22:13, Imants Cekusins wrote: > >> in Java, you'd use HList (never use Object). > > this is new to me. How is it different from List? > _______________________________________________ > Beginners mailing list > Beginners at haskell.org > http://mail.haskell.org/cgi-bin/mailman/listinfo/beginners From theedge456 at free.fr Sat Feb 6 15:22:06 2016 From: theedge456 at free.fr (Fabien R) Date: Sat, 6 Feb 2016 16:22:06 +0100 Subject: [Haskell-beginners] generating object file for ARM In-Reply-To: References: <56AE7442.4050706@free.fr> Message-ID: <56B60F9E.3070308@free.fr> On 04/02/16 11:59, Henk-Jan van Tuyl wrote: ... > Hello Fabien, > > If you are still interested in an answer, you could try asking the > Haskell Caf?, as there are more people on that list. > > Regards, > Henk-Jan van Tuyl > > Thanks Henk-Jan, Done. -- Fabien From newhoggy at gmail.com Sat Feb 6 22:27:20 2016 From: newhoggy at gmail.com (John Ky) Date: Sat, 06 Feb 2016 22:27:20 +0000 Subject: [Haskell-beginners] How to convert ST.Trans Array to ByteString efficiently? Message-ID: Anyone know of an efficient way to convert a ST.Trans Array to a ByteString? Or is this it? https://github.com/haskell-works/conduit-succinct-json/commit/1427f10ce67dee86bdda8b7356d92d692c61100d Cheers, -John -------------- next part -------------- An HTML attachment was scrubbed... URL: From olivier.duhart at gmail.com Mon Feb 8 13:54:43 2016 From: olivier.duhart at gmail.com (Olivier Duhart) Date: Mon, 08 Feb 2016 13:54:43 +0000 Subject: [Haskell-beginners] Returning Maybe Float -> Float -> Float Message-ID: hello, I am starting with Haskell and trying some little exercices on my own. I successfully implemented a reverse polish notation evaluator and I want to improve it a little using *Maybe* All i want is to implement a function that can returned available functions according to its string name i.e return (+) when gived "+" I also want to return Nothing if the operation is not available (not implemented yet). So my function should Maybe return a (float -> float -> float) My current implementation is operation :: String -> Maybe Float -> Float -> Float operation op | op == "+" = Just (+) | op == "-" = Just (-) | op == "*" = Just (*) | op == "/" = Just (/) | otherwise = Nothing but it failed to compile with the following error : rpn.hs:64:18: Couldn't match expected type `Maybe Float -> Float -> Float' with actual type `Maybe a0' In the expression: Nothing In an equation for `operation': operation op | op == "+" = Just (+) | op == "-" = Just (-) | op == "*" = Just (*) | op == "/" = Just (/) | otherwise = Nothing I don't understand the error :( Do I have to explicitly type the Nothing return ? Could you guide me to a solution or explain me what I am doing wrong, please ? Thanks in advance Olivier -------------- next part -------------- An HTML attachment was scrubbed... URL: From haskell at utr.dk Mon Feb 8 14:07:40 2016 From: haskell at utr.dk (Ulrik Rasmussen) Date: Mon, 8 Feb 2016 15:07:40 +0100 Subject: [Haskell-beginners] Returning Maybe Float -> Float -> Float In-Reply-To: References: Message-ID: <56B8A12C.9080602@utr.dk> On 2016-02-08 14:54, Olivier Duhart wrote: > hello, > > I am starting with Haskell and trying some little exercices on my own. I > successfully implemented a reverse polish notation evaluator and I want > to improve it a little using *Maybe* > * > * > All i want is to implement a function that can returned available > functions according to its string name > i.e return (+) when gived "+" > I also want to return Nothing if the operation is not available (not > implemented yet). > So my function should Maybe return a (float -> float -> float) > > My current implementation is > > operation :: String -> Maybe Float -> Float -> Float > operation op > | op == "+" = Just (+) > | op == "-" = Just (-) > | op == "*" = Just (*) > | op == "/" = Just (/) > | otherwise = Nothing > > > but it failed to compile with the following error : > > rpn.hs:64:18: > Couldn't match expected type `Maybe Float -> Float -> Float' > with actual type `Maybe a0' > In the expression: Nothing > In an equation for `operation': > operation op > | op == "+" = Just (+) > | op == "-" = Just (-) > | op == "*" = Just (*) > | op == "/" = Just (/) > | otherwise = Nothing > > > I don't understand the error :( Do I have to explicitly type the Nothing > return ? > > Could you guide me to a solution or explain me what I am doing wrong, > please ? > > Thanks in advance > > Olivier Hi, The type String -> Maybe Float -> Float -> Float parenthesizes as String -> (Maybe Float) -> Float -> Float, but I think you meant String -> Maybe (Float -> Float -> Float) /Ulrik From olivier.duhart at gmail.com Mon Feb 8 14:14:44 2016 From: olivier.duhart at gmail.com (Olivier Duhart) Date: Mon, 08 Feb 2016 14:14:44 +0000 Subject: [Haskell-beginners] Returning Maybe Float -> Float -> Float In-Reply-To: <56B8A12C.9080602@utr.dk> References: <56B8A12C.9080602@utr.dk> Message-ID: thanks Ulrik, it solves the compilation problem. But now I have an execution error (with GHCi) : *Main> (operation "+") 2.0 2.0 :3:1: Couldn't match expected type `Double -> Double -> t' with actual type `Maybe (Float -> Float -> Float)' Relevant bindings include it :: t (bound at :3:1) The function `operation' is applied to three arguments, but its type `String -> Maybe (Float -> Float -> Float)' has only one In the expression: (operation "+") 2.0 2.0 In an equation for `it': it = (operation "+") 2.0 2.0 As I understand it ghci guess that the two 2.0 parameters to my (operation "+") are Double and the function returned by operation expects Float instead, How to solve this ? I tried to replace every Float with Double in my .hs file but still there is a problem *Main> (operation "+") 2.0 2.0 :3:1: Couldn't match expected type `Double -> Double -> t' with actual type `Maybe (Double -> Double -> Double)' Relevant bindings include it :: t (bound at :3:1) The function `operation' is applied to three arguments, but its type `String -> Maybe (Double -> Double -> Double)' has only one In the expression: (operation "+") 2.0 2.0 In an equation for `it': it = (operation "+") 2.0 2.0 Could you explain me what is the -> t at the end of the expected type ? Le lun. 8 f?vr. 2016 ? 15:07, Ulrik Rasmussen a ?crit : > On 2016-02-08 14:54, Olivier Duhart wrote: > > hello, > > > > I am starting with Haskell and trying some little exercices on my own. I > > successfully implemented a reverse polish notation evaluator and I want > > to improve it a little using *Maybe* > > * > > * > > All i want is to implement a function that can returned available > > functions according to its string name > > i.e return (+) when gived "+" > > I also want to return Nothing if the operation is not available (not > > implemented yet). > > So my function should Maybe return a (float -> float -> float) > > > > My current implementation is > > > > operation :: String -> Maybe Float -> Float -> Float > > operation op > > | op == "+" = Just (+) > > | op == "-" = Just (-) > > | op == "*" = Just (*) > > | op == "/" = Just (/) > > | otherwise = Nothing > > > > > > but it failed to compile with the following error : > > > > rpn.hs:64:18: > > Couldn't match expected type `Maybe Float -> Float -> Float' > > with actual type `Maybe a0' > > In the expression: Nothing > > In an equation for `operation': > > operation op > > | op == "+" = Just (+) > > | op == "-" = Just (-) > > | op == "*" = Just (*) > > | op == "/" = Just (/) > > | otherwise = Nothing > > > > > > I don't understand the error :( Do I have to explicitly type the Nothing > > return ? > > > > Could you guide me to a solution or explain me what I am doing wrong, > > please ? > > > > Thanks in advance > > > > Olivier > > Hi, > > The type String -> Maybe Float -> Float -> Float parenthesizes as > > String -> (Maybe Float) -> Float -> Float, > > but I think you meant > > String -> Maybe (Float -> Float -> Float) > > > /Ulrik > _______________________________________________ > Beginners mailing list > Beginners at haskell.org > http://mail.haskell.org/cgi-bin/mailman/listinfo/beginners > -------------- next part -------------- An HTML attachment was scrubbed... URL: From toad3k at gmail.com Mon Feb 8 14:21:52 2016 From: toad3k at gmail.com (David McBride) Date: Mon, 8 Feb 2016 09:21:52 -0500 Subject: [Haskell-beginners] Returning Maybe Float -> Float -> Float In-Reply-To: References: <56B8A12C.9080602@utr.dk> Message-ID: You need to test to see whether you have a valid operation before you can input the 2.0's. Try this: main = do x <- getLine putStrLn $ case operation x of Nothing -> "Got nothing." Just op -> show $ op 2.0 2.0 On Mon, Feb 8, 2016 at 9:14 AM, Olivier Duhart wrote: > thanks Ulrik, > > it solves the compilation problem. But now I have an execution error > (with GHCi) : > > *Main> (operation "+") 2.0 2.0 > > :3:1: > Couldn't match expected type `Double -> Double -> t' > with actual type `Maybe (Float -> Float -> Float)' > Relevant bindings include it :: t (bound at :3:1) > The function `operation' is applied to three arguments, > but its type `String -> Maybe (Float -> Float -> Float)' > has only one > In the expression: (operation "+") 2.0 2.0 > In an equation for `it': it = (operation "+") 2.0 2.0 > > As I understand it ghci guess that the two 2.0 parameters to my (operation > "+") are Double and the function returned by operation expects Float > instead, How to solve this ? > > I tried to replace every Float with Double in my .hs file but still there > is a problem > > *Main> (operation "+") 2.0 2.0 > > :3:1: > Couldn't match expected type `Double -> Double -> t' > with actual type `Maybe (Double -> Double -> Double)' > Relevant bindings include it :: t (bound at :3:1) > The function `operation' is applied to three arguments, > but its type `String -> Maybe (Double -> Double -> Double)' > has only one > In the expression: (operation "+") 2.0 2.0 > In an equation for `it': it = (operation "+") 2.0 2.0 > > Could you explain me what is the -> t at the end of the expected type ? > > > > Le lun. 8 f?vr. 2016 ? 15:07, Ulrik Rasmussen a ?crit : > >> On 2016-02-08 14:54, Olivier Duhart wrote: >> > hello, >> > >> > I am starting with Haskell and trying some little exercices on my own. I >> > successfully implemented a reverse polish notation evaluator and I want >> > to improve it a little using *Maybe* >> > * >> > * >> > All i want is to implement a function that can returned available >> > functions according to its string name >> > i.e return (+) when gived "+" >> > I also want to return Nothing if the operation is not available (not >> > implemented yet). >> > So my function should Maybe return a (float -> float -> float) >> > >> > My current implementation is >> > >> > operation :: String -> Maybe Float -> Float -> Float >> > operation op >> > | op == "+" = Just (+) >> > | op == "-" = Just (-) >> > | op == "*" = Just (*) >> > | op == "/" = Just (/) >> > | otherwise = Nothing >> > >> > >> > but it failed to compile with the following error : >> > >> > rpn.hs:64:18: >> > Couldn't match expected type `Maybe Float -> Float -> Float' >> > with actual type `Maybe a0' >> > In the expression: Nothing >> > In an equation for `operation': >> > operation op >> > | op == "+" = Just (+) >> > | op == "-" = Just (-) >> > | op == "*" = Just (*) >> > | op == "/" = Just (/) >> > | otherwise = Nothing >> > >> > >> > I don't understand the error :( Do I have to explicitly type the Nothing >> > return ? >> > >> > Could you guide me to a solution or explain me what I am doing wrong, >> > please ? >> > >> > Thanks in advance >> > >> > Olivier >> >> Hi, >> >> The type String -> Maybe Float -> Float -> Float parenthesizes as >> >> String -> (Maybe Float) -> Float -> Float, >> >> but I think you meant >> >> String -> Maybe (Float -> Float -> Float) >> >> >> /Ulrik >> _______________________________________________ >> 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: From xie.zhiyi at gmail.com Mon Feb 8 16:24:47 2016 From: xie.zhiyi at gmail.com (wizard) Date: Tue, 9 Feb 2016 00:24:47 +0800 Subject: [Haskell-beginners] Got "Non type-variable argument in the constraint" error for a simple function Message-ID: Dear all, I just started to learn Haskell with learnyouahaskell.com and at the very beginning, I met a strange issue with following simple function: -- why does work with "toZero 10" but not for "toZero -10"?toZero :: (Integral t) => t -> [t]toZero 0 = [0]toZero x = if x > 0 then x : toZero (x - 1) else x : toZero (x + 1) This function works as expected for positive arguments, e.g., "toZero 10" gives me [10,9,8,7,6,5,4,3,2,1,0]. However, GHCI will raise following error if I give it a negative argument, e.g., "toZero -10": *Main> toZero -10 :12:1: Non type-variable argument in the constraint: Num (t -> [t]) (Use FlexibleContexts to permit this) When checking that ?it? has the inferred type it :: forall t. (Integral t, Num (t -> [t])) => t -> [t] This seems strange to me as 10 and -10 has exactly the same type "Num a => a". I've done with chapter 1~10 of learnyouahaskell.com but still has no idea on why this error. Anybody can help to explain this? Thanks a lot. Regards Zhiyi Xie -------------- next part -------------- An HTML attachment was scrubbed... URL: From raabe at froglogic.com Mon Feb 8 16:32:36 2016 From: raabe at froglogic.com (Frerich Raabe) Date: Mon, 08 Feb 2016 17:32:36 +0100 Subject: [Haskell-beginners] Got "Non type-variable argument in the constraint" error for a simple function In-Reply-To: References: Message-ID: <7ecc86c4487ee1d4ef7a4e1b78fa4c33@roundcube.froglogic.com> On 2016-02-08 17:24, wizard wrote: > Dear all, > > I just started to learn Haskell with learnyouahaskell.com and at the very > beginning, I met a strange issue with following simple function: > > -- why does work with "toZero 10" but not for "toZero -10"? > toZero :: (Integral t) => t -> [t] [..] > This function works as expected for positive arguments, e.g., "toZero 10" > gives me [10,9,8,7,6,5,4,3,2,1,0]. However, GHCI will raise following error > if I give it a negative argument, e.g., "toZero -10": [..] The issue is that 'toZero -10' is parsed as 'toZero minus 10', i.e. it's not a negative value you're passing there. It expects 'toZero' to be a numeric value. Try toZero (-10) instead. -- Frerich Raabe - raabe at froglogic.com www.froglogic.com - Multi-Platform GUI Testing From toad3k at gmail.com Mon Feb 8 16:43:29 2016 From: toad3k at gmail.com (David McBride) Date: Mon, 8 Feb 2016 11:43:29 -0500 Subject: [Haskell-beginners] Got "Non type-variable argument in the constraint" error for a simple function In-Reply-To: References: Message-ID: If you are wondering why you are having this problem it is because - can be interpretted as either a one argument negation or a two argument subtraction. If you put parenthesis around (-n) where n is an integer, it will interpret it as unary, something that will not happen in other operators. >:t (-) (-) :: Num a => a -> a -> a >:t (+) (+) :: Num a => a -> a -> a >:t (-1) (-1) :: Num a => a >:t (+1) (+1) :: Num a => a -> a >:t (1-1) (1-1) :: Num a => a >:t (1+1) (1+1) :: Num a => a On Mon, Feb 8, 2016 at 11:24 AM, wizard wrote: > Dear all, > > I just started to learn Haskell with learnyouahaskell.com and at the very > beginning, I met a strange issue with following simple function: > > -- why does work with "toZero 10" but not for "toZero -10"?toZero :: (Integral t) => t -> [t]toZero 0 = [0]toZero x = if x > 0 then x : toZero (x - 1) > else x : toZero (x + 1) > > > This function works as expected for positive arguments, e.g., "toZero 10" > gives me [10,9,8,7,6,5,4,3,2,1,0]. However, GHCI will raise following error > if I give it a negative argument, e.g., "toZero -10": > > *Main> toZero -10 > > :12:1: > Non type-variable argument in the constraint: Num (t -> [t]) > (Use FlexibleContexts to permit this) > When checking that ?it? has the inferred type > it :: forall t. (Integral t, Num (t -> [t])) => t -> [t] > > > This seems strange to me as 10 and -10 has exactly the same type "Num a => > a". I've done with chapter 1~10 of learnyouahaskell.com but still has no > idea on why this error. Anybody can help to explain this? > Thanks a lot. > > Regards > Zhiyi Xie > > _______________________________________________ > Beginners mailing list > Beginners at haskell.org > http://mail.haskell.org/cgi-bin/mailman/listinfo/beginners > > -------------- next part -------------- An HTML attachment was scrubbed... URL: From xie.zhiyi at gmail.com Mon Feb 8 20:20:48 2016 From: xie.zhiyi at gmail.com (wizard) Date: Tue, 9 Feb 2016 04:20:48 +0800 Subject: [Haskell-beginners] Got "Non type-variable argument in the constraint" error for a simple function In-Reply-To: References: Message-ID: Thanks Frerich and David! I got it, :-) 2016-02-09 0:43 GMT+08:00 David McBride : > If you are wondering why you are having this problem it is because - can > be interpretted as either a one argument negation or a two argument > subtraction. If you put parenthesis around (-n) where n is an integer, it > will interpret it as unary, something that will not happen in other > operators. > > >:t (-) > (-) :: Num a => a -> a -> a > >:t (+) > (+) :: Num a => a -> a -> a > >:t (-1) > (-1) :: Num a => a > >:t (+1) > (+1) :: Num a => a -> a > >:t (1-1) > (1-1) :: Num a => a > >:t (1+1) > (1+1) :: Num a => a > > > On Mon, Feb 8, 2016 at 11:24 AM, wizard wrote: > >> Dear all, >> >> I just started to learn Haskell with learnyouahaskell.com and at the >> very beginning, I met a strange issue with following simple function: >> >> -- why does work with "toZero 10" but not for "toZero -10"?toZero :: (Integral t) => t -> [t]toZero 0 = [0]toZero x = if x > 0 then x : toZero (x - 1) >> else x : toZero (x + 1) >> >> >> This function works as expected for positive arguments, e.g., "toZero 10" >> gives me [10,9,8,7,6,5,4,3,2,1,0]. However, GHCI will raise following error >> if I give it a negative argument, e.g., "toZero -10": >> >> *Main> toZero -10 >> >> :12:1: >> Non type-variable argument in the constraint: Num (t -> [t]) >> (Use FlexibleContexts to permit this) >> When checking that ?it? has the inferred type >> it :: forall t. (Integral t, Num (t -> [t])) => t -> [t] >> >> >> This seems strange to me as 10 and -10 has exactly the same type "Num a >> => a". I've done with chapter 1~10 of learnyouahaskell.com but still has >> no idea on why this error. Anybody can help to explain this? >> Thanks a lot. >> >> Regards >> Zhiyi Xie >> >> _______________________________________________ >> 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: From tanuki at gmail.com Mon Feb 8 23:15:20 2016 From: tanuki at gmail.com (Theodore Lief Gannon) Date: Mon, 8 Feb 2016 15:15:20 -0800 Subject: [Haskell-beginners] Returning Maybe Float -> Float -> Float In-Reply-To: References: <56B8A12C.9080602@utr.dk> Message-ID: This is a great use case for Monad Maybe: runOperation :: String -> Float -> Float -> Maybe Float runOperation op x y = do op' <- operation op return $ op' x y Or coming at it from the other end, Applicative Maybe: runOperation' :: String -> Float -> Float -> Maybe Float runOperation' op x y = operation op <*> Just x <*> Just y On Mon, Feb 8, 2016 at 6:21 AM, David McBride wrote: > You need to test to see whether you have a valid operation before you can > input the 2.0's. Try this: > > main = do > x <- getLine > putStrLn $ case operation x of > Nothing -> "Got nothing." > Just op -> show $ op 2.0 2.0 > > > On Mon, Feb 8, 2016 at 9:14 AM, Olivier Duhart > wrote: > >> thanks Ulrik, >> >> it solves the compilation problem. But now I have an execution error >> (with GHCi) : >> >> *Main> (operation "+") 2.0 2.0 >> >> :3:1: >> Couldn't match expected type `Double -> Double -> t' >> with actual type `Maybe (Float -> Float -> Float)' >> Relevant bindings include it :: t (bound at :3:1) >> The function `operation' is applied to three arguments, >> but its type `String -> Maybe (Float -> Float -> Float)' >> has only one >> In the expression: (operation "+") 2.0 2.0 >> In an equation for `it': it = (operation "+") 2.0 2.0 >> >> As I understand it ghci guess that the two 2.0 parameters to my >> (operation "+") are Double and the function returned by operation expects >> Float instead, How to solve this ? >> >> I tried to replace every Float with Double in my .hs file but still >> there is a problem >> >> *Main> (operation "+") 2.0 2.0 >> >> :3:1: >> Couldn't match expected type `Double -> Double -> t' >> with actual type `Maybe (Double -> Double -> Double)' >> Relevant bindings include it :: t (bound at :3:1) >> The function `operation' is applied to three arguments, >> but its type `String -> Maybe (Double -> Double -> Double)' >> has only one >> In the expression: (operation "+") 2.0 2.0 >> In an equation for `it': it = (operation "+") 2.0 2.0 >> >> Could you explain me what is the -> t at the end of the expected type ? >> >> >> >> Le lun. 8 f?vr. 2016 ? 15:07, Ulrik Rasmussen a ?crit : >> >>> On 2016-02-08 14:54, Olivier Duhart wrote: >>> > hello, >>> > >>> > I am starting with Haskell and trying some little exercices on my own. >>> I >>> > successfully implemented a reverse polish notation evaluator and I want >>> > to improve it a little using *Maybe* >>> > * >>> > * >>> > All i want is to implement a function that can returned available >>> > functions according to its string name >>> > i.e return (+) when gived "+" >>> > I also want to return Nothing if the operation is not available (not >>> > implemented yet). >>> > So my function should Maybe return a (float -> float -> float) >>> > >>> > My current implementation is >>> > >>> > operation :: String -> Maybe Float -> Float -> Float >>> > operation op >>> > | op == "+" = Just (+) >>> > | op == "-" = Just (-) >>> > | op == "*" = Just (*) >>> > | op == "/" = Just (/) >>> > | otherwise = Nothing >>> > >>> > >>> > but it failed to compile with the following error : >>> > >>> > rpn.hs:64:18: >>> > Couldn't match expected type `Maybe Float -> Float -> Float' >>> > with actual type `Maybe a0' >>> > In the expression: Nothing >>> > In an equation for `operation': >>> > operation op >>> > | op == "+" = Just (+) >>> > | op == "-" = Just (-) >>> > | op == "*" = Just (*) >>> > | op == "/" = Just (/) >>> > | otherwise = Nothing >>> > >>> > >>> > I don't understand the error :( Do I have to explicitly type the >>> Nothing >>> > return ? >>> > >>> > Could you guide me to a solution or explain me what I am doing wrong, >>> > please ? >>> > >>> > Thanks in advance >>> > >>> > Olivier >>> >>> Hi, >>> >>> The type String -> Maybe Float -> Float -> Float parenthesizes as >>> >>> String -> (Maybe Float) -> Float -> Float, >>> >>> but I think you meant >>> >>> String -> Maybe (Float -> Float -> Float) >>> >>> >>> /Ulrik >>> _______________________________________________ >>> 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: From bwrogalski at gmail.com Tue Feb 9 04:20:04 2016 From: bwrogalski at gmail.com (Ben Rogalski) Date: Mon, 8 Feb 2016 23:20:04 -0500 Subject: [Haskell-beginners] Understanding wrap function in Connor McBride's Faking It Message-ID: Hello, I am working on a Vector class, heavily based on the paper "Faking It: Simulating Dependent Types in Haskell" by Connor McBride. Here is a stripped down version of my code: --- {-# LANGUAGE RankNTypes #-} import Control.Applicative import Data.Functor infixr 5 :. data Cons u t = (:.) t (u t) deriving (Show) data Nil t = Nil deriving (Show) class (Applicative v, Functor v) => Vector v where wrap :: (forall u. Vector u => s -> f (u t) -> f (Cons u t)) -> f (Nil t) -> v s -> f (v t) instance (Vector u) => Vector (Cons u) where wrap f n (x:.xs) = f x (wrap f n xs) instance Vector Nil where wrap _ n Nil = n instance (Applicative u) => Applicative (Cons u) where pure x = x:.(pure x) (f:.fs) <*> (x:.xs) = (f x):.(fs <*> xs) instance Applicative Nil where pure _ = Nil _ <*> _ = Nil instance (Functor u) => Functor (Cons u) where fmap f (x:.xs) = (f x):.(fmap f xs) instance Functor Nil where fmap _ Nil = Nil transpose :: (Vector w, Vector u) => w (u t) -> u (w t) transpose v = wrap (\x xs -> (:.) <$> x <*> xs) (pure Nil) v --- I am having trouble understanding the type signature of 'wrap'. This is how I interpret it: (function that takes an 's' and container of 'u t' and returns a container of 'Cons u t') -> (container of 'Nil') -> (a vector of 's') -> (a container with the same type as the container of Nil, but containing v t instead) What doesn't make sense to me is how the signature seems to imply that the structure of the container in the return type is the same as the structure of the container holding the Nils, but in 'transpose' the container holding Nil seems to be infinite. Can someone help me to understand what is going on here? Thanks, Ben -------------- next part -------------- An HTML attachment was scrubbed... URL: From frederic-emmanuel.picca at synchrotron-soleil.fr Thu Feb 11 11:02:45 2016 From: frederic-emmanuel.picca at synchrotron-soleil.fr (PICCA Frederic-Emmanuel) Date: Thu, 11 Feb 2016 11:02:45 +0000 Subject: [Haskell-beginners] while loop Message-ID: Hello, I am playing with FFI and I need to extract from a C API a list of pointers. I have two methods available c_get_first_item :: Ptr List -> IO (Ptr Item) c_get_next_item :: Ptr List -> Ptr Item -> IO (Ptr Item) I would like to obtain a [Ptr Item] I try to used whileM but I did not find how to inject the first item in the loop. whileM (return . ( /= nullPtr)) (c_get_next_item list item) the c_get_next_item return a nullPtr when there is no remaining item. what is the haskell way in order to extract a list of pointer using these C methods ? thanks for your help Frederic From hsyl20 at gmail.com Thu Feb 11 12:11:45 2016 From: hsyl20 at gmail.com (Sylvain Henry) Date: Thu, 11 Feb 2016 13:11:45 +0100 Subject: [Haskell-beginners] while loop In-Reply-To: References: Message-ID: Hi, In these cases, I write the explicitly recursive version (e.g. getList1) and look for a pattern (e.g. getList2). getList1 :: Ptr List -> IO [Ptr Item] getList1 l = c_get_first_item l >>= go where go e | e == nullPtr = return [] | otherwise = do next <- c_get_next_item l e es <- go next return (e:es) getList2 :: Ptr List -> IO [Ptr Item] getList2 l = c_get_first_item l >>= unfoldrM go where go e | e == nullPtr = return Nothing | otherwise = do next <- c_get_next_item l e return (Just (e,next)) I hope it helps Sylvain 2016-02-11 12:02 GMT+01:00 PICCA Frederic-Emmanuel < frederic-emmanuel.picca at synchrotron-soleil.fr>: > Hello, > > I am playing with FFI and I need to extract from a C API a list of > pointers. > > I have two methods available > > c_get_first_item :: Ptr List -> IO (Ptr Item) > c_get_next_item :: Ptr List -> Ptr Item -> IO (Ptr Item) > > I would like to obtain a [Ptr Item] > > I try to used whileM but I did not find how to inject the first item in > the loop. > > whileM (return . ( /= nullPtr)) (c_get_next_item list item) > > the c_get_next_item return a nullPtr when there is no remaining item. > > what is the haskell way in order to extract a list of pointer using these > C methods ? > > thanks for your help > > Frederic > _______________________________________________ > Beginners mailing list > Beginners at haskell.org > http://mail.haskell.org/cgi-bin/mailman/listinfo/beginners > -------------- next part -------------- An HTML attachment was scrubbed... URL: From frederic-emmanuel.picca at synchrotron-soleil.fr Thu Feb 11 12:14:56 2016 From: frederic-emmanuel.picca at synchrotron-soleil.fr (PICCA Frederic-Emmanuel) Date: Thu, 11 Feb 2016 12:14:56 +0000 Subject: [Haskell-beginners] while loop In-Reply-To: References: , Message-ID: > I hope it helps Yes a lot :)) thanks you very much (merci beaucoup :p) Fr?d?ric From tjakway at nyu.edu Fri Feb 12 01:14:08 2016 From: tjakway at nyu.edu (Thomas Jakway) Date: Thu, 11 Feb 2016 20:14:08 -0500 Subject: [Haskell-beginners] Random Numbers with the State Monad Message-ID: <56BD31E0.4060708@nyu.edu> I'm having a bad time using the State monad to generate random numbers without carrying around a lot of StdGens manually. I have this snippet in the IO monad: ... IO stuff ... gen <- getStdGen let (numPlayers, numMatches) = (evalState genRandVariables gen) :: (Integer, Integer) ... More IO stuff ... where maxRandPlayers = 10 :: Integer minRandMatches = 10 :: Integer maxRandMatches = 100 :: Integer genRandVariables = (do np <- randomR (1, maxRandPlayers) --minimum 1 other player nm <- randomR (minRandMatches, maxRandMatches) return (np, nm)) :: State StdGen (Integer, Integer) I get this error message: test/Jakway/Blackjack/Tests/IntegrationTests/MatchTests.hs:53:23: Couldn't match expected type ?StateT StdGen Data.Functor.Identity.Identity Integer? with actual type ?g0 -> (Integer, g0)? Probable cause: ?randomR? is applied to too few arguments In a stmt of a 'do' block: np <- randomR (1, maxRandPlayers) In the expression: (do { np <- randomR (1, maxRandPlayers); nm <- randomR (minRandMatches, maxRandMatches); return (np, nm) }) :: State StdGen (Integer, Integer) test/Jakway/Blackjack/Tests/IntegrationTests/MatchTests.hs:54:23: Couldn't match expected type ?StateT StdGen Data.Functor.Identity.Identity Integer? with actual type ?g1 -> (Integer, g1)? Probable cause: ?randomR? is applied to too few arguments In a stmt of a 'do' block: nm <- randomR (minRandMatches, maxRandMatches) In the expression: (do { np <- randomR (1, maxRandPlayers); nm <- randomR (minRandMatches, maxRandMatches); return (np, nm) }) :: State StdGen (Integer, Integer) What's really baffling to me is I feel like this is how it *should* look--that the whole point of the state monad is to *not* have to explicitly pass the StdGen to randomR. What am I doing wrong? From snailandmail at gmail.com Fri Feb 12 11:38:01 2016 From: snailandmail at gmail.com (Nikita Kartashov) Date: Fri, 12 Feb 2016 14:38:01 +0300 Subject: [Haskell-beginners] Random Numbers with the State Monad In-Reply-To: <56BD31E0.4060708@nyu.edu> References: <56BD31E0.4060708@nyu.edu> Message-ID: <11EEE5C9-9376-4D75-8A1A-8B7D24C83F62@gmail.com> Hi! Take a look at MonadRandom [1]. It is basically what you want without getting generator explicitly. [1] https://hackage.haskell.org/package/MonadRandom With regards, Nikita Kartashov On 12 Feb 2016, at 04:14, Thomas Jakway wrote: > I'm having a bad time using the State monad to generate random numbers without carrying around a lot of StdGens manually. > I have this snippet in the IO monad: > > ... IO stuff ... > gen <- getStdGen > let (numPlayers, numMatches) = (evalState genRandVariables gen) :: (Integer, Integer) > ... More IO stuff ... > > where maxRandPlayers = 10 :: Integer > minRandMatches = 10 :: Integer > maxRandMatches = 100 :: Integer > genRandVariables = (do > np <- randomR (1, maxRandPlayers) --minimum 1 other player > nm <- randomR (minRandMatches, maxRandMatches) > return (np, nm)) :: State StdGen (Integer, Integer) > > > I get this error message: > test/Jakway/Blackjack/Tests/IntegrationTests/MatchTests.hs:53:23: > Couldn't match expected type ?StateT > StdGen Data.Functor.Identity.Identity Integer? > with actual type ?g0 -> (Integer, g0)? > Probable cause: ?randomR? is applied to too few arguments > In a stmt of a 'do' block: np <- randomR (1, maxRandPlayers) > In the expression: > (do { np <- randomR (1, maxRandPlayers); > nm <- randomR (minRandMatches, maxRandMatches); > return (np, nm) }) :: > State StdGen (Integer, Integer) > > test/Jakway/Blackjack/Tests/IntegrationTests/MatchTests.hs:54:23: > Couldn't match expected type ?StateT > StdGen Data.Functor.Identity.Identity Integer? > with actual type ?g1 -> (Integer, g1)? > Probable cause: ?randomR? is applied to too few arguments > In a stmt of a 'do' block: > nm <- randomR (minRandMatches, maxRandMatches) > In the expression: > (do { np <- randomR (1, maxRandPlayers); > nm <- randomR (minRandMatches, maxRandMatches); > return (np, nm) }) :: > State StdGen (Integer, Integer) > > What's really baffling to me is I feel like this is how it *should* look--that the whole point of the state monad is to *not* have to explicitly pass the StdGen to randomR. What am I doing wrong? > _______________________________________________ > Beginners mailing list > Beginners at haskell.org > http://mail.haskell.org/cgi-bin/mailman/listinfo/beginners -------------- next part -------------- An HTML attachment was scrubbed... URL: From imantc at gmail.com Fri Feb 12 11:43:57 2016 From: imantc at gmail.com (Imants Cekusins) Date: Fri, 12 Feb 2016 12:43:57 +0100 Subject: [Haskell-beginners] Unequal types constraint Message-ID: class C a b instance C Int a -- when a /= Int instance C a a -- when a == a how would you do this without IncoherentInstances? From tjakway at nyu.edu Fri Feb 12 12:37:31 2016 From: tjakway at nyu.edu (Thomas Jakway) Date: Fri, 12 Feb 2016 07:37:31 -0500 Subject: [Haskell-beginners] Random Numbers with the State Monad In-Reply-To: <11EEE5C9-9376-4D75-8A1A-8B7D24C83F62@gmail.com> References: <56BD31E0.4060708@nyu.edu> <11EEE5C9-9376-4D75-8A1A-8B7D24C83F62@gmail.com> Message-ID: <56BDD20B.7090309@nyu.edu> That's a good idea, though not understanding the state monad is still pretty frustrating. On 2/12/16 6:38 AM, Nikita Kartashov wrote: > Hi! > > Take a look at MonadRandom [1]. It is basically what you want without > getting generator explicitly. > > [1] https://hackage.haskell.org/package/MonadRandom > > With regards, > Nikita Kartashov > > > > On 12 Feb 2016, at 04:14, Thomas Jakway > wrote: > >> I'm having a bad time using the State monad to generate random >> numbers without carrying around a lot of StdGens manually. >> I have this snippet in the IO monad: >> >> ... IO stuff ... >> gen <- getStdGen >> let (numPlayers, numMatches) = (evalState genRandVariables gen) :: >> (Integer, Integer) >> ... More IO stuff ... >> >> where maxRandPlayers = 10 :: Integer >> minRandMatches = 10 :: Integer >> maxRandMatches = 100 :: Integer >> genRandVariables = (do >> np <- randomR (1, maxRandPlayers) --minimum 1 other player >> nm <- randomR (minRandMatches, maxRandMatches) >> return (np, nm)) :: State StdGen (Integer, Integer) >> >> >> I get this error message: >> test/Jakway/Blackjack/Tests/IntegrationTests/MatchTests.hs:53:23: >> Couldn't match expected type ?StateT >> StdGen >> Data.Functor.Identity.Identity Integer? >> with actual type ?g0 -> (Integer, g0)? >> Probable cause: ?randomR? is applied to too few arguments >> In a stmt of a 'do' block: np <- randomR (1, maxRandPlayers) >> In the expression: >> (do { np <- randomR (1, maxRandPlayers); >> nm <- randomR (minRandMatches, maxRandMatches); >> return (np, nm) }) :: >> State StdGen (Integer, Integer) >> >> test/Jakway/Blackjack/Tests/IntegrationTests/MatchTests.hs:54:23: >> Couldn't match expected type ?StateT >> StdGen >> Data.Functor.Identity.Identity Integer? >> with actual type ?g1 -> (Integer, g1)? >> Probable cause: ?randomR? is applied to too few arguments >> In a stmt of a 'do' block: >> nm <- randomR (minRandMatches, maxRandMatches) >> In the expression: >> (do { np <- randomR (1, maxRandPlayers); >> nm <- randomR (minRandMatches, maxRandMatches); >> return (np, nm) }) :: >> State StdGen (Integer, Integer) >> >> What's really baffling to me is I feel like this is how it *should* >> look--that the whole point of the state monad is to *not* have to >> explicitly pass the StdGen to randomR. What am I doing wrong? >> _______________________________________________ >> 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: From marcin.jan.mrotek at gmail.com Fri Feb 12 13:26:36 2016 From: marcin.jan.mrotek at gmail.com (Marcin Mrotek) Date: Fri, 12 Feb 2016 14:26:36 +0100 Subject: [Haskell-beginners] Random Numbers with the State Monad In-Reply-To: <56BDD20B.7090309@nyu.edu> References: <56BD31E0.4060708@nyu.edu> <11EEE5C9-9376-4D75-8A1A-8B7D24C83F62@gmail.com> <56BDD20B.7090309@nyu.edu> Message-ID: Hello, You have this type error: Couldn't match expected type ?StateT StdGen Data.Functor.Identity.Identity Integer? with actual type ?g1 -> (Integer, g1)? It's because you're trying to use a `(s -> (a,s))` function "unwrapped" where GHC expects it "wrapped" in a StateT. The type of `state` from Control.Monad.State (mtl package) is: state :: (s -> (a, s)) -> m a so it could solve your mismatch, turning `g1 -> (Integer, g1)` into `StateT StdGen Identity Integer`, like: np <- state (randomR (1, maxRandPlayers)) Alternatively, if you don't want to use mtl, you can use `StateT`s constructor directly. It's type is: StateT :: (s -> m (a, s)) -> StateT s m a so you'd have to compose `randomR` with `return` (or `pure`) first: np <- StateT (return . randomR (1, maxRandPlayers)) Best regards, Marcin Mrotek From tjakway at nyu.edu Sat Feb 13 15:37:50 2016 From: tjakway at nyu.edu (Thomas Jakway) Date: Sat, 13 Feb 2016 10:37:50 -0500 Subject: [Haskell-beginners] Random Numbers with the State Monad In-Reply-To: References: <56BD31E0.4060708@nyu.edu> <11EEE5C9-9376-4D75-8A1A-8B7D24C83F62@gmail.com> <56BDD20B.7090309@nyu.edu> Message-ID: <56BF4DCE.1010604@nyu.edu> Thanks! That makes sense On 2/12/16 8:26 AM, Marcin Mrotek wrote: > Hello, > > You have this type error: > > Couldn't match expected type ?StateT > StdGen > Data.Functor.Identity.Identity Integer? > with actual type ?g1 -> (Integer, g1)? > > It's because you're trying to use a `(s -> (a,s))` function > "unwrapped" where GHC expects it "wrapped" in a StateT. > The type of `state` from Control.Monad.State (mtl package) is: > > state :: (s -> (a, s)) -> m a > > so it could solve your mismatch, turning `g1 -> (Integer, g1)` into > `StateT StdGen Identity Integer`, like: > > np <- state (randomR (1, maxRandPlayers)) > > Alternatively, if you don't want to use mtl, you can use `StateT`s > constructor directly. It's type is: > > StateT :: (s -> m (a, s)) -> StateT s m a > > so you'd have to compose `randomR` with `return` (or `pure`) first: > > np <- StateT (return . randomR (1, maxRandPlayers)) > > Best regards, > Marcin Mrotek > _______________________________________________ > Beginners mailing list > Beginners at haskell.org > http://mail.haskell.org/cgi-bin/mailman/listinfo/beginners From ch.gosch at googlemail.com Mon Feb 15 08:26:50 2016 From: ch.gosch at googlemail.com (C Gosch) Date: Mon, 15 Feb 2016 00:26:50 -0800 Subject: [Haskell-beginners] GLUT bindings on Mac OS X 10.11 Message-ID: Hello Haskellers, I have used Haskell for a bit on Linux and Windows, and now started using OS X 10.11. I wanted to run a program using the GLUT bindings, and it complains about "user error (unknown GLUT entry glutSetOption)? when I set certain options with ($=), for example actionOnWindowClose. A bit of googling did not gain me much other than that glutSetOption is available in freeGlut, which is not the standard GLUT on Mac OS X, it seems. Does anyone have an idea how to get around this? Can I replace OS X?s GLUT with FreeGLUT? Thanks a bundle, Christian From dennis.raddle at gmail.com Tue Feb 16 08:06:21 2016 From: dennis.raddle at gmail.com (Dennis Raddle) Date: Tue, 16 Feb 2016 00:06:21 -0800 Subject: [Haskell-beginners] arrows and 2-tuples Message-ID: I am a Haskell beginner. I have used arrows occasionally to move 2-tuples around, but don't understand more than that. I'm interested in know what's the connection between arrows and 2-tuples. I don't really understand most of the Control.Arrow docs, but it seems that a lot of stuff about arrows doesn't mention 2-tuples. Yet the operators (***), (&&&), first, and second seem to be common. Is there some way to explain the link? Also, the main instance of Arrow seems to be (->). There is also something about Kleisli monads, but I don't know what those are. Is there an another big use case for arrows besides (->)? Don't worry about explaining it all, just a quick mention would be fine and I can investigate it myself. D -------------- next part -------------- An HTML attachment was scrubbed... URL: From michael at orlitzky.com Tue Feb 16 15:22:15 2016 From: michael at orlitzky.com (Michael Orlitzky) Date: Tue, 16 Feb 2016 10:22:15 -0500 Subject: [Haskell-beginners] arrows and 2-tuples In-Reply-To: References: Message-ID: <56C33EA7.4090404@orlitzky.com> On 02/16/2016 03:06 AM, Dennis Raddle wrote: > I am a Haskell beginner. I have used arrows occasionally to move > 2-tuples around, but don't understand more than that. > > I'm interested in know what's the connection between arrows and > 2-tuples. I don't really understand most of the Control.Arrow docs, but > it seems that a lot of stuff about arrows doesn't mention 2-tuples. Yet > the operators (***), (&&&), first, and second seem to be common. Is > there some way to explain the link? > > Also, the main instance of Arrow seems to be (->). There is also > something about Kleisli monads, but I don't know what those are. Is > there an another big use case for arrows besides (->)? Don't worry about > explaining it all, just a quick mention would be fine and I can > investigate it myself. > An arrow is basically a function and it doesn't hurt to think of them that way. In mathematics, "function" means something very specific, so they needed a new name (arrow) for a thing that's a lot like a function but isn't one. You can construct some weird situations where arrows aren't very much like mathematical functions at all, but it still doesn't hurt to think of them that way. Mentally I prefer to embiggen my concept of "function" rather than give it up entirely in the new setting. You're probably already used to this: the random() "function" is not a mathematical function, but we all call it one. There's no specific connection between arrows and two-tuples. It's extremely common to use functions on two-tuples, and every function is an arrow, so the fact that all of those useful (***) and (&&&) live in Control.Arrow is a bit of a premature abstraction. Frequently you'll need to take a function f and a pair (x,y) and want to compute the pair (f x, f y). There should really be a combinator for that! But when you write one, it turns out that it works just as well for arrows. Since all functions are arrows, they just used the more general type. The Kleisli arrow/monad thing isn't wrong, it's just useless without an example. Kleisli arrows are just plain old arrows (think: functions) in a monad. Suppose I want to read a file and then print its contents to the screen. How would I do that? In pseudo-code, it's something like, -- Read a file and print its contents to the screen (putStr . readFile) "/path/to/file.txt" But here, "print" and "readFile" aren't mathematical functions, so we can't compose them! The "." operator only works on functions. It would be great if there were something that was a lot like a function but could be composed in this manner... -- Read a file and print its contents to the screen ghci> import Control.Monad ( (<=<) ) ghci> (putStr <=< readFile) "hw.txt" Hello, world! Another useful example is when you want to "automatically" concatenate a list of results. Let's write a stupid function that duplicates its argument in a list: ghci> let twice x = [x, x] ghci> twice 3 [3,3] So far so good. But now I want four things. Can I compose "twice" with itself? ghci> (twice . twice) 3 [[3,3],[3,3]] ghci> :t (twice . twice) (twice . twice) :: t -> [[t]] Crap, that's giving me a list of lists. I just want one list! By thinking of "twice" as a multi-valued function (a special type of arrow), I can get what I want: ghci> (twice <=< twice) 3 [3,3,3,3] That trick is using the Monad instance for lists, but composition in monads is done with arrows (not mathematical functions). It's put to good use in e.g. HXT where you can say "give me all children of

elements that live in a

that live in a " and you only want one list back. Without that funny arrow composition, you'd be stuck with lists of lists of lists of lists... From dennis.raddle at gmail.com Tue Feb 16 21:11:57 2016 From: dennis.raddle at gmail.com (Dennis Raddle) Date: Tue, 16 Feb 2016 13:11:57 -0800 Subject: [Haskell-beginners] arrows and 2-tuples In-Reply-To: <56C33EA7.4090404@orlitzky.com> References: <56C33EA7.4090404@orlitzky.com> Message-ID: Thank you, this is great. I notice that none of your monad examples import Control.Arrow. The composition operators come from Control.Monad, right? So it's correct to call putStr etc. an arrow even though we never need to actually use the word "arrow" to work with it or compose such "functions"? D On Tue, Feb 16, 2016 at 7:22 AM, Michael Orlitzky wrote: > On 02/16/2016 03:06 AM, Dennis Raddle wrote: > > I am a Haskell beginner. I have used arrows occasionally to move > > 2-tuples around, but don't understand more than that. > > > > I'm interested in know what's the connection between arrows and > > 2-tuples. I don't really understand most of the Control.Arrow docs, but > > it seems that a lot of stuff about arrows doesn't mention 2-tuples. Yet > > the operators (***), (&&&), first, and second seem to be common. Is > > there some way to explain the link? > > > > Also, the main instance of Arrow seems to be (->). There is also > > something about Kleisli monads, but I don't know what those are. Is > > there an another big use case for arrows besides (->)? Don't worry about > > explaining it all, just a quick mention would be fine and I can > > investigate it myself. > > > > An arrow is basically a function and it doesn't hurt to think of them > that way. In mathematics, "function" means something very specific, so > they needed a new name (arrow) for a thing that's a lot like a function > but isn't one. > > You can construct some weird situations where arrows aren't very much > like mathematical functions at all, but it still doesn't hurt to think > of them that way. Mentally I prefer to embiggen my concept of "function" > rather than give it up entirely in the new setting. You're probably > already used to this: the random() "function" is not a mathematical > function, but we all call it one. > > There's no specific connection between arrows and two-tuples. It's > extremely common to use functions on two-tuples, and every function is > an arrow, so the fact that all of those useful (***) and (&&&) live in > Control.Arrow is a bit of a premature abstraction. Frequently you'll > need to take a function f and a pair (x,y) and want to compute the pair > (f x, f y). There should really be a combinator for that! But when you > write one, it turns out that it works just as well for arrows. Since all > functions are arrows, they just used the more general type. > > The Kleisli arrow/monad thing isn't wrong, it's just useless without an > example. Kleisli arrows are just plain old arrows (think: functions) in > a monad. Suppose I want to read a file and then print its contents to > the screen. How would I do that? In pseudo-code, it's something like, > > -- Read a file and print its contents to the screen > (putStr . readFile) "/path/to/file.txt" > > But here, "print" and "readFile" aren't mathematical functions, so we > can't compose them! The "." operator only works on functions. It would > be great if there were something that was a lot like a function but > could be composed in this manner... > > -- Read a file and print its contents to the screen > ghci> import Control.Monad ( (<=<) ) > ghci> (putStr <=< readFile) "hw.txt" > Hello, world! > > Another useful example is when you want to "automatically" concatenate a > list of results. Let's write a stupid function that duplicates its > argument in a list: > > ghci> let twice x = [x, x] > ghci> twice 3 > [3,3] > > So far so good. But now I want four things. Can I compose "twice" with > itself? > > ghci> (twice . twice) 3 > [[3,3],[3,3]] > ghci> :t (twice . twice) > (twice . twice) :: t -> [[t]] > > Crap, that's giving me a list of lists. I just want one list! By > thinking of "twice" as a multi-valued function (a special type of > arrow), I can get what I want: > > ghci> (twice <=< twice) 3 > [3,3,3,3] > > That trick is using the Monad instance for lists, but composition in > monads is done with arrows (not mathematical functions). It's put to > good use in e.g. HXT where you can say "give me all children of

> elements that live in a

that live in a " and you only want > one list back. Without that funny arrow composition, you'd be stuck with > lists of lists of lists of lists... > > _______________________________________________ > Beginners mailing list > Beginners at haskell.org > http://mail.haskell.org/cgi-bin/mailman/listinfo/beginners > -------------- next part -------------- An HTML attachment was scrubbed... URL: From michael at orlitzky.com Tue Feb 16 23:19:05 2016 From: michael at orlitzky.com (Michael Orlitzky) Date: Tue, 16 Feb 2016 18:19:05 -0500 Subject: [Haskell-beginners] arrows and 2-tuples In-Reply-To: References: <56C33EA7.4090404@orlitzky.com> Message-ID: <56C3AE69.9030803@orlitzky.com> On 02/16/2016 04:11 PM, Dennis Raddle wrote: > Thank you, this is great. I notice that none of your monad examples > import Control.Arrow. The composition operators come from Control.Monad, > right? So it's correct to call putStr etc. an arrow even though we never > need to actually use the word "arrow" to work with it or compose such > "functions"? Sure, they're just a special kind of arrow. My examples used (<=<) because otherwise you won't get the composition "in a monad" and it won't work the way it should: ghci> import Control.Arrow ( (<<<) ) ghci> let twice x = [x, x] ghci> (twice <<< twice) 3 [[3,3],[3,3]] "Why" is a little annoying. Basically, in Haskell, you can only make a structure an instance of a typeclass in one way. This gets in the way when there's more than one valid choice. For example, you might have, data Person = Person { firstname :: String, lastname :: String } Now if you want to display these, how would you do it? Here's one way: instance Show Person where -- FirstName LastName show p = (firstname p) ++ " " ++ (lastname p) But here's another: instance Show Person where -- Lastname, Firstname show p = (lastname p) ++ ", " ++ (firstname p) Which one is correct? They're equally valid... but you can only choose one. If I want both of them, I have to wrap Person in a newtype and then give that newtype a Show instance. Or another way would be to create a second typeclass (Show2?) that acts differently than Show. The same thing happens with these abstract algebraic structures. I can take the set {0, 1} and make it a group in two different ways, but in Haskell, I have to choose only one. What you're seeing with (<<<) versus (<=<) is just one of those choices. When you have a function like "twice", there's an obvious way to make it an arrow -- you define arrow composition to be function composition. In that way you can make every function an Arrow instance by default. But as you saw, there's actually a second and equally-valid way to define the (arrow) composition between things of the type a -> [a]. If you use "composition" from Arrow, you'll get the default function composition, but if you use "composition" from Monad, you'll get the second type. tl;dr if you want a useful example of arrows, you aren't going to get it by using (<<<) on regular functions because all you're going to get is regular function composition, and you already know how that's useful. From dennis.raddle at gmail.com Wed Feb 17 02:12:12 2016 From: dennis.raddle at gmail.com (Dennis Raddle) Date: Tue, 16 Feb 2016 18:12:12 -0800 Subject: [Haskell-beginners] arrows and 2-tuples In-Reply-To: <56C3AE69.9030803@orlitzky.com> References: <56C33EA7.4090404@orlitzky.com> <56C3AE69.9030803@orlitzky.com> Message-ID: okay, got it. thanks!? -------------- next part -------------- An HTML attachment was scrubbed... URL: From mamontov.dp at gmail.com Wed Feb 17 20:13:15 2016 From: mamontov.dp at gmail.com (Dmitry Mamontov) Date: Wed, 17 Feb 2016 23:13:15 +0300 Subject: [Haskell-beginners] Problems with IO an laziness Message-ID: I am a Haskell beginner. I've tried to write a tiny VM-like thing but ran into a problems with IO and evaluation order. Here is the full source code of this VM: https://gist.github.com/mamontov-cpp/c4d8e2e46e7541c0c646 . This code is supposed to read 4 strings and output them in reverse order. While it seems to read some strings, it requests much more than one string from user on each step of evaluation of meta-program, stored as array in main function (which is just wrong). I assume the problem with this program, is that the main state, being immutable, seems to get re-evaluated on several steps inside of internal parts of runProgram and runInstructionOrStop, forcing it to repeat requesting data from user. So, how can I prevent this main state from being re-evaluated in following code ? Or is there any other problems, which I don't see? -------------- next part -------------- An HTML attachment was scrubbed... URL: From hsyl20 at gmail.com Wed Feb 17 23:54:35 2016 From: hsyl20 at gmail.com (Sylvain Henry) Date: Thu, 18 Feb 2016 00:54:35 +0100 Subject: [Haskell-beginners] Problems with IO an laziness In-Reply-To: References: Message-ID: Hi, The problem is in your "runProgram" and "runInstructionOrStop" functions: their "state" parameter should have type "ProgramState" and not "IO ProgramState" and they have to be fixed accordingly. With your code, you "append new actions" (opReadString "a", etc.) to "state" with "(state >>= (getInstruction pos program))" and you execute the whole program up to the current instruction each time in "(fmap (checkProgramBounds program) state)" and "(fmap position state)". In addition, this is what I would do to enhance your code (in order): 1) Use do-notation in runProgram and runInstructionOrStop (i.e. remove "perform" let-bindings and ">>=") to make the code easier to understand. 2) Don't store the program in a list: length and (!!) are O(n) with lists. Use Vector instead. 3) Put the program in ProgramState 4) More advanced (State monad + monad transformers): use a Program type defined as: type Program a = StateT ProgramState IO a 5) Rewrite runProgram and runInstructionOrStop with "sequence" from Control.Monad Regards, Sylvain 2016-02-17 21:13 GMT+01:00 Dmitry Mamontov : > I am a Haskell beginner. I've tried to write a tiny VM-like thing but ran > into a problems with IO and evaluation order. > > Here is the full source code of this VM: > https://gist.github.com/mamontov-cpp/c4d8e2e46e7541c0c646 . This code is > supposed to read 4 strings and output them in reverse order. > > While it seems to read some strings, it requests much more than one string > from user on each step of evaluation of meta-program, stored as array in > main function (which is just wrong). > > I assume the problem with this program, is that the main state, being > immutable, seems to get re-evaluated on several steps inside of internal > parts of runProgram and runInstructionOrStop, forcing it to repeat > requesting data from user. > > So, how can I prevent this main state from being re-evaluated in following > code ? Or is there any other problems, which I don't see? > > > > > _______________________________________________ > Beginners mailing list > Beginners at haskell.org > http://mail.haskell.org/cgi-bin/mailman/listinfo/beginners > > -------------- next part -------------- An HTML attachment was scrubbed... URL: From mamontov.dp at gmail.com Thu Feb 18 06:06:18 2016 From: mamontov.dp at gmail.com (Dmitry Mamontov) Date: Thu, 18 Feb 2016 09:06:18 +0300 Subject: [Haskell-beginners] Problems with IO an laziness In-Reply-To: References: Message-ID: Thanks for your help. This solved my problems. -------------- next part -------------- An HTML attachment was scrubbed... URL: From frederic-emmanuel.picca at synchrotron-soleil.fr Thu Feb 18 14:57:50 2016 From: frederic-emmanuel.picca at synchrotron-soleil.fr (PICCA Frederic-Emmanuel) Date: Thu, 18 Feb 2016 14:57:50 +0000 Subject: [Haskell-beginners] howto Pipe Message-ID: Hello I try to mix my C library and the Pipe module here the code I am using solveTraj :: Factory -> Geometry -> Detector -> Sample -> Pipe Engine Geometry IO () solveTraj f g d s = do e <- await let name = engineName e withSample s $ \sample -> withDetector d $ \detector -> withGeometry f g $ \geometry -> withEngineList f $ \engines -> withCString name $ \cname -> do c_hkl_engine_list_init engines geometry detector sample engine <- c_hkl_engine_list_engine_get_by_name engines cname nullPtr n <- c_hkl_engine_pseudo_axis_names_get engine >>= darrayStringLen yield $ solve' engine n e >>= getSolution0 where getSolution0 :: ForeignPtr HklGeometryList -> IO Geometry And I am using this like this runEffect $ for (each engines) >-> solveTraj factory geometry detector sample >-> P.print where [Engine] engines But When I compile the code I get this error. src/Hkl/C.hsc:83:3: Couldn't match type `IO' with `Proxy () Engine () Geometry IO' Expected type: Proxy () Engine () Geometry IO () Actual type: IO () In a stmt of a 'do' block: withSample s $ \ sample -> withDetector d $ \ detector -> withGeometry f g $ \ geometry -> ... In the expression: do { e <- await; let name = engineName e; withSample s $ \ sample -> withDetector d $ \ detector -> ... } In an equation for `solveTraj': solveTraj f g d s = do { e <- await; let name = ...; withSample s $ \ sample -> withDetector d $ ... } src/Hkl/C.hsc:91:19: Couldn't match type `Proxy x'0 x0 () (IO Geometry) m0' with `IO' Expected type: IO () Actual type: Proxy x'0 x0 () (IO Geometry) m0 () In a stmt of a 'do' block: yield $ solve' engine n e >>= getSolution0 In the expression: do { c_hkl_engine_list_init engines geometry detector sample; engine <- c_hkl_engine_list_engine_get_by_name engines cname nullPtr; n <- c_hkl_engine_pseudo_axis_names_get engine >>= darrayStringLen; yield $ solve' engine n e >>= getSolution0 } In the second argument of `($)', namely `\ cname -> do { c_hkl_engine_list_init engines geometry detector sample; engine <- c_hkl_engine_list_engine_get_by_name engines cname nullPtr; .... }' I do not understand why the yield does not produce the right type as output. I think I missed something big :), but... Thanks for your help Fred From marcin.jan.mrotek at gmail.com Thu Feb 18 15:46:04 2016 From: marcin.jan.mrotek at gmail.com (Marcin Mrotek) Date: Thu, 18 Feb 2016 16:46:04 +0100 Subject: [Haskell-beginners] ODP: howto Pipe In-Reply-To: References: Message-ID: <56c5e758.905b190a.86e57.6734@mx.google.com> Hello, I presume these `c_hkl_` return `IO`? Then you need to `lift` them into `Pipe` (well, `Proxy`). Best regards, Marcin Mrotek -----Wiadomo?? oryginalna----- Od: "PICCA Frederic-Emmanuel" Wys?ano: ?2016-?02-?18 15:58 Do: "beginners at haskell.org" Temat: [Haskell-beginners] howto Pipe Hello I try to mix my C library and the Pipe module here the code I am using solveTraj :: Factory -> Geometry -> Detector -> Sample -> Pipe Engine Geometry IO () solveTraj f g d s = do e <- await let name = engineName e withSample s $ \sample -> withDetector d $ \detector -> withGeometry f g $ \geometry -> withEngineList f $ \engines -> withCString name $ \cname -> do c_hkl_engine_list_init engines geometry detector sample engine <- c_hkl_engine_list_engine_get_by_name engines cname nullPtr n <- c_hkl_engine_pseudo_axis_names_get engine >>= darrayStringLen yield $ solve' engine n e >>= getSolution0 where getSolution0 :: ForeignPtr HklGeometryList -> IO Geometry And I am using this like this runEffect $ for (each engines) >-> solveTraj factory geometry detector sample >-> P.print where [Engine] engines But When I compile the code I get this error. src/Hkl/C.hsc:83:3: Couldn't match type `IO' with `Proxy () Engine () Geometry IO' Expected type: Proxy () Engine () Geometry IO () Actual type: IO () In a stmt of a 'do' block: withSample s $ \ sample -> withDetector d $ \ detector -> withGeometry f g $ \ geometry -> ... In the expression: do { e <- await; let name = engineName e; withSample s $ \ sample -> withDetector d $ \ detector -> ... } In an equation for `solveTraj': solveTraj f g d s = do { e <- await; let name = ...; withSample s $ \ sample -> withDetector d $ ... } src/Hkl/C.hsc:91:19: Couldn't match type `Proxy x'0 x0 () (IO Geometry) m0' with `IO' Expected type: IO () Actual type: Proxy x'0 x0 () (IO Geometry) m0 () In a stmt of a 'do' block: yield $ solve' engine n e >>= getSolution0 In the expression: do { c_hkl_engine_list_init engines geometry detector sample; engine <- c_hkl_engine_list_engine_get_by_name engines cname nullPtr; n <- c_hkl_engine_pseudo_axis_names_get engine >>= darrayStringLen; yield $ solve' engine n e >>= getSolution0 } In the second argument of `($)', namely `\ cname -> do { c_hkl_engine_list_init engines geometry detector sample; engine <- c_hkl_engine_list_engine_get_by_name engines cname nullPtr; .... }' I do not understand why the yield does not produce the right type as output. I think I missed something big :), but... Thanks for your help Fred _______________________________________________ Beginners mailing list Beginners at haskell.org http://mail.haskell.org/cgi-bin/mailman/listinfo/beginners -------------- next part -------------- An HTML attachment was scrubbed... URL: From frederic-emmanuel.picca at synchrotron-soleil.fr Thu Feb 18 16:45:24 2016 From: frederic-emmanuel.picca at synchrotron-soleil.fr (PICCA Frederic-Emmanuel) Date: Thu, 18 Feb 2016 16:45:24 +0000 Subject: [Haskell-beginners] ODP: howto Pipe In-Reply-To: <56c5e758.905b190a.86e57.6734@mx.google.com> References: , <56c5e758.905b190a.86e57.6734@mx.google.com> Message-ID: > I presume these `c_hkl_` return `IO`? Then you need to `lift` them into `Pipe` (well, `Proxy`). Yes the c_hkl_ method return IO a or IO () what do you mean exactly by lift them ihto pipe ? Cheers Fr?d?ric From marcin.jan.mrotek at gmail.com Thu Feb 18 17:12:07 2016 From: marcin.jan.mrotek at gmail.com (Marcin Mrotek) Date: Thu, 18 Feb 2016 18:12:07 +0100 Subject: [Haskell-beginners] ODP: howto Pipe In-Reply-To: References: <56c5e758.905b190a.86e57.6734@mx.google.com> Message-ID: I mean literally use the function `lift`. Proxy (it's the underlying type of all pipes, Pipe is a type synonym that expands to Proxy, filling some type variables for you) implements the MonadTrans class (from http://hackage.haskell.org/package/transformers-0.5.1.0/docs/Control-Monad-Trans-Class.html): class MonadTrans t where lift :: Monad m => m a -> t m a So, if `t` is `Pipe a b` and `m` is IO, then `lift` becomes: lift :: IO r -> Pipe a b IO r Thus, for example, `lift (c_hkl_engine_list_init engines geometry detector sample)` will return `Pipe a b IO ` (for any `a` and `b`, this is going to be a trivial pipe that doesn't yield or await anything, and just executes the effect) rather than `IO `. You don't need to import the Monad.Trans.Class module, Pipe reexports it for you. Best regards, Marcin Mrotek From frederic-emmanuel.picca at synchrotron-soleil.fr Thu Feb 18 17:21:41 2016 From: frederic-emmanuel.picca at synchrotron-soleil.fr (PICCA Frederic-Emmanuel) Date: Thu, 18 Feb 2016 17:21:41 +0000 Subject: [Haskell-beginners] ODP: howto Pipe In-Reply-To: References: <56c5e758.905b190a.86e57.6734@mx.google.com> , Message-ID: I thought that the yield method took care of this and return the right type (Pipe ...) at the end of the do statement. This is not the case ? thanks for your explanations. Fred From marcin.jan.mrotek at gmail.com Thu Feb 18 17:47:49 2016 From: marcin.jan.mrotek at gmail.com (Marcin Mrotek) Date: Thu, 18 Feb 2016 18:47:49 +0100 Subject: [Haskell-beginners] ODP: howto Pipe In-Reply-To: References: <56c5e758.905b190a.86e57.6734@mx.google.com> Message-ID: Yes, yield does return a Pipe. But "do" notation expands to a chain of ">>" and ">>=", and these functions only connect monadic values from the same monad. Pipes are monad transformers, so the conversion from IO to `Pipe a b IO` doesn't do anything interesting (converting back to IO would require running the pipe, which is less trivial), but it still has to be done for the types to agree. Also, now I've noticed that you may have some trouble with the `withSomething` functions. Do they take functions of type `a -> m b` and return the result wrapped again in `m` for any monad `m`, or do they only work with IO? If they are limited to IO, then you can't use them here, as you would need to convert a Pipe back to IO, and this conversion isn't a no-op and probably not what you want to do here. If this is the case, you'd need the raw functions that open and close these resources, and use Pipes.Safe to wrap them (https://hackage.haskell.org/package/pipes-safe): bracket :: MonadSafe m => Base m a -> (a -> Base m b) -> (a -> m c) -> m c This might look a bit convoluted, but for the sake of working with Pipes and IO, you can think of it as having type: bracket :: IO a -> (a -> IO b) -> (a -> Pipe x y (SafeT IO) c) -> Pipe x y (SafeT IO) c The first argument opens some resource, the senond closes it, and the third is the main working function. Instead of having a `Pipe x y IO c` you have `Pipe x y (SafeT IO) c` but this is almost the same, you'd only have to use `liftIO` instead of just `lift` to lift from IO to this monad (or use `lift` twice, once to get `SafeT IO`, and yet again to lift to `Pipe`), and after running the effect, use `runSafeT` to unwrap the value to get IO (this action ensures that the finalizer you provided to `bracket` is always executed, even if some exceptions have been raised meanwhile). But again, if the `withSomething` functions are polymorphic with respect to the monad used, then you leave them as they are and don't bother with Pipes.Safe, just wanted to warn you about a potential problem. Best regards, Marcin Mrotek From frederic-emmanuel.picca at synchrotron-soleil.fr Thu Feb 18 18:09:51 2016 From: frederic-emmanuel.picca at synchrotron-soleil.fr (PICCA Frederic-Emmanuel) Date: Thu, 18 Feb 2016 18:09:51 +0000 Subject: [Haskell-beginners] ODP: howto Pipe In-Reply-To: References: <56c5e758.905b190a.86e57.6734@mx.google.com> , Message-ID: Yes my withSomething method are of this kind withGeometry :: Factory -> Geometry -> (Ptr HklGeometry -> IO b) -> IO b withGeometry f g fun = do fptr <- newGeometry f g withForeignPtr fptr fun newGeometry :: Factory -> Geometry -> IO (ForeignPtr HklGeometry) If I come back to my method, at the beginin I had this signature. solveTraj :: Factory -> Geometry -> Detector -> Sample -> [Engine] -> IO [GEometry] the last line was mapM (solve' engine n e >>= getSolution0) [engines] but When I run the code for 100000 points I got a huge consomation of the memory... So I tryed to solve this problem using the Pipe. solveTraj :: Factory -> Geometry -> Detector -> Sample -> Pipe Engine Geometry IO () solveTraj f g d s = do e <- await let name = engineName e withSample s $ \sample -> withDetector d $ \detector -> withGeometry f g $ \geometry -> withEngineList f $ \engines -> withCString name $ \cname -> do c_hkl_engine_list_init engines geometry detector sample engine <- c_hkl_engine_list_engine_get_by_name engines cname nullPtr n <- c_hkl_engine_pseudo_axis_names_get engine >>= darrayStringLen yield $ solve' engine n e >>= getSolution0 Now I think that this is maybe the wrong way to solve my issue. the computation done by my C library in the solve' depends of the previous step. when I solve my system the geometry "C object" move. (this is a side effect really important for my computation) solve' :: Ptr HklEngine -> CSize -> Engine -> IO (ForeignPtr HklGeometryList) solve' engine n (Engine _ ps _) = do let positions = [v | (Parameter _ v _) <- ps] withArray positions $ \values -> c_hkl_engine_pseudo_axis_values_set engine values n unit nullPtr >>= newForeignPtr c_hkl_geometry_list_free so I can not convert this into a single pipe step... or maybe it is possible to create a pipe which store this internal state in order to treat each steps. It start to be a little bit difficult for me to manage all this :)) Cheers Frederic. Ps: the starting point of this is the huge memory use by my software... From marcin.jan.mrotek at gmail.com Fri Feb 19 08:05:31 2016 From: marcin.jan.mrotek at gmail.com (Marcin Mrotek) Date: Fri, 19 Feb 2016 09:05:31 +0100 Subject: [Haskell-beginners] ODP: howto Pipe In-Reply-To: References: <56c5e758.905b190a.86e57.6734@mx.google.com> Message-ID: Well, if pipelining only the outermost layer is enough to improve performance of your code, perhaps you could just move `yield` outside all the `with...` functions, so everything stays in IO until it's ready to yield the result: solveTraj :: Factory -> Geometry -> Detector -> Sample -> Pipe Engine Geometry IO () solveTraj f g d s = do e <- await let name = engineName e solution <- withSample s $ \sample -> withDetector d $ \detector -> withGeometry f g $ \geometry -> withEngineList f $ \engines -> withCString name $ \cname -> do c_hkl_engine_list_init engines geometry detector sample engine <- c_hkl_engine_list_engine_get_by_name engines cname nullPtr n <- c_hkl_engine_pseudo_axis_names_get engine >>= darrayStringLen return $ solve' engine n e >>= getSolution0 yield solution This can be further simplified to use the version of `mapM` from Pipes.Prelude (https://hackage.haskell.org/package/pipes-4.1.8/docs/Pipes-Prelude.html) mapM :: Monad m => (a -> m b) -> Pipe a b m r This way your code would look more or less like it looked without pipes, something like: import qualified Pipes.Prelude as Pipes runEffect $ for (each engines) >-> Pipes.mapM (solve' engine n e >>= getSolution0) >-> P.print Best regards, Marcin Mrotek From frederic-emmanuel.picca at synchrotron-soleil.fr Sat Feb 20 10:12:26 2016 From: frederic-emmanuel.picca at synchrotron-soleil.fr (PICCA Frederic-Emmanuel) Date: Sat, 20 Feb 2016 10:12:26 +0000 Subject: [Haskell-beginners] ODP: howto Pipe In-Reply-To: References: <56c5e758.905b190a.86e57.6734@mx.google.com> , Message-ID: Hello first a big thanks your for all your comment :) I end-up with this solution data Diffractometer = Diffractometer { difEngineList :: (ForeignPtr HklEngineList) , difGeometry :: (ForeignPtr HklGeometry) , difDetector :: (ForeignPtr HklDetector) , difSample :: (ForeignPtr HklSample) } deriving (Show) newDiffractometer :: Factory -> Geometry -> Detector -> Sample -> IO Diffractometer newDiffractometer f g d s = do f_engines <- newEngineList f f_geometry <- newGeometry f g f_detector <- newDetector d f_sample <- newSample s withForeignPtr f_sample $ \sample -> withForeignPtr f_detector $ \detector -> withForeignPtr f_geometry $ \geometry -> withForeignPtr f_engines $ \engines -> do c_hkl_engine_list_init engines geometry detector sample return $ Diffractometer f_engines f_geometry f_detector f_sample solve' :: Ptr HklEngine -> CSize -> Engine -> IO (ForeignPtr HklGeometryList) solve' engine n (Engine _ ps _) = do let positions = [v | (Parameter _ v _) <- ps] withArray positions $ \values -> c_hkl_engine_pseudo_axis_values_set engine values n unit nullPtr >>= newForeignPtr c_hkl_geometry_list_free solveTrajPipe' :: Diffractometer -> Pipe Engine Geometry IO () solveTrajPipe' dif = forever $ do -- Inside here we are using `StateT Int (Consumer a IO) r` e <- await let name = engineName e solutions <- lift $ withForeignPtr (difEngineList dif) $ \engines -> withCString name $ \cname -> do engine <- c_hkl_engine_list_engine_get_by_name engines cname nullPtr n <- c_hkl_engine_pseudo_axis_names_get engine >>= darrayStringLen solutions <- solve' engine n e >>= getSolution0 return solutions yield solutions solveTrajPipe :: Factory -> Geometry -> Detector -> Sample -> Pipe Engine Geometry IO () solveTrajPipe f g d s = do dif <- lift $ newDiffractometer f g d s solveTrajPipe' dif so, I created a data type with contain all my foreignPtr. instanciate them at the begining. this newDiffractometer function also initialise the C library objects c_hkl_engine_list_init engines geometry detector sample then I just need to do a forever loop and use this type data to keep the C internal state. what's worring me is that I have a sort of internal state but this is not expressed anywhere in the type system... Cheers Frederic From frederic-emmanuel.picca at synchrotron-soleil.fr Sat Feb 20 10:57:38 2016 From: frederic-emmanuel.picca at synchrotron-soleil.fr (PICCA Frederic-Emmanuel) Date: Sat, 20 Feb 2016 10:57:38 +0000 Subject: [Haskell-beginners] ODP: howto Pipe In-Reply-To: References: <56c5e758.905b190a.86e57.6734@mx.google.com> , , Message-ID: except that if I use this runEffect $ each engines >-> solveTrajPipe factory geometry detector sample >-> P.drain instead of -- >-> P.print I get a segfault when I do a big number of coputation ??? It seems to me that the dif object is released as I am still using the underlying foreign ptr... From marcin.jan.mrotek at gmail.com Sat Feb 20 11:15:08 2016 From: marcin.jan.mrotek at gmail.com (Marcin Mrotek) Date: Sat, 20 Feb 2016 12:15:08 +0100 Subject: [Haskell-beginners] ODP: howto Pipe In-Reply-To: References: <56c5e758.905b190a.86e57.6734@mx.google.com> Message-ID: > then I just need to do a forever loop and use this type data to keep the C internal state. > > what's worring me is that I have a sort of internal state but this is not expressed anywhere in the type system... You can use (StateT IO) instead of plain IO in the pipe to pass that data around. There are functions for working with StateT (and other transformer) pipes in Pipes.Lift module: https://hackage.haskell.org/package/pipes-4.1.8/docs/Pipes-Lift.html#g:5 Other than that, having to worry about state kept in the C part of a Haskell program is often a pain in general, unfortunately. Perhaps you could take some hints from https://hackage.haskell.org/package/GPipe for example, but I have no idea if that's going to be of any help. > I get a segfault when I do a big number of coputation ??? The only change is from Pipes.print to Pipes.drain? This is weird, maybe you'd have better luck asking on Pipes mailing list: https://groups.google.com/forum/?fromgroups#!forum/haskell-pipes ( mailto:haskell-pipes at googlegroups.com ) Best regards, Marcin Mrotek From frederic-emmanuel.picca at synchrotron-soleil.fr Sat Feb 20 14:18:46 2016 From: frederic-emmanuel.picca at synchrotron-soleil.fr (PICCA Frederic-Emmanuel) Date: Sat, 20 Feb 2016 14:18:46 +0000 Subject: [Haskell-beginners] ODP: howto Pipe In-Reply-To: References: <56c5e758.905b190a.86e57.6734@mx.google.com> , Message-ID: In fact I got the segfault also with the P.print... So I rewrote the solve function like this withDiffractometer :: Diffractometer -> (Ptr HklEngineList -> IO b) -> IO b withDiffractometer d fun = do let f_engines = difEngineList d withForeignPtr f_engines fun solveTrajPipe' :: Diffractometer -> Pipe Engine Geometry IO () solveTrajPipe' dif = flip evalStateT dif $ forever $ do -- Inside here we are using `StateT Int (Consumer a IO) r` e <- lift await dif <- get let name = engineName e solutions <- lift . lift $ withDiffractometer dif $ \engines -> withCString name $ \cname -> do engine <- c_hkl_engine_list_engine_get_by_name engines cname nullPtr n <- c_hkl_engine_pseudo_axis_names_get engine >>= darrayStringLen solve' engine n e >>= getSolution0 put dif lift $ yield solutions using the evalStateT. It works with million of evaluations :) but now if I remove the get and put lines, I get the segfault. This segfault is located in the solve' method solve' :: Ptr HklEngine -> CSize -> Engine -> IO (ForeignPtr HklGeometryList) solve' engine n (Engine _ ps _) = do let positions = [v | (Parameter _ v _) <- ps] withArray positions $ \values -> c_hkl_engine_pseudo_axis_values_set engine values n unit nullPtr >>= newForeignPtr c_hkl_geometry_list_free so to my opinion I do not manage correctly the life time of my dif object, but I do not understand how I can ensure this life time in until the solve' method proceed. Cheers Frederic From marcin.jan.mrotek at gmail.com Sun Feb 21 09:25:31 2016 From: marcin.jan.mrotek at gmail.com (Marcin Mrotek) Date: Sun, 21 Feb 2016 10:25:31 +0100 Subject: [Haskell-beginners] ODP: howto Pipe In-Reply-To: References: <56c5e758.905b190a.86e57.6734@mx.google.com> Message-ID: First of all, (StateT Diffractometer (Pipe Engine Geometry IO) ()) isn't the same as (Pipe Engine Geometry (StateT Diffractometer IO) ()), although I'm not sure what exactly the difference will be, as I've never used it the former way. This might be again a question for the Pipes mailing list. Secondly: > but now if I remove the get and put lines, I get the segfault. Okay, I have no idea. As I see it, this shouldn't happen, as you're getting and putting the same pointer all the time. What if you remove the StateT altogether and just use the `dif` from the function argument, are you still getting segfaults? Also what about writting the function without using pipes, and using Pipes.mapM to make it a pipe like I mentioned? (if the only Pipes operation you're doing are an `await` in the beginning and a `yield` at the end, Pipes.mapM covers it) Best regards, Marcin Mrotek From nawi at nawi.is Sun Feb 21 17:03:16 2016 From: nawi at nawi.is (Christoph R. Murauer) Date: Sun, 21 Feb 2016 18:03:16 +0100 Subject: [Haskell-beginners] Building xmonad / X11 fails on Mac OS X 10.11.3 El Capitan. Message-ID: Hello ! I tried to build xmonad on Mac OS X 10.11.3 El Capitan and, it fails. For details see the below log. Installed is the latest Haskell Platform 7.10.3 and the latest CLI tools for Xcode. The platform itself works because I build Hakyll before without problems. Thanks for ideas. The username is replaced by USER. Configuring X11-1.6.1.2... Dependency base ==4.8.2.0: using base-4.8.2.0 Dependency data-default ==0.5.3: using data-default-0.5.3 Using Cabal-1.22.5.0 compiled by ghc-7.10 Using compiler: ghc-7.10.3 Using install prefix: /Users/USER/Library/Haskell Binaries installed in: /Users/USER/Library/Haskell/bin Libraries installed in: /Users/USER/Library/Haskell/ghc-7.10.3-x86_64/lib/X11-1.6.1.2 Private binaries installed in: /Users/USER/Library/Haskell/libexec Data files installed in: /Users/USER/Library/Haskell/share/ghc-7.10.3-x86_64/X11-1.6.1.2 Documentation installed in: /Users/USER/Library/Haskell/ghc-7.10.3-x86_64/lib/X11-1.6.1.2/doc Configuration files installed in: /Users/USER/Library/Haskell/etc Using alex version 3.1.4 found on system at: /usr/local/bin/alex Using ar found on system at: /usr/bin/ar No c2hs found No cpphs found Using gcc version 4.2.1 found on system at: /usr/bin/gcc Using ghc version 7.10.3 found on system at: /usr/local/bin/ghc Using ghc-pkg version 7.10.3 found on system at: /usr/local/bin/ghc-pkg No ghcjs found No ghcjs-pkg found No greencard found Using haddock version 2.16.1 found on system at: /usr/local/bin/haddock Using happy version 1.19.5 found on system at: /usr/local/bin/happy Using haskell-suite found on system at: haskell-suite-dummy-location Using haskell-suite-pkg found on system at: haskell-suite-pkg-dummy-location No hmake found Using hpc version 0.67 found on system at: /usr/local/bin/hpc Using hsc2hs version 0.67 found on system at: /usr/local/bin/hsc2hs Using hscolour version 1.22 found on system at: /usr/local/bin/HsColour No jhc found Using ld found on system at: /usr/bin/ld No lhc found No lhc-pkg found No pkg-config found Using strip found on system at: /usr/bin/strip Using tar found on system at: /usr/bin/tar No uhc found sh ./configure '--with-compiler=ghc' '--prefix=/Users/USER/Library/Haskell' '--bindir=/Users/USER/Library/Haskell/bin' '--libdir=/Users/USER/Library/Haskell/ghc-7.10.3-x86_64/lib' '--libexecdir=/Users/USER/Library/Haskell/libexec' '--datadir=/Users/USER/Library/Haskell/share' '--sysconfdir=/Users/USER/Library/Haskell/etc' '--with-gcc=/usr/bin/gcc' configure: WARNING: unrecognized options: --with-compiler, --with-gcc checking for gcc... gcc checking whether the C compiler works... yes checking for C compiler default output file name... a.out checking for suffix of executables... checking whether we are cross compiling... no checking for suffix of object files... o checking whether we are using the GNU C compiler... yes checking whether gcc accepts -g... yes checking for gcc option to accept ISO C89... none needed checking how to run the C preprocessor... gcc -E checking for X... libraries /usr/X11/lib, headers /usr/X11/include checking whether -R must be followed by a space... neither works checking for gethostbyname... yes checking for connect... yes checking for remove... yes checking for shmat... yes checking for IceConnectionNumber in -lICE... yes checking whether to build Xinerama... yes checking for grep that handles long lines and -e... /usr/bin/grep checking for egrep... /usr/bin/grep -E checking for ANSI C header files... yes checking for sys/types.h... yes checking for sys/stat.h... yes checking for stdlib.h... yes checking for string.h... yes checking for memory.h... yes checking for strings.h... yes checking for inttypes.h... yes checking for stdint.h... yes checking for unistd.h... yes checking X11/extensions/Xinerama.h usability... yes checking X11/extensions/Xinerama.h presence... yes checking for X11/extensions/Xinerama.h... yes checking X11/extensions/Xrandr.h usability... yes checking X11/extensions/Xrandr.h presence... yes checking for X11/extensions/Xrandr.h... yes checking whether to build XScreenSaver... yes checking X11/extensions/scrnsaver.h usability... yes checking X11/extensions/scrnsaver.h presence... yes checking for X11/extensions/scrnsaver.h... yes checking whether to include X.org keysyms... yes checking X11/keysym.h usability... yes checking X11/keysym.h presence... yes checking for X11/keysym.h... yes checking X11/DECkeysym.h usability... yes checking X11/DECkeysym.h presence... yes checking for X11/DECkeysym.h... yes checking X11/Sunkeysym.h usability... yes checking X11/Sunkeysym.h presence... yes checking for X11/Sunkeysym.h... yes checking X11/ap_keysym.h usability... yes checking X11/ap_keysym.h presence... yes checking for X11/ap_keysym.h... yes checking X11/HPkeysym.h usability... yes checking X11/HPkeysym.h presence... yes checking for X11/HPkeysym.h... yes checking X11/XF86keysym.h usability... yes checking X11/XF86keysym.h presence... yes checking for X11/XF86keysym.h... yes checking X11/keysymdef.h usability... yes checking X11/keysymdef.h presence... yes checking for X11/keysymdef.h... yes checking X11/cursorfont.h usability... yes checking X11/cursorfont.h presence... yes checking for X11/cursorfont.h... yes configure: creating ./config.status config.status: creating config.mk config.status: creating X11.buildinfo config.status: creating include/HsX11Config.h config.status: creating include/X11_extras_config.h configure: WARNING: unrecognized options: --with-compiler, --with-gcc Reading parameters from ./X11.buildinfo Reading parameters from ./X11.buildinfo Component build order: library creating dist/build creating dist/build/autogen Building X11-1.6.1.2... /usr/local/bin/ghc-pkg init dist/package.conf.inplace Preprocessing library X11-1.6.1.2... creating dist/build/Graphics/X11 creating dist/build/Graphics creating dist/build/Graphics/X11 /usr/local/bin/hsc2hs '--cc=/usr/bin/gcc' '--ld=/usr/bin/gcc' '--cflag=-D__GLASGOW_HASKELL__=710' '--cflag=-Ddarwin_BUILD_OS=1' '--cflag=-Dx86_64_BUILD_ARCH=1' '--cflag=-Ddarwin_HOST_OS=1' '--cflag=-Dx86_64_HOST_ARCH=1' '--cflag=-Iinclude' '--cflag=-I/usr/X11/include' '--cflag=-I/usr/X11/include' '--cflag=-I/usr/X11/include' '--cflag=-Idist/build/autogen' '--cflag=-include' '--cflag=dist/build/autogen/cabal_macros.h' '--lflag=-lXss' '--lflag=-lXinerama' '--lflag=-lXext' '--lflag=-lX11' '--lflag=-lXrandr' '--lflag=-lXext' '--lflag=-L/usr/X11/lib' '--cflag=-I/Library/Frameworks/GHC.framework/Versions/7.10.3-x86_64/usr/lib/ghc-7.10.3/base_HQfYBxpPvuw8OunzQu6JGM/include' '--cflag=-I/Library/Frameworks/GHC.framework/Versions/7.10.3-x86_64/usr/lib/ghc-7.10.3/integ_2aU3IZNMF9a7mQ0OzsZ0dS/include' '--cflag=-I/Library/Frameworks/GHC.framework/Versions/7.10.3-x86_64/usr/lib/ghc-7.10.3/include' '--lflag=-L/Users/USER/Library/Haskell/ghc-7.10.3-x86_64/lib/data-default-0.5.3' '--lflag=-L/Users/USER/Library/Haskell/ghc-7.10.3-x86_64/lib/data-default-instances-old-locale-0.0.1' '--lflag=-L/Library/Haskell/ghc-7.10.3-x86_64/lib/old-locale-1.0.0.7' '--lflag=-L/Users/USER/Library/Haskell/ghc-7.10.3-x86_64/lib/data-default-instances-dlist-0.0.1' '--lflag=-L/Users/USER/Library/Haskell/ghc-7.10.3-x86_64/lib/dlist-0.7.1.2' '--lflag=-L/Users/USER/Library/Haskell/ghc-7.10.3-x86_64/lib/data-default-instances-containers-0.0.1' '--lflag=-L/Users/USER/Library/Haskell/ghc-7.10.3-x86_64/lib/data-default-instances-base-0.0.1' '--lflag=-L/Users/USER/Library/Haskell/ghc-7.10.3-x86_64/lib/data-default-class-0.0.1' '--lflag=-L/Library/Frameworks/GHC.framework/Versions/7.10.3-x86_64/usr/lib/ghc-7.10.3/conta_2C3ZI8RgPO2LBMidXKTvIU' '--lflag=-L/Library/Frameworks/GHC.framework/Versions/7.10.3-x86_64/usr/lib/ghc-7.10.3/deeps_6vMKxt5sPFR0XsbRWvvq59' '--lflag=-L/Library/Frameworks/GHC.framework/Versions/7.10.3-x86_64/usr/lib/ghc-7.10.3/array_67iodizgJQIIxYVTp4emlA' '--lflag=-L/Library/Frameworks/GHC.framework/Versions/7.10.3-x86_64/usr/lib/ghc-7.10.3/base_HQfYBxpPvuw8OunzQu6JGM' '--lflag=-liconv' '--lflag=-L/Library/Frameworks/GHC.framework/Versions/7.10.3-x86_64/usr/lib/ghc-7.10.3/integ_2aU3IZNMF9a7mQ0OzsZ0dS' '--lflag=-L/Library/Frameworks/GHC.framework/Versions/7.10.3-x86_64/usr/lib/ghc-7.10.3/ghcpr_8TmvWUcS1U1IKHT0levwg3' '--lflag=-L/Library/Frameworks/GHC.framework/Versions/7.10.3-x86_64/usr/lib/ghc-7.10.3/rts' '--lflag=-lm' '--lflag=-ldl' -o dist/build/Graphics/X11/Types.hs Graphics/X11/Types.hsc creating dist/build/Graphics/X11/Xlib /usr/local/bin/hsc2hs '--cc=/usr/bin/gcc' '--ld=/usr/bin/gcc' '--cflag=-D__GLASGOW_HASKELL__=710' '--cflag=-Ddarwin_BUILD_OS=1' '--cflag=-Dx86_64_BUILD_ARCH=1' '--cflag=-Ddarwin_HOST_OS=1' '--cflag=-Dx86_64_HOST_ARCH=1' '--cflag=-Iinclude' '--cflag=-I/usr/X11/include' '--cflag=-I/usr/X11/include' '--cflag=-I/usr/X11/include' '--cflag=-Idist/build/autogen' '--cflag=-include' '--cflag=dist/build/autogen/cabal_macros.h' '--lflag=-lXss' '--lflag=-lXinerama' '--lflag=-lXext' '--lflag=-lX11' '--lflag=-lXrandr' '--lflag=-lXext' '--lflag=-L/usr/X11/lib' '--cflag=-I/Library/Frameworks/GHC.framework/Versions/7.10.3-x86_64/usr/lib/ghc-7.10.3/base_HQfYBxpPvuw8OunzQu6JGM/include' '--cflag=-I/Library/Frameworks/GHC.framework/Versions/7.10.3-x86_64/usr/lib/ghc-7.10.3/integ_2aU3IZNMF9a7mQ0OzsZ0dS/include' '--cflag=-I/Library/Frameworks/GHC.framework/Versions/7.10.3-x86_64/usr/lib/ghc-7.10.3/include' '--lflag=-L/Users/USER/Library/Haskell/ghc-7.10.3-x86_64/lib/data-default-0.5.3' '--lflag=-L/Users/USER/Library/Haskell/ghc-7.10.3-x86_64/lib/data-default-instances-old-locale-0.0.1' '--lflag=-L/Library/Haskell/ghc-7.10.3-x86_64/lib/old-locale-1.0.0.7' '--lflag=-L/Users/USER/Library/Haskell/ghc-7.10.3-x86_64/lib/data-default-instances-dlist-0.0.1' '--lflag=-L/Users/USER/Library/Haskell/ghc-7.10.3-x86_64/lib/dlist-0.7.1.2' '--lflag=-L/Users/USER/Library/Haskell/ghc-7.10.3-x86_64/lib/data-default-instances-containers-0.0.1' '--lflag=-L/Users/USER/Library/Haskell/ghc-7.10.3-x86_64/lib/data-default-instances-base-0.0.1' '--lflag=-L/Users/USER/Library/Haskell/ghc-7.10.3-x86_64/lib/data-default-class-0.0.1' '--lflag=-L/Library/Frameworks/GHC.framework/Versions/7.10.3-x86_64/usr/lib/ghc-7.10.3/conta_2C3ZI8RgPO2LBMidXKTvIU' '--lflag=-L/Library/Frameworks/GHC.framework/Versions/7.10.3-x86_64/usr/lib/ghc-7.10.3/deeps_6vMKxt5sPFR0XsbRWvvq59' '--lflag=-L/Library/Frameworks/GHC.framework/Versions/7.10.3-x86_64/usr/lib/ghc-7.10.3/array_67iodizgJQIIxYVTp4emlA' '--lflag=-L/Library/Frameworks/GHC.framework/Versions/7.10.3-x86_64/usr/lib/ghc-7.10.3/base_HQfYBxpPvuw8OunzQu6JGM' '--lflag=-liconv' '--lflag=-L/Library/Frameworks/GHC.framework/Versions/7.10.3-x86_64/usr/lib/ghc-7.10.3/integ_2aU3IZNMF9a7mQ0OzsZ0dS' '--lflag=-L/Library/Frameworks/GHC.framework/Versions/7.10.3-x86_64/usr/lib/ghc-7.10.3/ghcpr_8TmvWUcS1U1IKHT0levwg3' '--lflag=-L/Library/Frameworks/GHC.framework/Versions/7.10.3-x86_64/usr/lib/ghc-7.10.3/rts' '--lflag=-lm' '--lflag=-ldl' -o dist/build/Graphics/X11/Xlib/Atom.hs Graphics/X11/Xlib/Atom.hsc creating dist/build/Graphics/X11/Xlib /usr/local/bin/hsc2hs '--cc=/usr/bin/gcc' '--ld=/usr/bin/gcc' '--cflag=-D__GLASGOW_HASKELL__=710' '--cflag=-Ddarwin_BUILD_OS=1' '--cflag=-Dx86_64_BUILD_ARCH=1' '--cflag=-Ddarwin_HOST_OS=1' '--cflag=-Dx86_64_HOST_ARCH=1' '--cflag=-Iinclude' '--cflag=-I/usr/X11/include' '--cflag=-I/usr/X11/include' '--cflag=-I/usr/X11/include' '--cflag=-Idist/build/autogen' '--cflag=-include' '--cflag=dist/build/autogen/cabal_macros.h' '--lflag=-lXss' '--lflag=-lXinerama' '--lflag=-lXext' '--lflag=-lX11' '--lflag=-lXrandr' '--lflag=-lXext' '--lflag=-L/usr/X11/lib' '--cflag=-I/Library/Frameworks/GHC.framework/Versions/7.10.3-x86_64/usr/lib/ghc-7.10.3/base_HQfYBxpPvuw8OunzQu6JGM/include' '--cflag=-I/Library/Frameworks/GHC.framework/Versions/7.10.3-x86_64/usr/lib/ghc-7.10.3/integ_2aU3IZNMF9a7mQ0OzsZ0dS/include' '--cflag=-I/Library/Frameworks/GHC.framework/Versions/7.10.3-x86_64/usr/lib/ghc-7.10.3/include' '--lflag=-L/Users/USER/Library/Haskell/ghc-7.10.3-x86_64/lib/data-default-0.5.3' '--lflag=-L/Users/USER/Library/Haskell/ghc-7.10.3-x86_64/lib/data-default-instances-old-locale-0.0.1' '--lflag=-L/Library/Haskell/ghc-7.10.3-x86_64/lib/old-locale-1.0.0.7' '--lflag=-L/Users/USER/Library/Haskell/ghc-7.10.3-x86_64/lib/data-default-instances-dlist-0.0.1' '--lflag=-L/Users/USER/Library/Haskell/ghc-7.10.3-x86_64/lib/dlist-0.7.1.2' '--lflag=-L/Users/USER/Library/Haskell/ghc-7.10.3-x86_64/lib/data-default-instances-containers-0.0.1' '--lflag=-L/Users/USER/Library/Haskell/ghc-7.10.3-x86_64/lib/data-default-instances-base-0.0.1' '--lflag=-L/Users/USER/Library/Haskell/ghc-7.10.3-x86_64/lib/data-default-class-0.0.1' '--lflag=-L/Library/Frameworks/GHC.framework/Versions/7.10.3-x86_64/usr/lib/ghc-7.10.3/conta_2C3ZI8RgPO2LBMidXKTvIU' '--lflag=-L/Library/Frameworks/GHC.framework/Versions/7.10.3-x86_64/usr/lib/ghc-7.10.3/deeps_6vMKxt5sPFR0XsbRWvvq59' '--lflag=-L/Library/Frameworks/GHC.framework/Versions/7.10.3-x86_64/usr/lib/ghc-7.10.3/array_67iodizgJQIIxYVTp4emlA' '--lflag=-L/Library/Frameworks/GHC.framework/Versions/7.10.3-x86_64/usr/lib/ghc-7.10.3/base_HQfYBxpPvuw8OunzQu6JGM' '--lflag=-liconv' '--lflag=-L/Library/Frameworks/GHC.framework/Versions/7.10.3-x86_64/usr/lib/ghc-7.10.3/integ_2aU3IZNMF9a7mQ0OzsZ0dS' '--lflag=-L/Library/Frameworks/GHC.framework/Versions/7.10.3-x86_64/usr/lib/ghc-7.10.3/ghcpr_8TmvWUcS1U1IKHT0levwg3' '--lflag=-L/Library/Frameworks/GHC.framework/Versions/7.10.3-x86_64/usr/lib/ghc-7.10.3/rts' '--lflag=-lm' '--lflag=-ldl' -o dist/build/Graphics/X11/Xlib/Cursor.hs Graphics/X11/Xlib/Cursor.hsc creating dist/build/Graphics/X11/Xlib /usr/local/bin/hsc2hs '--cc=/usr/bin/gcc' '--ld=/usr/bin/gcc' '--cflag=-D__GLASGOW_HASKELL__=710' '--cflag=-Ddarwin_BUILD_OS=1' '--cflag=-Dx86_64_BUILD_ARCH=1' '--cflag=-Ddarwin_HOST_OS=1' '--cflag=-Dx86_64_HOST_ARCH=1' '--cflag=-Iinclude' '--cflag=-I/usr/X11/include' '--cflag=-I/usr/X11/include' '--cflag=-I/usr/X11/include' '--cflag=-Idist/build/autogen' '--cflag=-include' '--cflag=dist/build/autogen/cabal_macros.h' '--lflag=-lXss' '--lflag=-lXinerama' '--lflag=-lXext' '--lflag=-lX11' '--lflag=-lXrandr' '--lflag=-lXext' '--lflag=-L/usr/X11/lib' '--cflag=-I/Library/Frameworks/GHC.framework/Versions/7.10.3-x86_64/usr/lib/ghc-7.10.3/base_HQfYBxpPvuw8OunzQu6JGM/include' '--cflag=-I/Library/Frameworks/GHC.framework/Versions/7.10.3-x86_64/usr/lib/ghc-7.10.3/integ_2aU3IZNMF9a7mQ0OzsZ0dS/include' '--cflag=-I/Library/Frameworks/GHC.framework/Versions/7.10.3-x86_64/usr/lib/ghc-7.10.3/include' '--lflag=-L/Users/USER/Library/Haskell/ghc-7.10.3-x86_64/lib/data-default-0.5.3' '--lflag=-L/Users/USER/Library/Haskell/ghc-7.10.3-x86_64/lib/data-default-instances-old-locale-0.0.1' '--lflag=-L/Library/Haskell/ghc-7.10.3-x86_64/lib/old-locale-1.0.0.7' '--lflag=-L/Users/USER/Library/Haskell/ghc-7.10.3-x86_64/lib/data-default-instances-dlist-0.0.1' '--lflag=-L/Users/USER/Library/Haskell/ghc-7.10.3-x86_64/lib/dlist-0.7.1.2' '--lflag=-L/Users/USER/Library/Haskell/ghc-7.10.3-x86_64/lib/data-default-instances-containers-0.0.1' '--lflag=-L/Users/USER/Library/Haskell/ghc-7.10.3-x86_64/lib/data-default-instances-base-0.0.1' '--lflag=-L/Users/USER/Library/Haskell/ghc-7.10.3-x86_64/lib/data-default-class-0.0.1' '--lflag=-L/Library/Frameworks/GHC.framework/Versions/7.10.3-x86_64/usr/lib/ghc-7.10.3/conta_2C3ZI8RgPO2LBMidXKTvIU' '--lflag=-L/Library/Frameworks/GHC.framework/Versions/7.10.3-x86_64/usr/lib/ghc-7.10.3/deeps_6vMKxt5sPFR0XsbRWvvq59' '--lflag=-L/Library/Frameworks/GHC.framework/Versions/7.10.3-x86_64/usr/lib/ghc-7.10.3/array_67iodizgJQIIxYVTp4emlA' '--lflag=-L/Library/Frameworks/GHC.framework/Versions/7.10.3-x86_64/usr/lib/ghc-7.10.3/base_HQfYBxpPvuw8OunzQu6JGM' '--lflag=-liconv' '--lflag=-L/Library/Frameworks/GHC.framework/Versions/7.10.3-x86_64/usr/lib/ghc-7.10.3/integ_2aU3IZNMF9a7mQ0OzsZ0dS' '--lflag=-L/Library/Frameworks/GHC.framework/Versions/7.10.3-x86_64/usr/lib/ghc-7.10.3/ghcpr_8TmvWUcS1U1IKHT0levwg3' '--lflag=-L/Library/Frameworks/GHC.framework/Versions/7.10.3-x86_64/usr/lib/ghc-7.10.3/rts' '--lflag=-lm' '--lflag=-ldl' -o dist/build/Graphics/X11/Xlib/Event.hs Graphics/X11/Xlib/Event.hsc creating dist/build/Graphics/X11/Xlib /usr/local/bin/hsc2hs '--cc=/usr/bin/gcc' '--ld=/usr/bin/gcc' '--cflag=-D__GLASGOW_HASKELL__=710' '--cflag=-Ddarwin_BUILD_OS=1' '--cflag=-Dx86_64_BUILD_ARCH=1' '--cflag=-Ddarwin_HOST_OS=1' '--cflag=-Dx86_64_HOST_ARCH=1' '--cflag=-Iinclude' '--cflag=-I/usr/X11/include' '--cflag=-I/usr/X11/include' '--cflag=-I/usr/X11/include' '--cflag=-Idist/build/autogen' '--cflag=-include' '--cflag=dist/build/autogen/cabal_macros.h' '--lflag=-lXss' '--lflag=-lXinerama' '--lflag=-lXext' '--lflag=-lX11' '--lflag=-lXrandr' '--lflag=-lXext' '--lflag=-L/usr/X11/lib' '--cflag=-I/Library/Frameworks/GHC.framework/Versions/7.10.3-x86_64/usr/lib/ghc-7.10.3/base_HQfYBxpPvuw8OunzQu6JGM/include' '--cflag=-I/Library/Frameworks/GHC.framework/Versions/7.10.3-x86_64/usr/lib/ghc-7.10.3/integ_2aU3IZNMF9a7mQ0OzsZ0dS/include' '--cflag=-I/Library/Frameworks/GHC.framework/Versions/7.10.3-x86_64/usr/lib/ghc-7.10.3/include' '--lflag=-L/Users/USER/Library/Haskell/ghc-7.10.3-x86_64/lib/data-default-0.5.3' '--lflag=-L/Users/USER/Library/Haskell/ghc-7.10.3-x86_64/lib/data-default-instances-old-locale-0.0.1' '--lflag=-L/Library/Haskell/ghc-7.10.3-x86_64/lib/old-locale-1.0.0.7' '--lflag=-L/Users/USER/Library/Haskell/ghc-7.10.3-x86_64/lib/data-default-instances-dlist-0.0.1' '--lflag=-L/Users/USER/Library/Haskell/ghc-7.10.3-x86_64/lib/dlist-0.7.1.2' '--lflag=-L/Users/USER/Library/Haskell/ghc-7.10.3-x86_64/lib/data-default-instances-containers-0.0.1' '--lflag=-L/Users/USER/Library/Haskell/ghc-7.10.3-x86_64/lib/data-default-instances-base-0.0.1' '--lflag=-L/Users/USER/Library/Haskell/ghc-7.10.3-x86_64/lib/data-default-class-0.0.1' '--lflag=-L/Library/Frameworks/GHC.framework/Versions/7.10.3-x86_64/usr/lib/ghc-7.10.3/conta_2C3ZI8RgPO2LBMidXKTvIU' '--lflag=-L/Library/Frameworks/GHC.framework/Versions/7.10.3-x86_64/usr/lib/ghc-7.10.3/deeps_6vMKxt5sPFR0XsbRWvvq59' '--lflag=-L/Library/Frameworks/GHC.framework/Versions/7.10.3-x86_64/usr/lib/ghc-7.10.3/array_67iodizgJQIIxYVTp4emlA' '--lflag=-L/Library/Frameworks/GHC.framework/Versions/7.10.3-x86_64/usr/lib/ghc-7.10.3/base_HQfYBxpPvuw8OunzQu6JGM' '--lflag=-liconv' '--lflag=-L/Library/Frameworks/GHC.framework/Versions/7.10.3-x86_64/usr/lib/ghc-7.10.3/integ_2aU3IZNMF9a7mQ0OzsZ0dS' '--lflag=-L/Library/Frameworks/GHC.framework/Versions/7.10.3-x86_64/usr/lib/ghc-7.10.3/ghcpr_8TmvWUcS1U1IKHT0levwg3' '--lflag=-L/Library/Frameworks/GHC.framework/Versions/7.10.3-x86_64/usr/lib/ghc-7.10.3/rts' '--lflag=-lm' '--lflag=-ldl' -o dist/build/Graphics/X11/Xlib/Font.hs Graphics/X11/Xlib/Font.hsc creating dist/build/Graphics/X11/Xlib /usr/local/bin/hsc2hs '--cc=/usr/bin/gcc' '--ld=/usr/bin/gcc' '--cflag=-D__GLASGOW_HASKELL__=710' '--cflag=-Ddarwin_BUILD_OS=1' '--cflag=-Dx86_64_BUILD_ARCH=1' '--cflag=-Ddarwin_HOST_OS=1' '--cflag=-Dx86_64_HOST_ARCH=1' '--cflag=-Iinclude' '--cflag=-I/usr/X11/include' '--cflag=-I/usr/X11/include' '--cflag=-I/usr/X11/include' '--cflag=-Idist/build/autogen' '--cflag=-include' '--cflag=dist/build/autogen/cabal_macros.h' '--lflag=-lXss' '--lflag=-lXinerama' '--lflag=-lXext' '--lflag=-lX11' '--lflag=-lXrandr' '--lflag=-lXext' '--lflag=-L/usr/X11/lib' '--cflag=-I/Library/Frameworks/GHC.framework/Versions/7.10.3-x86_64/usr/lib/ghc-7.10.3/base_HQfYBxpPvuw8OunzQu6JGM/include' '--cflag=-I/Library/Frameworks/GHC.framework/Versions/7.10.3-x86_64/usr/lib/ghc-7.10.3/integ_2aU3IZNMF9a7mQ0OzsZ0dS/include' '--cflag=-I/Library/Frameworks/GHC.framework/Versions/7.10.3-x86_64/usr/lib/ghc-7.10.3/include' '--lflag=-L/Users/USER/Library/Haskell/ghc-7.10.3-x86_64/lib/data-default-0.5.3' '--lflag=-L/Users/USER/Library/Haskell/ghc-7.10.3-x86_64/lib/data-default-instances-old-locale-0.0.1' '--lflag=-L/Library/Haskell/ghc-7.10.3-x86_64/lib/old-locale-1.0.0.7' '--lflag=-L/Users/USER/Library/Haskell/ghc-7.10.3-x86_64/lib/data-default-instances-dlist-0.0.1' '--lflag=-L/Users/USER/Library/Haskell/ghc-7.10.3-x86_64/lib/dlist-0.7.1.2' '--lflag=-L/Users/USER/Library/Haskell/ghc-7.10.3-x86_64/lib/data-default-instances-containers-0.0.1' '--lflag=-L/Users/USER/Library/Haskell/ghc-7.10.3-x86_64/lib/data-default-instances-base-0.0.1' '--lflag=-L/Users/USER/Library/Haskell/ghc-7.10.3-x86_64/lib/data-default-class-0.0.1' '--lflag=-L/Library/Frameworks/GHC.framework/Versions/7.10.3-x86_64/usr/lib/ghc-7.10.3/conta_2C3ZI8RgPO2LBMidXKTvIU' '--lflag=-L/Library/Frameworks/GHC.framework/Versions/7.10.3-x86_64/usr/lib/ghc-7.10.3/deeps_6vMKxt5sPFR0XsbRWvvq59' '--lflag=-L/Library/Frameworks/GHC.framework/Versions/7.10.3-x86_64/usr/lib/ghc-7.10.3/array_67iodizgJQIIxYVTp4emlA' '--lflag=-L/Library/Frameworks/GHC.framework/Versions/7.10.3-x86_64/usr/lib/ghc-7.10.3/base_HQfYBxpPvuw8OunzQu6JGM' '--lflag=-liconv' '--lflag=-L/Library/Frameworks/GHC.framework/Versions/7.10.3-x86_64/usr/lib/ghc-7.10.3/integ_2aU3IZNMF9a7mQ0OzsZ0dS' '--lflag=-L/Library/Frameworks/GHC.framework/Versions/7.10.3-x86_64/usr/lib/ghc-7.10.3/ghcpr_8TmvWUcS1U1IKHT0levwg3' '--lflag=-L/Library/Frameworks/GHC.framework/Versions/7.10.3-x86_64/usr/lib/ghc-7.10.3/rts' '--lflag=-lm' '--lflag=-ldl' -o dist/build/Graphics/X11/Xlib/Misc.hs Graphics/X11/Xlib/Misc.hsc creating dist/build/Graphics/X11/Xlib /usr/local/bin/hsc2hs '--cc=/usr/bin/gcc' '--ld=/usr/bin/gcc' '--cflag=-D__GLASGOW_HASKELL__=710' '--cflag=-Ddarwin_BUILD_OS=1' '--cflag=-Dx86_64_BUILD_ARCH=1' '--cflag=-Ddarwin_HOST_OS=1' '--cflag=-Dx86_64_HOST_ARCH=1' '--cflag=-Iinclude' '--cflag=-I/usr/X11/include' '--cflag=-I/usr/X11/include' '--cflag=-I/usr/X11/include' '--cflag=-Idist/build/autogen' '--cflag=-include' '--cflag=dist/build/autogen/cabal_macros.h' '--lflag=-lXss' '--lflag=-lXinerama' '--lflag=-lXext' '--lflag=-lX11' '--lflag=-lXrandr' '--lflag=-lXext' '--lflag=-L/usr/X11/lib' '--cflag=-I/Library/Frameworks/GHC.framework/Versions/7.10.3-x86_64/usr/lib/ghc-7.10.3/base_HQfYBxpPvuw8OunzQu6JGM/include' '--cflag=-I/Library/Frameworks/GHC.framework/Versions/7.10.3-x86_64/usr/lib/ghc-7.10.3/integ_2aU3IZNMF9a7mQ0OzsZ0dS/include' '--cflag=-I/Library/Frameworks/GHC.framework/Versions/7.10.3-x86_64/usr/lib/ghc-7.10.3/include' '--lflag=-L/Users/USER/Library/Haskell/ghc-7.10.3-x86_64/lib/data-default-0.5.3' '--lflag=-L/Users/USER/Library/Haskell/ghc-7.10.3-x86_64/lib/data-default-instances-old-locale-0.0.1' '--lflag=-L/Library/Haskell/ghc-7.10.3-x86_64/lib/old-locale-1.0.0.7' '--lflag=-L/Users/USER/Library/Haskell/ghc-7.10.3-x86_64/lib/data-default-instances-dlist-0.0.1' '--lflag=-L/Users/USER/Library/Haskell/ghc-7.10.3-x86_64/lib/dlist-0.7.1.2' '--lflag=-L/Users/USER/Library/Haskell/ghc-7.10.3-x86_64/lib/data-default-instances-containers-0.0.1' '--lflag=-L/Users/USER/Library/Haskell/ghc-7.10.3-x86_64/lib/data-default-instances-base-0.0.1' '--lflag=-L/Users/USER/Library/Haskell/ghc-7.10.3-x86_64/lib/data-default-class-0.0.1' '--lflag=-L/Library/Frameworks/GHC.framework/Versions/7.10.3-x86_64/usr/lib/ghc-7.10.3/conta_2C3ZI8RgPO2LBMidXKTvIU' '--lflag=-L/Library/Frameworks/GHC.framework/Versions/7.10.3-x86_64/usr/lib/ghc-7.10.3/deeps_6vMKxt5sPFR0XsbRWvvq59' '--lflag=-L/Library/Frameworks/GHC.framework/Versions/7.10.3-x86_64/usr/lib/ghc-7.10.3/array_67iodizgJQIIxYVTp4emlA' '--lflag=-L/Library/Frameworks/GHC.framework/Versions/7.10.3-x86_64/usr/lib/ghc-7.10.3/base_HQfYBxpPvuw8OunzQu6JGM' '--lflag=-liconv' '--lflag=-L/Library/Frameworks/GHC.framework/Versions/7.10.3-x86_64/usr/lib/ghc-7.10.3/integ_2aU3IZNMF9a7mQ0OzsZ0dS' '--lflag=-L/Library/Frameworks/GHC.framework/Versions/7.10.3-x86_64/usr/lib/ghc-7.10.3/ghcpr_8TmvWUcS1U1IKHT0levwg3' '--lflag=-L/Library/Frameworks/GHC.framework/Versions/7.10.3-x86_64/usr/lib/ghc-7.10.3/rts' '--lflag=-lm' '--lflag=-ldl' -o dist/build/Graphics/X11/Xlib/Types.hs Graphics/X11/Xlib/Types.hsc creating dist/build/Graphics/X11/Xlib /usr/local/bin/hsc2hs '--cc=/usr/bin/gcc' '--ld=/usr/bin/gcc' '--cflag=-D__GLASGOW_HASKELL__=710' '--cflag=-Ddarwin_BUILD_OS=1' '--cflag=-Dx86_64_BUILD_ARCH=1' '--cflag=-Ddarwin_HOST_OS=1' '--cflag=-Dx86_64_HOST_ARCH=1' '--cflag=-Iinclude' '--cflag=-I/usr/X11/include' '--cflag=-I/usr/X11/include' '--cflag=-I/usr/X11/include' '--cflag=-Idist/build/autogen' '--cflag=-include' '--cflag=dist/build/autogen/cabal_macros.h' '--lflag=-lXss' '--lflag=-lXinerama' '--lflag=-lXext' '--lflag=-lX11' '--lflag=-lXrandr' '--lflag=-lXext' '--lflag=-L/usr/X11/lib' '--cflag=-I/Library/Frameworks/GHC.framework/Versions/7.10.3-x86_64/usr/lib/ghc-7.10.3/base_HQfYBxpPvuw8OunzQu6JGM/include' '--cflag=-I/Library/Frameworks/GHC.framework/Versions/7.10.3-x86_64/usr/lib/ghc-7.10.3/integ_2aU3IZNMF9a7mQ0OzsZ0dS/include' '--cflag=-I/Library/Frameworks/GHC.framework/Versions/7.10.3-x86_64/usr/lib/ghc-7.10.3/include' '--lflag=-L/Users/USER/Library/Haskell/ghc-7.10.3-x86_64/lib/data-default-0.5.3' '--lflag=-L/Users/USER/Library/Haskell/ghc-7.10.3-x86_64/lib/data-default-instances-old-locale-0.0.1' '--lflag=-L/Library/Haskell/ghc-7.10.3-x86_64/lib/old-locale-1.0.0.7' '--lflag=-L/Users/USER/Library/Haskell/ghc-7.10.3-x86_64/lib/data-default-instances-dlist-0.0.1' '--lflag=-L/Users/USER/Library/Haskell/ghc-7.10.3-x86_64/lib/dlist-0.7.1.2' '--lflag=-L/Users/USER/Library/Haskell/ghc-7.10.3-x86_64/lib/data-default-instances-containers-0.0.1' '--lflag=-L/Users/USER/Library/Haskell/ghc-7.10.3-x86_64/lib/data-default-instances-base-0.0.1' '--lflag=-L/Users/USER/Library/Haskell/ghc-7.10.3-x86_64/lib/data-default-class-0.0.1' '--lflag=-L/Library/Frameworks/GHC.framework/Versions/7.10.3-x86_64/usr/lib/ghc-7.10.3/conta_2C3ZI8RgPO2LBMidXKTvIU' '--lflag=-L/Library/Frameworks/GHC.framework/Versions/7.10.3-x86_64/usr/lib/ghc-7.10.3/deeps_6vMKxt5sPFR0XsbRWvvq59' '--lflag=-L/Library/Frameworks/GHC.framework/Versions/7.10.3-x86_64/usr/lib/ghc-7.10.3/array_67iodizgJQIIxYVTp4emlA' '--lflag=-L/Library/Frameworks/GHC.framework/Versions/7.10.3-x86_64/usr/lib/ghc-7.10.3/base_HQfYBxpPvuw8OunzQu6JGM' '--lflag=-liconv' '--lflag=-L/Library/Frameworks/GHC.framework/Versions/7.10.3-x86_64/usr/lib/ghc-7.10.3/integ_2aU3IZNMF9a7mQ0OzsZ0dS' '--lflag=-L/Library/Frameworks/GHC.framework/Versions/7.10.3-x86_64/usr/lib/ghc-7.10.3/ghcpr_8TmvWUcS1U1IKHT0levwg3' '--lflag=-L/Library/Frameworks/GHC.framework/Versions/7.10.3-x86_64/usr/lib/ghc-7.10.3/rts' '--lflag=-lm' '--lflag=-ldl' -o dist/build/Graphics/X11/Xlib/Extras.hs Graphics/X11/Xlib/Extras.hsc creating dist/build/Graphics/X11 /usr/local/bin/hsc2hs '--cc=/usr/bin/gcc' '--ld=/usr/bin/gcc' '--cflag=-D__GLASGOW_HASKELL__=710' '--cflag=-Ddarwin_BUILD_OS=1' '--cflag=-Dx86_64_BUILD_ARCH=1' '--cflag=-Ddarwin_HOST_OS=1' '--cflag=-Dx86_64_HOST_ARCH=1' '--cflag=-Iinclude' '--cflag=-I/usr/X11/include' '--cflag=-I/usr/X11/include' '--cflag=-I/usr/X11/include' '--cflag=-Idist/build/autogen' '--cflag=-include' '--cflag=dist/build/autogen/cabal_macros.h' '--lflag=-lXss' '--lflag=-lXinerama' '--lflag=-lXext' '--lflag=-lX11' '--lflag=-lXrandr' '--lflag=-lXext' '--lflag=-L/usr/X11/lib' '--cflag=-I/Library/Frameworks/GHC.framework/Versions/7.10.3-x86_64/usr/lib/ghc-7.10.3/base_HQfYBxpPvuw8OunzQu6JGM/include' '--cflag=-I/Library/Frameworks/GHC.framework/Versions/7.10.3-x86_64/usr/lib/ghc-7.10.3/integ_2aU3IZNMF9a7mQ0OzsZ0dS/include' '--cflag=-I/Library/Frameworks/GHC.framework/Versions/7.10.3-x86_64/usr/lib/ghc-7.10.3/include' '--lflag=-L/Users/USER/Library/Haskell/ghc-7.10.3-x86_64/lib/data-default-0.5.3' '--lflag=-L/Users/USER/Library/Haskell/ghc-7.10.3-x86_64/lib/data-default-instances-old-locale-0.0.1' '--lflag=-L/Library/Haskell/ghc-7.10.3-x86_64/lib/old-locale-1.0.0.7' '--lflag=-L/Users/USER/Library/Haskell/ghc-7.10.3-x86_64/lib/data-default-instances-dlist-0.0.1' '--lflag=-L/Users/USER/Library/Haskell/ghc-7.10.3-x86_64/lib/dlist-0.7.1.2' '--lflag=-L/Users/USER/Library/Haskell/ghc-7.10.3-x86_64/lib/data-default-instances-containers-0.0.1' '--lflag=-L/Users/USER/Library/Haskell/ghc-7.10.3-x86_64/lib/data-default-instances-base-0.0.1' '--lflag=-L/Users/USER/Library/Haskell/ghc-7.10.3-x86_64/lib/data-default-class-0.0.1' '--lflag=-L/Library/Frameworks/GHC.framework/Versions/7.10.3-x86_64/usr/lib/ghc-7.10.3/conta_2C3ZI8RgPO2LBMidXKTvIU' '--lflag=-L/Library/Frameworks/GHC.framework/Versions/7.10.3-x86_64/usr/lib/ghc-7.10.3/deeps_6vMKxt5sPFR0XsbRWvvq59' '--lflag=-L/Library/Frameworks/GHC.framework/Versions/7.10.3-x86_64/usr/lib/ghc-7.10.3/array_67iodizgJQIIxYVTp4emlA' '--lflag=-L/Library/Frameworks/GHC.framework/Versions/7.10.3-x86_64/usr/lib/ghc-7.10.3/base_HQfYBxpPvuw8OunzQu6JGM' '--lflag=-liconv' '--lflag=-L/Library/Frameworks/GHC.framework/Versions/7.10.3-x86_64/usr/lib/ghc-7.10.3/integ_2aU3IZNMF9a7mQ0OzsZ0dS' '--lflag=-L/Library/Frameworks/GHC.framework/Versions/7.10.3-x86_64/usr/lib/ghc-7.10.3/ghcpr_8TmvWUcS1U1IKHT0levwg3' '--lflag=-L/Library/Frameworks/GHC.framework/Versions/7.10.3-x86_64/usr/lib/ghc-7.10.3/rts' '--lflag=-lm' '--lflag=-ldl' -o dist/build/Graphics/X11/Xinerama.hs Graphics/X11/Xinerama.hsc creating dist/build/Graphics/X11 /usr/local/bin/hsc2hs '--cc=/usr/bin/gcc' '--ld=/usr/bin/gcc' '--cflag=-D__GLASGOW_HASKELL__=710' '--cflag=-Ddarwin_BUILD_OS=1' '--cflag=-Dx86_64_BUILD_ARCH=1' '--cflag=-Ddarwin_HOST_OS=1' '--cflag=-Dx86_64_HOST_ARCH=1' '--cflag=-Iinclude' '--cflag=-I/usr/X11/include' '--cflag=-I/usr/X11/include' '--cflag=-I/usr/X11/include' '--cflag=-Idist/build/autogen' '--cflag=-include' '--cflag=dist/build/autogen/cabal_macros.h' '--lflag=-lXss' '--lflag=-lXinerama' '--lflag=-lXext' '--lflag=-lX11' '--lflag=-lXrandr' '--lflag=-lXext' '--lflag=-L/usr/X11/lib' '--cflag=-I/Library/Frameworks/GHC.framework/Versions/7.10.3-x86_64/usr/lib/ghc-7.10.3/base_HQfYBxpPvuw8OunzQu6JGM/include' '--cflag=-I/Library/Frameworks/GHC.framework/Versions/7.10.3-x86_64/usr/lib/ghc-7.10.3/integ_2aU3IZNMF9a7mQ0OzsZ0dS/include' '--cflag=-I/Library/Frameworks/GHC.framework/Versions/7.10.3-x86_64/usr/lib/ghc-7.10.3/include' '--lflag=-L/Users/USER/Library/Haskell/ghc-7.10.3-x86_64/lib/data-default-0.5.3' '--lflag=-L/Users/USER/Library/Haskell/ghc-7.10.3-x86_64/lib/data-default-instances-old-locale-0.0.1' '--lflag=-L/Library/Haskell/ghc-7.10.3-x86_64/lib/old-locale-1.0.0.7' '--lflag=-L/Users/USER/Library/Haskell/ghc-7.10.3-x86_64/lib/data-default-instances-dlist-0.0.1' '--lflag=-L/Users/USER/Library/Haskell/ghc-7.10.3-x86_64/lib/dlist-0.7.1.2' '--lflag=-L/Users/USER/Library/Haskell/ghc-7.10.3-x86_64/lib/data-default-instances-containers-0.0.1' '--lflag=-L/Users/USER/Library/Haskell/ghc-7.10.3-x86_64/lib/data-default-instances-base-0.0.1' '--lflag=-L/Users/USER/Library/Haskell/ghc-7.10.3-x86_64/lib/data-default-class-0.0.1' '--lflag=-L/Library/Frameworks/GHC.framework/Versions/7.10.3-x86_64/usr/lib/ghc-7.10.3/conta_2C3ZI8RgPO2LBMidXKTvIU' '--lflag=-L/Library/Frameworks/GHC.framework/Versions/7.10.3-x86_64/usr/lib/ghc-7.10.3/deeps_6vMKxt5sPFR0XsbRWvvq59' '--lflag=-L/Library/Frameworks/GHC.framework/Versions/7.10.3-x86_64/usr/lib/ghc-7.10.3/array_67iodizgJQIIxYVTp4emlA' '--lflag=-L/Library/Frameworks/GHC.framework/Versions/7.10.3-x86_64/usr/lib/ghc-7.10.3/base_HQfYBxpPvuw8OunzQu6JGM' '--lflag=-liconv' '--lflag=-L/Library/Frameworks/GHC.framework/Versions/7.10.3-x86_64/usr/lib/ghc-7.10.3/integ_2aU3IZNMF9a7mQ0OzsZ0dS' '--lflag=-L/Library/Frameworks/GHC.framework/Versions/7.10.3-x86_64/usr/lib/ghc-7.10.3/ghcpr_8TmvWUcS1U1IKHT0levwg3' '--lflag=-L/Library/Frameworks/GHC.framework/Versions/7.10.3-x86_64/usr/lib/ghc-7.10.3/rts' '--lflag=-lm' '--lflag=-ldl' -o dist/build/Graphics/X11/Xrandr.hs Graphics/X11/Xrandr.hsc creating dist/build/Graphics/X11 /usr/local/bin/hsc2hs '--cc=/usr/bin/gcc' '--ld=/usr/bin/gcc' '--cflag=-D__GLASGOW_HASKELL__=710' '--cflag=-Ddarwin_BUILD_OS=1' '--cflag=-Dx86_64_BUILD_ARCH=1' '--cflag=-Ddarwin_HOST_OS=1' '--cflag=-Dx86_64_HOST_ARCH=1' '--cflag=-Iinclude' '--cflag=-I/usr/X11/include' '--cflag=-I/usr/X11/include' '--cflag=-I/usr/X11/include' '--cflag=-Idist/build/autogen' '--cflag=-include' '--cflag=dist/build/autogen/cabal_macros.h' '--lflag=-lXss' '--lflag=-lXinerama' '--lflag=-lXext' '--lflag=-lX11' '--lflag=-lXrandr' '--lflag=-lXext' '--lflag=-L/usr/X11/lib' '--cflag=-I/Library/Frameworks/GHC.framework/Versions/7.10.3-x86_64/usr/lib/ghc-7.10.3/base_HQfYBxpPvuw8OunzQu6JGM/include' '--cflag=-I/Library/Frameworks/GHC.framework/Versions/7.10.3-x86_64/usr/lib/ghc-7.10.3/integ_2aU3IZNMF9a7mQ0OzsZ0dS/include' '--cflag=-I/Library/Frameworks/GHC.framework/Versions/7.10.3-x86_64/usr/lib/ghc-7.10.3/include' '--lflag=-L/Users/USER/Library/Haskell/ghc-7.10.3-x86_64/lib/data-default-0.5.3' '--lflag=-L/Users/USER/Library/Haskell/ghc-7.10.3-x86_64/lib/data-default-instances-old-locale-0.0.1' '--lflag=-L/Library/Haskell/ghc-7.10.3-x86_64/lib/old-locale-1.0.0.7' '--lflag=-L/Users/USER/Library/Haskell/ghc-7.10.3-x86_64/lib/data-default-instances-dlist-0.0.1' '--lflag=-L/Users/USER/Library/Haskell/ghc-7.10.3-x86_64/lib/dlist-0.7.1.2' '--lflag=-L/Users/USER/Library/Haskell/ghc-7.10.3-x86_64/lib/data-default-instances-containers-0.0.1' '--lflag=-L/Users/USER/Library/Haskell/ghc-7.10.3-x86_64/lib/data-default-instances-base-0.0.1' '--lflag=-L/Users/USER/Library/Haskell/ghc-7.10.3-x86_64/lib/data-default-class-0.0.1' '--lflag=-L/Library/Frameworks/GHC.framework/Versions/7.10.3-x86_64/usr/lib/ghc-7.10.3/conta_2C3ZI8RgPO2LBMidXKTvIU' '--lflag=-L/Library/Frameworks/GHC.framework/Versions/7.10.3-x86_64/usr/lib/ghc-7.10.3/deeps_6vMKxt5sPFR0XsbRWvvq59' '--lflag=-L/Library/Frameworks/GHC.framework/Versions/7.10.3-x86_64/usr/lib/ghc-7.10.3/array_67iodizgJQIIxYVTp4emlA' '--lflag=-L/Library/Frameworks/GHC.framework/Versions/7.10.3-x86_64/usr/lib/ghc-7.10.3/base_HQfYBxpPvuw8OunzQu6JGM' '--lflag=-liconv' '--lflag=-L/Library/Frameworks/GHC.framework/Versions/7.10.3-x86_64/usr/lib/ghc-7.10.3/integ_2aU3IZNMF9a7mQ0OzsZ0dS' '--lflag=-L/Library/Frameworks/GHC.framework/Versions/7.10.3-x86_64/usr/lib/ghc-7.10.3/ghcpr_8TmvWUcS1U1IKHT0levwg3' '--lflag=-L/Library/Frameworks/GHC.framework/Versions/7.10.3-x86_64/usr/lib/ghc-7.10.3/rts' '--lflag=-lm' '--lflag=-ldl' -o dist/build/Graphics/X11/XScreenSaver.hs Graphics/X11/XScreenSaver.hsc creating dist/build/Graphics/X11/ExtraTypes /usr/local/bin/hsc2hs '--cc=/usr/bin/gcc' '--ld=/usr/bin/gcc' '--cflag=-D__GLASGOW_HASKELL__=710' '--cflag=-Ddarwin_BUILD_OS=1' '--cflag=-Dx86_64_BUILD_ARCH=1' '--cflag=-Ddarwin_HOST_OS=1' '--cflag=-Dx86_64_HOST_ARCH=1' '--cflag=-Iinclude' '--cflag=-I/usr/X11/include' '--cflag=-I/usr/X11/include' '--cflag=-I/usr/X11/include' '--cflag=-Idist/build/autogen' '--cflag=-include' '--cflag=dist/build/autogen/cabal_macros.h' '--lflag=-lXss' '--lflag=-lXinerama' '--lflag=-lXext' '--lflag=-lX11' '--lflag=-lXrandr' '--lflag=-lXext' '--lflag=-L/usr/X11/lib' '--cflag=-I/Library/Frameworks/GHC.framework/Versions/7.10.3-x86_64/usr/lib/ghc-7.10.3/base_HQfYBxpPvuw8OunzQu6JGM/include' '--cflag=-I/Library/Frameworks/GHC.framework/Versions/7.10.3-x86_64/usr/lib/ghc-7.10.3/integ_2aU3IZNMF9a7mQ0OzsZ0dS/include' '--cflag=-I/Library/Frameworks/GHC.framework/Versions/7.10.3-x86_64/usr/lib/ghc-7.10.3/include' '--lflag=-L/Users/USER/Library/Haskell/ghc-7.10.3-x86_64/lib/data-default-0.5.3' '--lflag=-L/Users/USER/Library/Haskell/ghc-7.10.3-x86_64/lib/data-default-instances-old-locale-0.0.1' '--lflag=-L/Library/Haskell/ghc-7.10.3-x86_64/lib/old-locale-1.0.0.7' '--lflag=-L/Users/USER/Library/Haskell/ghc-7.10.3-x86_64/lib/data-default-instances-dlist-0.0.1' '--lflag=-L/Users/USER/Library/Haskell/ghc-7.10.3-x86_64/lib/dlist-0.7.1.2' '--lflag=-L/Users/USER/Library/Haskell/ghc-7.10.3-x86_64/lib/data-default-instances-containers-0.0.1' '--lflag=-L/Users/USER/Library/Haskell/ghc-7.10.3-x86_64/lib/data-default-instances-base-0.0.1' '--lflag=-L/Users/USER/Library/Haskell/ghc-7.10.3-x86_64/lib/data-default-class-0.0.1' '--lflag=-L/Library/Frameworks/GHC.framework/Versions/7.10.3-x86_64/usr/lib/ghc-7.10.3/conta_2C3ZI8RgPO2LBMidXKTvIU' '--lflag=-L/Library/Frameworks/GHC.framework/Versions/7.10.3-x86_64/usr/lib/ghc-7.10.3/deeps_6vMKxt5sPFR0XsbRWvvq59' '--lflag=-L/Library/Frameworks/GHC.framework/Versions/7.10.3-x86_64/usr/lib/ghc-7.10.3/array_67iodizgJQIIxYVTp4emlA' '--lflag=-L/Library/Frameworks/GHC.framework/Versions/7.10.3-x86_64/usr/lib/ghc-7.10.3/base_HQfYBxpPvuw8OunzQu6JGM' '--lflag=-liconv' '--lflag=-L/Library/Frameworks/GHC.framework/Versions/7.10.3-x86_64/usr/lib/ghc-7.10.3/integ_2aU3IZNMF9a7mQ0OzsZ0dS' '--lflag=-L/Library/Frameworks/GHC.framework/Versions/7.10.3-x86_64/usr/lib/ghc-7.10.3/ghcpr_8TmvWUcS1U1IKHT0levwg3' '--lflag=-L/Library/Frameworks/GHC.framework/Versions/7.10.3-x86_64/usr/lib/ghc-7.10.3/rts' '--lflag=-lm' '--lflag=-ldl' -o dist/build/Graphics/X11/ExtraTypes/AP.hs Graphics/X11/ExtraTypes/AP.hsc In file included from AP.hsc:166: In file included from include/HsAllKeysyms.h:48: /usr/X11/include/X11/HPkeysym.h:58:9: warning: '_HPKEYSYM_H' is used as a header guard here, followed by #define of a different macro [-Wheader-guard] #ifndef _HPKEYSYM_H ^~~~~~~~~~~ /usr/X11/include/X11/HPkeysym.h:60:9: note: '_HPKEYSYM' is defined here; did you mean '_HPKEYSYM_H'? #define _HPKEYSYM ^~~~~~~~~ _HPKEYSYM_H 1 warning generated. creating dist/build/Graphics/X11/ExtraTypes /usr/local/bin/hsc2hs '--cc=/usr/bin/gcc' '--ld=/usr/bin/gcc' '--cflag=-D__GLASGOW_HASKELL__=710' '--cflag=-Ddarwin_BUILD_OS=1' '--cflag=-Dx86_64_BUILD_ARCH=1' '--cflag=-Ddarwin_HOST_OS=1' '--cflag=-Dx86_64_HOST_ARCH=1' '--cflag=-Iinclude' '--cflag=-I/usr/X11/include' '--cflag=-I/usr/X11/include' '--cflag=-I/usr/X11/include' '--cflag=-Idist/build/autogen' '--cflag=-include' '--cflag=dist/build/autogen/cabal_macros.h' '--lflag=-lXss' '--lflag=-lXinerama' '--lflag=-lXext' '--lflag=-lX11' '--lflag=-lXrandr' '--lflag=-lXext' '--lflag=-L/usr/X11/lib' '--cflag=-I/Library/Frameworks/GHC.framework/Versions/7.10.3-x86_64/usr/lib/ghc-7.10.3/base_HQfYBxpPvuw8OunzQu6JGM/include' '--cflag=-I/Library/Frameworks/GHC.framework/Versions/7.10.3-x86_64/usr/lib/ghc-7.10.3/integ_2aU3IZNMF9a7mQ0OzsZ0dS/include' '--cflag=-I/Library/Frameworks/GHC.framework/Versions/7.10.3-x86_64/usr/lib/ghc-7.10.3/include' '--lflag=-L/Users/USER/Library/Haskell/ghc-7.10.3-x86_64/lib/data-default-0.5.3' '--lflag=-L/Users/USER/Library/Haskell/ghc-7.10.3-x86_64/lib/data-default-instances-old-locale-0.0.1' '--lflag=-L/Library/Haskell/ghc-7.10.3-x86_64/lib/old-locale-1.0.0.7' '--lflag=-L/Users/USER/Library/Haskell/ghc-7.10.3-x86_64/lib/data-default-instances-dlist-0.0.1' '--lflag=-L/Users/USER/Library/Haskell/ghc-7.10.3-x86_64/lib/dlist-0.7.1.2' '--lflag=-L/Users/USER/Library/Haskell/ghc-7.10.3-x86_64/lib/data-default-instances-containers-0.0.1' '--lflag=-L/Users/USER/Library/Haskell/ghc-7.10.3-x86_64/lib/data-default-instances-base-0.0.1' '--lflag=-L/Users/USER/Library/Haskell/ghc-7.10.3-x86_64/lib/data-default-class-0.0.1' '--lflag=-L/Library/Frameworks/GHC.framework/Versions/7.10.3-x86_64/usr/lib/ghc-7.10.3/conta_2C3ZI8RgPO2LBMidXKTvIU' '--lflag=-L/Library/Frameworks/GHC.framework/Versions/7.10.3-x86_64/usr/lib/ghc-7.10.3/deeps_6vMKxt5sPFR0XsbRWvvq59' '--lflag=-L/Library/Frameworks/GHC.framework/Versions/7.10.3-x86_64/usr/lib/ghc-7.10.3/array_67iodizgJQIIxYVTp4emlA' '--lflag=-L/Library/Frameworks/GHC.framework/Versions/7.10.3-x86_64/usr/lib/ghc-7.10.3/base_HQfYBxpPvuw8OunzQu6JGM' '--lflag=-liconv' '--lflag=-L/Library/Frameworks/GHC.framework/Versions/7.10.3-x86_64/usr/lib/ghc-7.10.3/integ_2aU3IZNMF9a7mQ0OzsZ0dS' '--lflag=-L/Library/Frameworks/GHC.framework/Versions/7.10.3-x86_64/usr/lib/ghc-7.10.3/ghcpr_8TmvWUcS1U1IKHT0levwg3' '--lflag=-L/Library/Frameworks/GHC.framework/Versions/7.10.3-x86_64/usr/lib/ghc-7.10.3/rts' '--lflag=-lm' '--lflag=-ldl' -o dist/build/Graphics/X11/ExtraTypes/DEC.hs Graphics/X11/ExtraTypes/DEC.hsc In file included from DEC.hsc:111: In file included from include/HsAllKeysyms.h:48: /usr/X11/include/X11/HPkeysym.h:58:9: warning: '_HPKEYSYM_H' is used as a header guard here, followed by #define of a different macro [-Wheader-guard] #ifndef _HPKEYSYM_H ^~~~~~~~~~~ /usr/X11/include/X11/HPkeysym.h:60:9: note: '_HPKEYSYM' is defined here; did you mean '_HPKEYSYM_H'? #define _HPKEYSYM ^~~~~~~~~ _HPKEYSYM_H 1 warning generated. creating dist/build/Graphics/X11/ExtraTypes /usr/local/bin/hsc2hs '--cc=/usr/bin/gcc' '--ld=/usr/bin/gcc' '--cflag=-D__GLASGOW_HASKELL__=710' '--cflag=-Ddarwin_BUILD_OS=1' '--cflag=-Dx86_64_BUILD_ARCH=1' '--cflag=-Ddarwin_HOST_OS=1' '--cflag=-Dx86_64_HOST_ARCH=1' '--cflag=-Iinclude' '--cflag=-I/usr/X11/include' '--cflag=-I/usr/X11/include' '--cflag=-I/usr/X11/include' '--cflag=-Idist/build/autogen' '--cflag=-include' '--cflag=dist/build/autogen/cabal_macros.h' '--lflag=-lXss' '--lflag=-lXinerama' '--lflag=-lXext' '--lflag=-lX11' '--lflag=-lXrandr' '--lflag=-lXext' '--lflag=-L/usr/X11/lib' '--cflag=-I/Library/Frameworks/GHC.framework/Versions/7.10.3-x86_64/usr/lib/ghc-7.10.3/base_HQfYBxpPvuw8OunzQu6JGM/include' '--cflag=-I/Library/Frameworks/GHC.framework/Versions/7.10.3-x86_64/usr/lib/ghc-7.10.3/integ_2aU3IZNMF9a7mQ0OzsZ0dS/include' '--cflag=-I/Library/Frameworks/GHC.framework/Versions/7.10.3-x86_64/usr/lib/ghc-7.10.3/include' '--lflag=-L/Users/USER/Library/Haskell/ghc-7.10.3-x86_64/lib/data-default-0.5.3' '--lflag=-L/Users/USER/Library/Haskell/ghc-7.10.3-x86_64/lib/data-default-instances-old-locale-0.0.1' '--lflag=-L/Library/Haskell/ghc-7.10.3-x86_64/lib/old-locale-1.0.0.7' '--lflag=-L/Users/USER/Library/Haskell/ghc-7.10.3-x86_64/lib/data-default-instances-dlist-0.0.1' '--lflag=-L/Users/USER/Library/Haskell/ghc-7.10.3-x86_64/lib/dlist-0.7.1.2' '--lflag=-L/Users/USER/Library/Haskell/ghc-7.10.3-x86_64/lib/data-default-instances-containers-0.0.1' '--lflag=-L/Users/USER/Library/Haskell/ghc-7.10.3-x86_64/lib/data-default-instances-base-0.0.1' '--lflag=-L/Users/USER/Library/Haskell/ghc-7.10.3-x86_64/lib/data-default-class-0.0.1' '--lflag=-L/Library/Frameworks/GHC.framework/Versions/7.10.3-x86_64/usr/lib/ghc-7.10.3/conta_2C3ZI8RgPO2LBMidXKTvIU' '--lflag=-L/Library/Frameworks/GHC.framework/Versions/7.10.3-x86_64/usr/lib/ghc-7.10.3/deeps_6vMKxt5sPFR0XsbRWvvq59' '--lflag=-L/Library/Frameworks/GHC.framework/Versions/7.10.3-x86_64/usr/lib/ghc-7.10.3/array_67iodizgJQIIxYVTp4emlA' '--lflag=-L/Library/Frameworks/GHC.framework/Versions/7.10.3-x86_64/usr/lib/ghc-7.10.3/base_HQfYBxpPvuw8OunzQu6JGM' '--lflag=-liconv' '--lflag=-L/Library/Frameworks/GHC.framework/Versions/7.10.3-x86_64/usr/lib/ghc-7.10.3/integ_2aU3IZNMF9a7mQ0OzsZ0dS' '--lflag=-L/Library/Frameworks/GHC.framework/Versions/7.10.3-x86_64/usr/lib/ghc-7.10.3/ghcpr_8TmvWUcS1U1IKHT0levwg3' '--lflag=-L/Library/Frameworks/GHC.framework/Versions/7.10.3-x86_64/usr/lib/ghc-7.10.3/rts' '--lflag=-lm' '--lflag=-ldl' -o dist/build/Graphics/X11/ExtraTypes/HP.hs Graphics/X11/ExtraTypes/HP.hsc In file included from HP.hsc:504: In file included from include/HsAllKeysyms.h:48: /usr/X11/include/X11/HPkeysym.h:58:9: warning: '_HPKEYSYM_H' is used as a header guard here, followed by #define of a different macro [-Wheader-guard] #ifndef _HPKEYSYM_H ^~~~~~~~~~~ /usr/X11/include/X11/HPkeysym.h:60:9: note: '_HPKEYSYM' is defined here; did you mean '_HPKEYSYM_H'? #define _HPKEYSYM ^~~~~~~~~ _HPKEYSYM_H 1 warning generated. creating dist/build/Graphics/X11/ExtraTypes /usr/local/bin/hsc2hs '--cc=/usr/bin/gcc' '--ld=/usr/bin/gcc' '--cflag=-D__GLASGOW_HASKELL__=710' '--cflag=-Ddarwin_BUILD_OS=1' '--cflag=-Dx86_64_BUILD_ARCH=1' '--cflag=-Ddarwin_HOST_OS=1' '--cflag=-Dx86_64_HOST_ARCH=1' '--cflag=-Iinclude' '--cflag=-I/usr/X11/include' '--cflag=-I/usr/X11/include' '--cflag=-I/usr/X11/include' '--cflag=-Idist/build/autogen' '--cflag=-include' '--cflag=dist/build/autogen/cabal_macros.h' '--lflag=-lXss' '--lflag=-lXinerama' '--lflag=-lXext' '--lflag=-lX11' '--lflag=-lXrandr' '--lflag=-lXext' '--lflag=-L/usr/X11/lib' '--cflag=-I/Library/Frameworks/GHC.framework/Versions/7.10.3-x86_64/usr/lib/ghc-7.10.3/base_HQfYBxpPvuw8OunzQu6JGM/include' '--cflag=-I/Library/Frameworks/GHC.framework/Versions/7.10.3-x86_64/usr/lib/ghc-7.10.3/integ_2aU3IZNMF9a7mQ0OzsZ0dS/include' '--cflag=-I/Library/Frameworks/GHC.framework/Versions/7.10.3-x86_64/usr/lib/ghc-7.10.3/include' '--lflag=-L/Users/USER/Library/Haskell/ghc-7.10.3-x86_64/lib/data-default-0.5.3' '--lflag=-L/Users/USER/Library/Haskell/ghc-7.10.3-x86_64/lib/data-default-instances-old-locale-0.0.1' '--lflag=-L/Library/Haskell/ghc-7.10.3-x86_64/lib/old-locale-1.0.0.7' '--lflag=-L/Users/USER/Library/Haskell/ghc-7.10.3-x86_64/lib/data-default-instances-dlist-0.0.1' '--lflag=-L/Users/USER/Library/Haskell/ghc-7.10.3-x86_64/lib/dlist-0.7.1.2' '--lflag=-L/Users/USER/Library/Haskell/ghc-7.10.3-x86_64/lib/data-default-instances-containers-0.0.1' '--lflag=-L/Users/USER/Library/Haskell/ghc-7.10.3-x86_64/lib/data-default-instances-base-0.0.1' '--lflag=-L/Users/USER/Library/Haskell/ghc-7.10.3-x86_64/lib/data-default-class-0.0.1' '--lflag=-L/Library/Frameworks/GHC.framework/Versions/7.10.3-x86_64/usr/lib/ghc-7.10.3/conta_2C3ZI8RgPO2LBMidXKTvIU' '--lflag=-L/Library/Frameworks/GHC.framework/Versions/7.10.3-x86_64/usr/lib/ghc-7.10.3/deeps_6vMKxt5sPFR0XsbRWvvq59' '--lflag=-L/Library/Frameworks/GHC.framework/Versions/7.10.3-x86_64/usr/lib/ghc-7.10.3/array_67iodizgJQIIxYVTp4emlA' '--lflag=-L/Library/Frameworks/GHC.framework/Versions/7.10.3-x86_64/usr/lib/ghc-7.10.3/base_HQfYBxpPvuw8OunzQu6JGM' '--lflag=-liconv' '--lflag=-L/Library/Frameworks/GHC.framework/Versions/7.10.3-x86_64/usr/lib/ghc-7.10.3/integ_2aU3IZNMF9a7mQ0OzsZ0dS' '--lflag=-L/Library/Frameworks/GHC.framework/Versions/7.10.3-x86_64/usr/lib/ghc-7.10.3/ghcpr_8TmvWUcS1U1IKHT0levwg3' '--lflag=-L/Library/Frameworks/GHC.framework/Versions/7.10.3-x86_64/usr/lib/ghc-7.10.3/rts' '--lflag=-lm' '--lflag=-ldl' -o dist/build/Graphics/X11/ExtraTypes/Sun.hs Graphics/X11/ExtraTypes/Sun.hsc In file included from Sun.hsc:236: In file included from include/HsAllKeysyms.h:48: /usr/X11/include/X11/HPkeysym.h:58:9: warning: '_HPKEYSYM_H' is used as a header guard here, followed by #define of a different macro [-Wheader-guard] #ifndef _HPKEYSYM_H ^~~~~~~~~~~ /usr/X11/include/X11/HPkeysym.h:60:9: note: '_HPKEYSYM' is defined here; did you mean '_HPKEYSYM_H'? #define _HPKEYSYM ^~~~~~~~~ _HPKEYSYM_H 1 warning generated. creating dist/build/Graphics/X11/ExtraTypes /usr/local/bin/hsc2hs '--cc=/usr/bin/gcc' '--ld=/usr/bin/gcc' '--cflag=-D__GLASGOW_HASKELL__=710' '--cflag=-Ddarwin_BUILD_OS=1' '--cflag=-Dx86_64_BUILD_ARCH=1' '--cflag=-Ddarwin_HOST_OS=1' '--cflag=-Dx86_64_HOST_ARCH=1' '--cflag=-Iinclude' '--cflag=-I/usr/X11/include' '--cflag=-I/usr/X11/include' '--cflag=-I/usr/X11/include' '--cflag=-Idist/build/autogen' '--cflag=-include' '--cflag=dist/build/autogen/cabal_macros.h' '--lflag=-lXss' '--lflag=-lXinerama' '--lflag=-lXext' '--lflag=-lX11' '--lflag=-lXrandr' '--lflag=-lXext' '--lflag=-L/usr/X11/lib' '--cflag=-I/Library/Frameworks/GHC.framework/Versions/7.10.3-x86_64/usr/lib/ghc-7.10.3/base_HQfYBxpPvuw8OunzQu6JGM/include' '--cflag=-I/Library/Frameworks/GHC.framework/Versions/7.10.3-x86_64/usr/lib/ghc-7.10.3/integ_2aU3IZNMF9a7mQ0OzsZ0dS/include' '--cflag=-I/Library/Frameworks/GHC.framework/Versions/7.10.3-x86_64/usr/lib/ghc-7.10.3/include' '--lflag=-L/Users/USER/Library/Haskell/ghc-7.10.3-x86_64/lib/data-default-0.5.3' '--lflag=-L/Users/USER/Library/Haskell/ghc-7.10.3-x86_64/lib/data-default-instances-old-locale-0.0.1' '--lflag=-L/Library/Haskell/ghc-7.10.3-x86_64/lib/old-locale-1.0.0.7' '--lflag=-L/Users/USER/Library/Haskell/ghc-7.10.3-x86_64/lib/data-default-instances-dlist-0.0.1' '--lflag=-L/Users/USER/Library/Haskell/ghc-7.10.3-x86_64/lib/dlist-0.7.1.2' '--lflag=-L/Users/USER/Library/Haskell/ghc-7.10.3-x86_64/lib/data-default-instances-containers-0.0.1' '--lflag=-L/Users/USER/Library/Haskell/ghc-7.10.3-x86_64/lib/data-default-instances-base-0.0.1' '--lflag=-L/Users/USER/Library/Haskell/ghc-7.10.3-x86_64/lib/data-default-class-0.0.1' '--lflag=-L/Library/Frameworks/GHC.framework/Versions/7.10.3-x86_64/usr/lib/ghc-7.10.3/conta_2C3ZI8RgPO2LBMidXKTvIU' '--lflag=-L/Library/Frameworks/GHC.framework/Versions/7.10.3-x86_64/usr/lib/ghc-7.10.3/deeps_6vMKxt5sPFR0XsbRWvvq59' '--lflag=-L/Library/Frameworks/GHC.framework/Versions/7.10.3-x86_64/usr/lib/ghc-7.10.3/array_67iodizgJQIIxYVTp4emlA' '--lflag=-L/Library/Frameworks/GHC.framework/Versions/7.10.3-x86_64/usr/lib/ghc-7.10.3/base_HQfYBxpPvuw8OunzQu6JGM' '--lflag=-liconv' '--lflag=-L/Library/Frameworks/GHC.framework/Versions/7.10.3-x86_64/usr/lib/ghc-7.10.3/integ_2aU3IZNMF9a7mQ0OzsZ0dS' '--lflag=-L/Library/Frameworks/GHC.framework/Versions/7.10.3-x86_64/usr/lib/ghc-7.10.3/ghcpr_8TmvWUcS1U1IKHT0levwg3' '--lflag=-L/Library/Frameworks/GHC.framework/Versions/7.10.3-x86_64/usr/lib/ghc-7.10.3/rts' '--lflag=-lm' '--lflag=-ldl' -o dist/build/Graphics/X11/ExtraTypes/XF86.hs Graphics/X11/ExtraTypes/XF86.hsc In file included from XF86.hsc:775: In file included from include/HsAllKeysyms.h:48: /usr/X11/include/X11/HPkeysym.h:58:9: warning: '_HPKEYSYM_H' is used as a header guard here, followed by #define of a different macro [-Wheader-guard] #ifndef _HPKEYSYM_H ^~~~~~~~~~~ /usr/X11/include/X11/HPkeysym.h:60:9: note: '_HPKEYSYM' is defined here; did you mean '_HPKEYSYM_H'? #define _HPKEYSYM ^~~~~~~~~ _HPKEYSYM_H 1 warning generated. creating dist/build/Graphics/X11/ExtraTypes /usr/local/bin/hsc2hs '--cc=/usr/bin/gcc' '--ld=/usr/bin/gcc' '--cflag=-D__GLASGOW_HASKELL__=710' '--cflag=-Ddarwin_BUILD_OS=1' '--cflag=-Dx86_64_BUILD_ARCH=1' '--cflag=-Ddarwin_HOST_OS=1' '--cflag=-Dx86_64_HOST_ARCH=1' '--cflag=-Iinclude' '--cflag=-I/usr/X11/include' '--cflag=-I/usr/X11/include' '--cflag=-I/usr/X11/include' '--cflag=-Idist/build/autogen' '--cflag=-include' '--cflag=dist/build/autogen/cabal_macros.h' '--lflag=-lXss' '--lflag=-lXinerama' '--lflag=-lXext' '--lflag=-lX11' '--lflag=-lXrandr' '--lflag=-lXext' '--lflag=-L/usr/X11/lib' '--cflag=-I/Library/Frameworks/GHC.framework/Versions/7.10.3-x86_64/usr/lib/ghc-7.10.3/base_HQfYBxpPvuw8OunzQu6JGM/include' '--cflag=-I/Library/Frameworks/GHC.framework/Versions/7.10.3-x86_64/usr/lib/ghc-7.10.3/integ_2aU3IZNMF9a7mQ0OzsZ0dS/include' '--cflag=-I/Library/Frameworks/GHC.framework/Versions/7.10.3-x86_64/usr/lib/ghc-7.10.3/include' '--lflag=-L/Users/USER/Library/Haskell/ghc-7.10.3-x86_64/lib/data-default-0.5.3' '--lflag=-L/Users/USER/Library/Haskell/ghc-7.10.3-x86_64/lib/data-default-instances-old-locale-0.0.1' '--lflag=-L/Library/Haskell/ghc-7.10.3-x86_64/lib/old-locale-1.0.0.7' '--lflag=-L/Users/USER/Library/Haskell/ghc-7.10.3-x86_64/lib/data-default-instances-dlist-0.0.1' '--lflag=-L/Users/USER/Library/Haskell/ghc-7.10.3-x86_64/lib/dlist-0.7.1.2' '--lflag=-L/Users/USER/Library/Haskell/ghc-7.10.3-x86_64/lib/data-default-instances-containers-0.0.1' '--lflag=-L/Users/USER/Library/Haskell/ghc-7.10.3-x86_64/lib/data-default-instances-base-0.0.1' '--lflag=-L/Users/USER/Library/Haskell/ghc-7.10.3-x86_64/lib/data-default-class-0.0.1' '--lflag=-L/Library/Frameworks/GHC.framework/Versions/7.10.3-x86_64/usr/lib/ghc-7.10.3/conta_2C3ZI8RgPO2LBMidXKTvIU' '--lflag=-L/Library/Frameworks/GHC.framework/Versions/7.10.3-x86_64/usr/lib/ghc-7.10.3/deeps_6vMKxt5sPFR0XsbRWvvq59' '--lflag=-L/Library/Frameworks/GHC.framework/Versions/7.10.3-x86_64/usr/lib/ghc-7.10.3/array_67iodizgJQIIxYVTp4emlA' '--lflag=-L/Library/Frameworks/GHC.framework/Versions/7.10.3-x86_64/usr/lib/ghc-7.10.3/base_HQfYBxpPvuw8OunzQu6JGM' '--lflag=-liconv' '--lflag=-L/Library/Frameworks/GHC.framework/Versions/7.10.3-x86_64/usr/lib/ghc-7.10.3/integ_2aU3IZNMF9a7mQ0OzsZ0dS' '--lflag=-L/Library/Frameworks/GHC.framework/Versions/7.10.3-x86_64/usr/lib/ghc-7.10.3/ghcpr_8TmvWUcS1U1IKHT0levwg3' '--lflag=-L/Library/Frameworks/GHC.framework/Versions/7.10.3-x86_64/usr/lib/ghc-7.10.3/rts' '--lflag=-lm' '--lflag=-ldl' -o dist/build/Graphics/X11/ExtraTypes/XorgDefault.hs Graphics/X11/ExtraTypes/XorgDefault.hsc In file included from XorgDefault.hsc:10047: In file included from include/HsAllKeysyms.h:48: /usr/X11/include/X11/HPkeysym.h:58:9: warning: '_HPKEYSYM_H' is used as a header guard here, followed by #define of a different macro [-Wheader-guard] #ifndef _HPKEYSYM_H ^~~~~~~~~~~ /usr/X11/include/X11/HPkeysym.h:60:9: note: '_HPKEYSYM' is defined here; did you mean '_HPKEYSYM_H'? #define _HPKEYSYM ^~~~~~~~~ _HPKEYSYM_H 1 warning generated. creating dist/build/Graphics/X11/Xlib /usr/local/bin/hsc2hs '--cc=/usr/bin/gcc' '--ld=/usr/bin/gcc' '--cflag=-D__GLASGOW_HASKELL__=710' '--cflag=-Ddarwin_BUILD_OS=1' '--cflag=-Dx86_64_BUILD_ARCH=1' '--cflag=-Ddarwin_HOST_OS=1' '--cflag=-Dx86_64_HOST_ARCH=1' '--cflag=-Iinclude' '--cflag=-I/usr/X11/include' '--cflag=-I/usr/X11/include' '--cflag=-I/usr/X11/include' '--cflag=-Idist/build/autogen' '--cflag=-include' '--cflag=dist/build/autogen/cabal_macros.h' '--lflag=-lXss' '--lflag=-lXinerama' '--lflag=-lXext' '--lflag=-lX11' '--lflag=-lXrandr' '--lflag=-lXext' '--lflag=-L/usr/X11/lib' '--cflag=-I/Library/Frameworks/GHC.framework/Versions/7.10.3-x86_64/usr/lib/ghc-7.10.3/base_HQfYBxpPvuw8OunzQu6JGM/include' '--cflag=-I/Library/Frameworks/GHC.framework/Versions/7.10.3-x86_64/usr/lib/ghc-7.10.3/integ_2aU3IZNMF9a7mQ0OzsZ0dS/include' '--cflag=-I/Library/Frameworks/GHC.framework/Versions/7.10.3-x86_64/usr/lib/ghc-7.10.3/include' '--lflag=-L/Users/USER/Library/Haskell/ghc-7.10.3-x86_64/lib/data-default-0.5.3' '--lflag=-L/Users/USER/Library/Haskell/ghc-7.10.3-x86_64/lib/data-default-instances-old-locale-0.0.1' '--lflag=-L/Library/Haskell/ghc-7.10.3-x86_64/lib/old-locale-1.0.0.7' '--lflag=-L/Users/USER/Library/Haskell/ghc-7.10.3-x86_64/lib/data-default-instances-dlist-0.0.1' '--lflag=-L/Users/USER/Library/Haskell/ghc-7.10.3-x86_64/lib/dlist-0.7.1.2' '--lflag=-L/Users/USER/Library/Haskell/ghc-7.10.3-x86_64/lib/data-default-instances-containers-0.0.1' '--lflag=-L/Users/USER/Library/Haskell/ghc-7.10.3-x86_64/lib/data-default-instances-base-0.0.1' '--lflag=-L/Users/USER/Library/Haskell/ghc-7.10.3-x86_64/lib/data-default-class-0.0.1' '--lflag=-L/Library/Frameworks/GHC.framework/Versions/7.10.3-x86_64/usr/lib/ghc-7.10.3/conta_2C3ZI8RgPO2LBMidXKTvIU' '--lflag=-L/Library/Frameworks/GHC.framework/Versions/7.10.3-x86_64/usr/lib/ghc-7.10.3/deeps_6vMKxt5sPFR0XsbRWvvq59' '--lflag=-L/Library/Frameworks/GHC.framework/Versions/7.10.3-x86_64/usr/lib/ghc-7.10.3/array_67iodizgJQIIxYVTp4emlA' '--lflag=-L/Library/Frameworks/GHC.framework/Versions/7.10.3-x86_64/usr/lib/ghc-7.10.3/base_HQfYBxpPvuw8OunzQu6JGM' '--lflag=-liconv' '--lflag=-L/Library/Frameworks/GHC.framework/Versions/7.10.3-x86_64/usr/lib/ghc-7.10.3/integ_2aU3IZNMF9a7mQ0OzsZ0dS' '--lflag=-L/Library/Frameworks/GHC.framework/Versions/7.10.3-x86_64/usr/lib/ghc-7.10.3/ghcpr_8TmvWUcS1U1IKHT0levwg3' '--lflag=-L/Library/Frameworks/GHC.framework/Versions/7.10.3-x86_64/usr/lib/ghc-7.10.3/rts' '--lflag=-lm' '--lflag=-ldl' -o dist/build/Graphics/X11/Xlib/Internal.hs Graphics/X11/Xlib/Internal.hsc Building library... creating dist/build /usr/local/bin/ghc --make -fbuilding-cabal-package -O -static -dynamic-too -dynosuf dyn_o -dynhisuf dyn_hi -outputdir dist/build -odir dist/build -hidir dist/build -stubdir dist/build -i -idist/build -i. -idist/build/autogen -Idist/build/autogen -Idist/build -Iinclude -optP-include -optPdist/build/autogen/cabal_macros.h -this-package-key X11_IWliEAOAW3jLTNM8XZxGwo -hide-all-packages -package-db dist/package.conf.inplace -package-id base-4.8.2.0-cc43d8e06aa74e9c4c0132becc49ee25 -package-id data-default-0.5.3-9dff3193f506bb1167ea34cbb11b90f2 -XHaskell98 -XForeignFunctionInterface -XCPP Graphics.X11 Graphics.X11.Types Graphics.X11.Xlib Graphics.X11.Xlib.Atom Graphics.X11.Xlib.Color Graphics.X11.Xlib.Context Graphics.X11.Xlib.Cursor Graphics.X11.Xlib.Display Graphics.X11.Xlib.Event Graphics.X11.Xlib.Font Graphics.X11.Xlib.Misc Graphics.X11.Xlib.Region Graphics.X11.Xlib.Screen Graphics.X11.Xlib.Types Graphics.X11.Xlib.Window Graphics.X11.Xlib.Image Graphics.X11.Xlib.Extras Graphics.X11.Xinerama Graphics.X11.Xrandr Graphics.X11.XScreenSaver Graphics.X11.ExtraTypes Graphics.X11.ExtraTypes.AP Graphics.X11.ExtraTypes.DEC Graphics.X11.ExtraTypes.HP Graphics.X11.ExtraTypes.Sun Graphics.X11.ExtraTypes.XF86 Graphics.X11.ExtraTypes.XorgDefault Graphics.X11.Xlib.Internal -funbox-strict-fields -Wall -fno-warn-unused-binds [ 1 of 28] Compiling Graphics.X11.Xlib.Internal ( dist/build/Graphics/X11/Xlib/Internal.hs, dist/build/Graphics/X11/Xlib/Internal.o ) [ 2 of 28] Compiling Graphics.X11.Types ( dist/build/Graphics/X11/Types.hs, dist/build/Graphics/X11/Types.o ) Graphics/X11/Types.hsc:61:1: Warning: Tab character [ 3 of 28] Compiling Graphics.X11.Xlib.Types ( dist/build/Graphics/X11/Xlib/Types.hs, dist/build/Graphics/X11/Xlib/Types.o ) [ 4 of 28] Compiling Graphics.X11.Xlib.Display ( Graphics/X11/Xlib/Display.hs, dist/build/Graphics/X11/Xlib/Display.o ) [ 5 of 28] Compiling Graphics.X11.Xlib.Event ( dist/build/Graphics/X11/Xlib/Event.hs, dist/build/Graphics/X11/Xlib/Event.o ) [ 6 of 28] Compiling Graphics.X11.Xlib.Screen ( Graphics/X11/Xlib/Screen.hs, dist/build/Graphics/X11/Xlib/Screen.o ) [ 7 of 28] Compiling Graphics.X11.Xlib.Window ( Graphics/X11/Xlib/Window.hs, dist/build/Graphics/X11/Xlib/Window.o ) [ 8 of 28] Compiling Graphics.X11.Xlib.Context ( Graphics/X11/Xlib/Context.hs, dist/build/Graphics/X11/Xlib/Context.o ) [ 9 of 28] Compiling Graphics.X11.Xlib.Color ( Graphics/X11/Xlib/Color.hs, dist/build/Graphics/X11/Xlib/Color.o ) [10 of 28] Compiling Graphics.X11.Xlib.Font ( dist/build/Graphics/X11/Xlib/Font.hs, dist/build/Graphics/X11/Xlib/Font.o ) Graphics/X11/Xlib/Font.hsc:23:1: Warning: Tab character Graphics/X11/Xlib/Font.hsc:58:1: Warning: Tab character Graphics/X11/Xlib/Font.hsc:73:1: Warning: Tab character Graphics/X11/Xlib/Font.hsc:82:1: Warning: Tab character Graphics/X11/Xlib/Font.hsc:83:1: Warning: Tab character Graphics/X11/Xlib/Font.hsc:84:1: Warning: Tab character Graphics/X11/Xlib/Font.hsc:85:1: Warning: Tab character Graphics/X11/Xlib/Font.hsc:87:1: Warning: Tab character Graphics/X11/Xlib/Font.hsc:94:1: Warning: Tab character Graphics/X11/Xlib/Font.hsc:95:1: Warning: Tab character Graphics/X11/Xlib/Font.hsc:96:1: Warning: Tab character Graphics/X11/Xlib/Font.hsc:98:1: Warning: Tab character Graphics/X11/Xlib/Font.hsc:102:1: Warning: Tab character Graphics/X11/Xlib/Font.hsc:107:1: Warning: Tab character Graphics/X11/Xlib/Font.hsc:111:1: Warning: Tab character Graphics/X11/Xlib/Font.hsc:115:1: Warning: Tab character Graphics/X11/Xlib/Font.hsc:138:1: Warning: Tab character Graphics/X11/Xlib/Font.hsc:139:1: Warning: Tab character Graphics/X11/Xlib/Font.hsc:140:1: Warning: Tab character Graphics/X11/Xlib/Font.hsc:141:1: Warning: Tab character Graphics/X11/Xlib/Font.hsc:142:1: Warning: Tab character Graphics/X11/Xlib/Font.hsc:143:1: Warning: Tab character Graphics/X11/Xlib/Font.hsc:144:1: Warning: Tab character Graphics/X11/Xlib/Font.hsc:148:1: Warning: Tab character Graphics/X11/Xlib/Font.hsc:149:1: Warning: Tab character Graphics/X11/Xlib/Font.hsc:150:1: Warning: Tab character Graphics/X11/Xlib/Font.hsc:151:1: Warning: Tab character Graphics/X11/Xlib/Font.hsc:152:1: Warning: Tab character Graphics/X11/Xlib/Font.hsc:153:1: Warning: Tab character Graphics/X11/Xlib/Font.hsc:154:1: Warning: Tab character Graphics/X11/Xlib/Font.hsc:155:1: Warning: Tab character Graphics/X11/Xlib/Font.hsc:156:1: Warning: Tab character Graphics/X11/Xlib/Font.hsc:157:1: Warning: Tab character Graphics/X11/Xlib/Font.hsc:164:1: Warning: Tab character Graphics/X11/Xlib/Font.hsc:165:1: Warning: Tab character Graphics/X11/Xlib/Font.hsc:166:1: Warning: Tab character Graphics/X11/Xlib/Font.hsc:167:1: Warning: Tab character Graphics/X11/Xlib/Font.hsc:168:1: Warning: Tab character Graphics/X11/Xlib/Font.hsc:169:1: Warning: Tab character Graphics/X11/Xlib/Font.hsc:170:1: Warning: Tab character Graphics/X11/Xlib/Font.hsc:171:1: Warning: Tab character Graphics/X11/Xlib/Font.hsc:172:1: Warning: Tab character Graphics/X11/Xlib/Font.hsc:173:1: Warning: Tab character Graphics/X11/Xlib/Font.hsc:174:1: Warning: Tab character Graphics/X11/Xlib/Font.hsc:175:1: Warning: Tab character Graphics/X11/Xlib/Font.hsc:177:1: Warning: Tab character Graphics/X11/Xlib/Font.hsc:178:1: Warning: Tab character Graphics/X11/Xlib/Font.hsc:179:1: Warning: Tab character Graphics/X11/Xlib/Font.hsc:186:1: Warning: Tab character Graphics/X11/Xlib/Font.hsc:187:1: Warning: Tab character Graphics/X11/Xlib/Font.hsc:189:1: Warning: Tab character [11 of 28] Compiling Graphics.X11.Xlib.Cursor ( dist/build/Graphics/X11/Xlib/Cursor.hs, dist/build/Graphics/X11/Xlib/Cursor.o ) [12 of 28] Compiling Graphics.X11.Xlib.Atom ( dist/build/Graphics/X11/Xlib/Atom.hs, dist/build/Graphics/X11/Xlib/Atom.o ) [13 of 28] Compiling Graphics.X11.Xlib.Region ( Graphics/X11/Xlib/Region.hs, dist/build/Graphics/X11/Xlib/Region.o ) [14 of 28] Compiling Graphics.X11.Xlib.Image ( Graphics/X11/Xlib/Image.hs, dist/build/Graphics/X11/Xlib/Image.o ) [15 of 28] Compiling Graphics.X11.Xlib.Misc ( dist/build/Graphics/X11/Xlib/Misc.hs, dist/build/Graphics/X11/Xlib/Misc.o ) Graphics/X11/Xlib/Misc.hsc:698:10: Warning: Orphan instance: instance Default VisualInfo To avoid this move the instance declaration to the module of the class or of the type, or wrap the type with a newtype and declare the instance on the new type. [16 of 28] Compiling Graphics.X11.Xrandr ( dist/build/Graphics/X11/Xrandr.hs, dist/build/Graphics/X11/Xrandr.o ) [17 of 28] Compiling Graphics.X11.ExtraTypes.AP ( dist/build/Graphics/X11/ExtraTypes/AP.hs, dist/build/Graphics/X11/ExtraTypes/AP.o ) [18 of 28] Compiling Graphics.X11.ExtraTypes.DEC ( dist/build/Graphics/X11/ExtraTypes/DEC.hs, dist/build/Graphics/X11/ExtraTypes/DEC.o ) [19 of 28] Compiling Graphics.X11.ExtraTypes.HP ( dist/build/Graphics/X11/ExtraTypes/HP.hs, dist/build/Graphics/X11/ExtraTypes/HP.o ) [20 of 28] Compiling Graphics.X11.ExtraTypes.Sun ( dist/build/Graphics/X11/ExtraTypes/Sun.hs, dist/build/Graphics/X11/ExtraTypes/Sun.o ) [21 of 28] Compiling Graphics.X11.ExtraTypes.XF86 ( dist/build/Graphics/X11/ExtraTypes/XF86.hs, dist/build/Graphics/X11/ExtraTypes/XF86.o ) [22 of 28] Compiling Graphics.X11.ExtraTypes.XorgDefault ( dist/build/Graphics/X11/ExtraTypes/XorgDefault.hs, dist/build/Graphics/X11/ExtraTypes/XorgDefault.o ) [23 of 28] Compiling Graphics.X11.ExtraTypes ( Graphics/X11/ExtraTypes.hs, dist/build/Graphics/X11/ExtraTypes.o ) Graphics/X11/ExtraTypes.hs:16:1: Warning: Tab character Graphics/X11/ExtraTypes.hs:17:1: Warning: Tab character Graphics/X11/ExtraTypes.hs:18:1: Warning: Tab character Graphics/X11/ExtraTypes.hs:19:1: Warning: Tab character Graphics/X11/ExtraTypes.hs:20:1: Warning: Tab character Graphics/X11/ExtraTypes.hs:21:1: Warning: Tab character Graphics/X11/ExtraTypes.hs:22:1: Warning: Tab character Graphics/X11/ExtraTypes.hs:23:1: Warning: Tab character Graphics/X11/ExtraTypes.hs:25:1: Warning: Tab character [24 of 28] Compiling Graphics.X11.Xlib ( Graphics/X11/Xlib.hs, dist/build/Graphics/X11/Xlib.o ) Graphics/X11/Xlib.hs:23:1: Warning: Tab character Graphics/X11/Xlib.hs:24:1: Warning: Tab character Graphics/X11/Xlib.hs:26:1: Warning: Tab character Graphics/X11/Xlib.hs:27:1: Warning: Tab character Graphics/X11/Xlib.hs:29:1: Warning: Tab character Graphics/X11/Xlib.hs:30:1: Warning: Tab character Graphics/X11/Xlib.hs:31:1: Warning: Tab character Graphics/X11/Xlib.hs:33:1: Warning: Tab character Graphics/X11/Xlib.hs:47:1: Warning: Tab character [25 of 28] Compiling Graphics.X11.Xlib.Extras ( dist/build/Graphics/X11/Xlib/Extras.hs, dist/build/Graphics/X11/Xlib/Extras.o ) [26 of 28] Compiling Graphics.X11.Xinerama ( dist/build/Graphics/X11/Xinerama.hs, dist/build/Graphics/X11/Xinerama.o ) [27 of 28] Compiling Graphics.X11.XScreenSaver ( dist/build/Graphics/X11/XScreenSaver.hs, dist/build/Graphics/X11/XScreenSaver.o ) [28 of 28] Compiling Graphics.X11 ( Graphics/X11.hs, dist/build/Graphics/X11.o ) /usr/local/bin/ghc --make -fbuilding-cabal-package -O -prof -osuf p_o -hisuf p_hi -outputdir dist/build -odir dist/build -hidir dist/build -stubdir dist/build -i -idist/build -i. -idist/build/autogen -Idist/build/autogen -Idist/build -Iinclude -optP-include -optPdist/build/autogen/cabal_macros.h -this-package-key X11_IWliEAOAW3jLTNM8XZxGwo -hide-all-packages -package-db dist/package.conf.inplace -package-id base-4.8.2.0-cc43d8e06aa74e9c4c0132becc49ee25 -package-id data-default-0.5.3-9dff3193f506bb1167ea34cbb11b90f2 -XHaskell98 -XForeignFunctionInterface -XCPP Graphics.X11 Graphics.X11.Types Graphics.X11.Xlib Graphics.X11.Xlib.Atom Graphics.X11.Xlib.Color Graphics.X11.Xlib.Context Graphics.X11.Xlib.Cursor Graphics.X11.Xlib.Display Graphics.X11.Xlib.Event Graphics.X11.Xlib.Font Graphics.X11.Xlib.Misc Graphics.X11.Xlib.Region Graphics.X11.Xlib.Screen Graphics.X11.Xlib.Types Graphics.X11.Xlib.Window Graphics.X11.Xlib.Image Graphics.X11.Xlib.Extras Graphics.X11.Xinerama Graphics.X11.Xrandr Graphics.X11.XScreenSaver Graphics.X11.ExtraTypes Graphics.X11.ExtraTypes.AP Graphics.X11.ExtraTypes.DEC Graphics.X11.ExtraTypes.HP Graphics.X11.ExtraTypes.Sun Graphics.X11.ExtraTypes.XF86 Graphics.X11.ExtraTypes.XorgDefault Graphics.X11.Xlib.Internal -funbox-strict-fields -Wall -fno-warn-unused-binds -prof -auto-all [ 1 of 28] Compiling Graphics.X11.Xlib.Internal ( dist/build/Graphics/X11/Xlib/Internal.hs, dist/build/Graphics/X11/Xlib/Internal.p_o ) [ 2 of 28] Compiling Graphics.X11.Types ( dist/build/Graphics/X11/Types.hs, dist/build/Graphics/X11/Types.p_o ) Graphics/X11/Types.hsc:61:1: Warning: Tab character [ 3 of 28] Compiling Graphics.X11.Xlib.Types ( dist/build/Graphics/X11/Xlib/Types.hs, dist/build/Graphics/X11/Xlib/Types.p_o ) [ 4 of 28] Compiling Graphics.X11.Xlib.Display ( Graphics/X11/Xlib/Display.hs, dist/build/Graphics/X11/Xlib/Display.p_o ) [ 5 of 28] Compiling Graphics.X11.Xlib.Event ( dist/build/Graphics/X11/Xlib/Event.hs, dist/build/Graphics/X11/Xlib/Event.p_o ) [ 6 of 28] Compiling Graphics.X11.Xlib.Screen ( Graphics/X11/Xlib/Screen.hs, dist/build/Graphics/X11/Xlib/Screen.p_o ) [ 7 of 28] Compiling Graphics.X11.Xlib.Window ( Graphics/X11/Xlib/Window.hs, dist/build/Graphics/X11/Xlib/Window.p_o ) [ 8 of 28] Compiling Graphics.X11.Xlib.Context ( Graphics/X11/Xlib/Context.hs, dist/build/Graphics/X11/Xlib/Context.p_o ) [ 9 of 28] Compiling Graphics.X11.Xlib.Color ( Graphics/X11/Xlib/Color.hs, dist/build/Graphics/X11/Xlib/Color.p_o ) [10 of 28] Compiling Graphics.X11.Xlib.Font ( dist/build/Graphics/X11/Xlib/Font.hs, dist/build/Graphics/X11/Xlib/Font.p_o ) Graphics/X11/Xlib/Font.hsc:23:1: Warning: Tab character Graphics/X11/Xlib/Font.hsc:58:1: Warning: Tab character Graphics/X11/Xlib/Font.hsc:73:1: Warning: Tab character Graphics/X11/Xlib/Font.hsc:82:1: Warning: Tab character Graphics/X11/Xlib/Font.hsc:83:1: Warning: Tab character Graphics/X11/Xlib/Font.hsc:84:1: Warning: Tab character Graphics/X11/Xlib/Font.hsc:85:1: Warning: Tab character Graphics/X11/Xlib/Font.hsc:87:1: Warning: Tab character Graphics/X11/Xlib/Font.hsc:94:1: Warning: Tab character Graphics/X11/Xlib/Font.hsc:95:1: Warning: Tab character Graphics/X11/Xlib/Font.hsc:96:1: Warning: Tab character Graphics/X11/Xlib/Font.hsc:98:1: Warning: Tab character Graphics/X11/Xlib/Font.hsc:102:1: Warning: Tab character Graphics/X11/Xlib/Font.hsc:107:1: Warning: Tab character Graphics/X11/Xlib/Font.hsc:111:1: Warning: Tab character Graphics/X11/Xlib/Font.hsc:115:1: Warning: Tab character Graphics/X11/Xlib/Font.hsc:138:1: Warning: Tab character Graphics/X11/Xlib/Font.hsc:139:1: Warning: Tab character Graphics/X11/Xlib/Font.hsc:140:1: Warning: Tab character Graphics/X11/Xlib/Font.hsc:141:1: Warning: Tab character Graphics/X11/Xlib/Font.hsc:142:1: Warning: Tab character Graphics/X11/Xlib/Font.hsc:143:1: Warning: Tab character Graphics/X11/Xlib/Font.hsc:144:1: Warning: Tab character Graphics/X11/Xlib/Font.hsc:148:1: Warning: Tab character Graphics/X11/Xlib/Font.hsc:149:1: Warning: Tab character Graphics/X11/Xlib/Font.hsc:150:1: Warning: Tab character Graphics/X11/Xlib/Font.hsc:151:1: Warning: Tab character Graphics/X11/Xlib/Font.hsc:152:1: Warning: Tab character Graphics/X11/Xlib/Font.hsc:153:1: Warning: Tab character Graphics/X11/Xlib/Font.hsc:154:1: Warning: Tab character Graphics/X11/Xlib/Font.hsc:155:1: Warning: Tab character Graphics/X11/Xlib/Font.hsc:156:1: Warning: Tab character Graphics/X11/Xlib/Font.hsc:157:1: Warning: Tab character Graphics/X11/Xlib/Font.hsc:164:1: Warning: Tab character Graphics/X11/Xlib/Font.hsc:165:1: Warning: Tab character Graphics/X11/Xlib/Font.hsc:166:1: Warning: Tab character Graphics/X11/Xlib/Font.hsc:167:1: Warning: Tab character Graphics/X11/Xlib/Font.hsc:168:1: Warning: Tab character Graphics/X11/Xlib/Font.hsc:169:1: Warning: Tab character Graphics/X11/Xlib/Font.hsc:170:1: Warning: Tab character Graphics/X11/Xlib/Font.hsc:171:1: Warning: Tab character Graphics/X11/Xlib/Font.hsc:172:1: Warning: Tab character Graphics/X11/Xlib/Font.hsc:173:1: Warning: Tab character Graphics/X11/Xlib/Font.hsc:174:1: Warning: Tab character Graphics/X11/Xlib/Font.hsc:175:1: Warning: Tab character Graphics/X11/Xlib/Font.hsc:177:1: Warning: Tab character Graphics/X11/Xlib/Font.hsc:178:1: Warning: Tab character Graphics/X11/Xlib/Font.hsc:179:1: Warning: Tab character Graphics/X11/Xlib/Font.hsc:186:1: Warning: Tab character Graphics/X11/Xlib/Font.hsc:187:1: Warning: Tab character Graphics/X11/Xlib/Font.hsc:189:1: Warning: Tab character [11 of 28] Compiling Graphics.X11.Xlib.Cursor ( dist/build/Graphics/X11/Xlib/Cursor.hs, dist/build/Graphics/X11/Xlib/Cursor.p_o ) [12 of 28] Compiling Graphics.X11.Xlib.Atom ( dist/build/Graphics/X11/Xlib/Atom.hs, dist/build/Graphics/X11/Xlib/Atom.p_o ) [13 of 28] Compiling Graphics.X11.Xlib.Region ( Graphics/X11/Xlib/Region.hs, dist/build/Graphics/X11/Xlib/Region.p_o ) [14 of 28] Compiling Graphics.X11.Xlib.Image ( Graphics/X11/Xlib/Image.hs, dist/build/Graphics/X11/Xlib/Image.p_o ) [15 of 28] Compiling Graphics.X11.Xlib.Misc ( dist/build/Graphics/X11/Xlib/Misc.hs, dist/build/Graphics/X11/Xlib/Misc.p_o ) Graphics/X11/Xlib/Misc.hsc:698:10: Warning: Orphan instance: instance Default VisualInfo To avoid this move the instance declaration to the module of the class or of the type, or wrap the type with a newtype and declare the instance on the new type. [16 of 28] Compiling Graphics.X11.Xrandr ( dist/build/Graphics/X11/Xrandr.hs, dist/build/Graphics/X11/Xrandr.p_o ) [17 of 28] Compiling Graphics.X11.ExtraTypes.AP ( dist/build/Graphics/X11/ExtraTypes/AP.hs, dist/build/Graphics/X11/ExtraTypes/AP.p_o ) [18 of 28] Compiling Graphics.X11.ExtraTypes.DEC ( dist/build/Graphics/X11/ExtraTypes/DEC.hs, dist/build/Graphics/X11/ExtraTypes/DEC.p_o ) [19 of 28] Compiling Graphics.X11.ExtraTypes.HP ( dist/build/Graphics/X11/ExtraTypes/HP.hs, dist/build/Graphics/X11/ExtraTypes/HP.p_o ) [20 of 28] Compiling Graphics.X11.ExtraTypes.Sun ( dist/build/Graphics/X11/ExtraTypes/Sun.hs, dist/build/Graphics/X11/ExtraTypes/Sun.p_o ) [21 of 28] Compiling Graphics.X11.ExtraTypes.XF86 ( dist/build/Graphics/X11/ExtraTypes/XF86.hs, dist/build/Graphics/X11/ExtraTypes/XF86.p_o ) [22 of 28] Compiling Graphics.X11.ExtraTypes.XorgDefault ( dist/build/Graphics/X11/ExtraTypes/XorgDefault.hs, dist/build/Graphics/X11/ExtraTypes/XorgDefault.p_o ) [23 of 28] Compiling Graphics.X11.ExtraTypes ( Graphics/X11/ExtraTypes.hs, dist/build/Graphics/X11/ExtraTypes.p_o ) Graphics/X11/ExtraTypes.hs:16:1: Warning: Tab character Graphics/X11/ExtraTypes.hs:17:1: Warning: Tab character Graphics/X11/ExtraTypes.hs:18:1: Warning: Tab character Graphics/X11/ExtraTypes.hs:19:1: Warning: Tab character Graphics/X11/ExtraTypes.hs:20:1: Warning: Tab character Graphics/X11/ExtraTypes.hs:21:1: Warning: Tab character Graphics/X11/ExtraTypes.hs:22:1: Warning: Tab character Graphics/X11/ExtraTypes.hs:23:1: Warning: Tab character Graphics/X11/ExtraTypes.hs:25:1: Warning: Tab character [24 of 28] Compiling Graphics.X11.Xlib ( Graphics/X11/Xlib.hs, dist/build/Graphics/X11/Xlib.p_o ) Graphics/X11/Xlib.hs:23:1: Warning: Tab character Graphics/X11/Xlib.hs:24:1: Warning: Tab character Graphics/X11/Xlib.hs:26:1: Warning: Tab character Graphics/X11/Xlib.hs:27:1: Warning: Tab character Graphics/X11/Xlib.hs:29:1: Warning: Tab character Graphics/X11/Xlib.hs:30:1: Warning: Tab character Graphics/X11/Xlib.hs:31:1: Warning: Tab character Graphics/X11/Xlib.hs:33:1: Warning: Tab character Graphics/X11/Xlib.hs:47:1: Warning: Tab character [25 of 28] Compiling Graphics.X11.Xlib.Extras ( dist/build/Graphics/X11/Xlib/Extras.hs, dist/build/Graphics/X11/Xlib/Extras.p_o ) [26 of 28] Compiling Graphics.X11.Xinerama ( dist/build/Graphics/X11/Xinerama.hs, dist/build/Graphics/X11/Xinerama.p_o ) [27 of 28] Compiling Graphics.X11.XScreenSaver ( dist/build/Graphics/X11/XScreenSaver.hs, dist/build/Graphics/X11/XScreenSaver.p_o ) [28 of 28] Compiling Graphics.X11 ( Graphics/X11.hs, dist/build/Graphics/X11.p_o ) Building C Sources... creating dist/build /usr/local/bin/ghc -c -fPIC -odir dist/build -Idist/build/autogen -Idist/build -Iinclude -optc-O2 -optc-I/usr/X11/include -package-db dist/package.conf.inplace -package-id base-4.8.2.0-cc43d8e06aa74e9c4c0132becc49ee25 -package-id data-default-0.5.3-9dff3193f506bb1167ea34cbb11b90f2 cbits/fdset.c /usr/local/bin/ghc -c -dynamic -fPIC -osuf dyn_o -odir dist/build -Idist/build/autogen -Idist/build -Iinclude -optc-O2 -optc-I/usr/X11/include -package-db dist/package.conf.inplace -package-id base-4.8.2.0-cc43d8e06aa74e9c4c0132becc49ee25 -package-id data-default-0.5.3-9dff3193f506bb1167ea34cbb11b90f2 cbits/fdset.c /usr/local/bin/ghc -c -prof -fPIC -osuf p_o -odir dist/build -Idist/build/autogen -Idist/build -Iinclude -optc-O2 -optc-I/usr/X11/include -package-db dist/package.conf.inplace -package-id base-4.8.2.0-cc43d8e06aa74e9c4c0132becc49ee25 -package-id data-default-0.5.3-9dff3193f506bb1167ea34cbb11b90f2 cbits/fdset.c creating dist/build /usr/local/bin/ghc -c -fPIC -odir dist/build -Idist/build/autogen -Idist/build -Iinclude -optc-O2 -optc-I/usr/X11/include -package-db dist/package.conf.inplace -package-id base-4.8.2.0-cc43d8e06aa74e9c4c0132becc49ee25 -package-id data-default-0.5.3-9dff3193f506bb1167ea34cbb11b90f2 cbits/auxiliaries.c /usr/local/bin/ghc -c -dynamic -fPIC -osuf dyn_o -odir dist/build -Idist/build/autogen -Idist/build -Iinclude -optc-O2 -optc-I/usr/X11/include -package-db dist/package.conf.inplace -package-id base-4.8.2.0-cc43d8e06aa74e9c4c0132becc49ee25 -package-id data-default-0.5.3-9dff3193f506bb1167ea34cbb11b90f2 cbits/auxiliaries.c /usr/local/bin/ghc -c -prof -fPIC -osuf p_o -odir dist/build -Idist/build/autogen -Idist/build -Iinclude -optc-O2 -optc-I/usr/X11/include -package-db dist/package.conf.inplace -package-id base-4.8.2.0-cc43d8e06aa74e9c4c0132becc49ee25 -package-id data-default-0.5.3-9dff3193f506bb1167ea34cbb11b90f2 cbits/auxiliaries.c creating dist/build /usr/local/bin/ghc -c -fPIC -odir dist/build -Idist/build/autogen -Idist/build -Iinclude -optc-O2 -optc-I/usr/X11/include -package-db dist/package.conf.inplace -package-id base-4.8.2.0-cc43d8e06aa74e9c4c0132becc49ee25 -package-id data-default-0.5.3-9dff3193f506bb1167ea34cbb11b90f2 cbits/XUtils.c /usr/local/bin/ghc -c -dynamic -fPIC -osuf dyn_o -odir dist/build -Idist/build/autogen -Idist/build -Iinclude -optc-O2 -optc-I/usr/X11/include -package-db dist/package.conf.inplace -package-id base-4.8.2.0-cc43d8e06aa74e9c4c0132becc49ee25 -package-id data-default-0.5.3-9dff3193f506bb1167ea34cbb11b90f2 cbits/XUtils.c /usr/local/bin/ghc -c -prof -fPIC -osuf p_o -odir dist/build -Idist/build/autogen -Idist/build -Iinclude -optc-O2 -optc-I/usr/X11/include -package-db dist/package.conf.inplace -package-id base-4.8.2.0-cc43d8e06aa74e9c4c0132becc49ee25 -package-id data-default-0.5.3-9dff3193f506bb1167ea34cbb11b90f2 cbits/XUtils.c Linking... [(InstalledPackageId "base-4.8.2.0-cc43d8e06aa74e9c4c0132becc49ee25",PackageIdentifier {pkgName = PackageName {unPackageName = "base"}, pkgVersion = Version {versionBranch = [4,8,2,0], versionTags = []}},ModuleRenaming True []),(InstalledPackageId "data-default-0.5.3-9dff3193f506bb1167ea34cbb11b90f2",PackageIdentifier {pkgName = PackageName {unPackageName = "data-default"}, pkgVersion = Version {versionBranch = [0,5,3], versionTags = []}},ModuleRenaming True [])] /usr/bin/ar -r -s dist/build/objs-34820/libHSX11-1.6.1.2-IWliEAOAW3jLTNM8XZxGwo.a dist/build/Graphics/X11.o dist/build/Graphics/X11/Types.o dist/build/Graphics/X11/Xlib.o dist/build/Graphics/X11/Xlib/Atom.o dist/build/Graphics/X11/Xlib/Color.o dist/build/Graphics/X11/Xlib/Context.o dist/build/Graphics/X11/Xlib/Cursor.o dist/build/Graphics/X11/Xlib/Display.o dist/build/Graphics/X11/Xlib/Event.o dist/build/Graphics/X11/Xlib/Font.o dist/build/Graphics/X11/Xlib/Misc.o dist/build/Graphics/X11/Xlib/Region.o dist/build/Graphics/X11/Xlib/Screen.o dist/build/Graphics/X11/Xlib/Types.o dist/build/Graphics/X11/Xlib/Window.o dist/build/Graphics/X11/Xlib/Image.o dist/build/Graphics/X11/Xlib/Extras.o dist/build/Graphics/X11/Xinerama.o dist/build/Graphics/X11/Xrandr.o dist/build/Graphics/X11/XScreenSaver.o dist/build/Graphics/X11/ExtraTypes.o dist/build/Graphics/X11/ExtraTypes/AP.o dist/build/Graphics/X11/ExtraTypes/DEC.o dist/build/Graphics/X11/ExtraTypes/HP.o dist/build/Graphics/X11/ExtraTypes/Sun.o dist/build/Graphics/X11/ExtraTypes/XF86.o dist/build/Graphics/X11/ExtraTypes/XorgDefault.o dist/build/Graphics/X11/Xlib/Internal.o dist/build/cbits/fdset.o dist/build/cbits/auxiliaries.o dist/build/cbits/XUtils.o ar: creating archive dist/build/objs-34820/libHSX11-1.6.1.2-IWliEAOAW3jLTNM8XZxGwo.a /usr/bin/ar -r -s dist/build/objs-34820/libHSX11-1.6.1.2-IWliEAOAW3jLTNM8XZxGwo_p.a dist/build/Graphics/X11.p_o dist/build/Graphics/X11/Types.p_o dist/build/Graphics/X11/Xlib.p_o dist/build/Graphics/X11/Xlib/Atom.p_o dist/build/Graphics/X11/Xlib/Color.p_o dist/build/Graphics/X11/Xlib/Context.p_o dist/build/Graphics/X11/Xlib/Cursor.p_o dist/build/Graphics/X11/Xlib/Display.p_o dist/build/Graphics/X11/Xlib/Event.p_o dist/build/Graphics/X11/Xlib/Font.p_o dist/build/Graphics/X11/Xlib/Misc.p_o dist/build/Graphics/X11/Xlib/Region.p_o dist/build/Graphics/X11/Xlib/Screen.p_o dist/build/Graphics/X11/Xlib/Types.p_o dist/build/Graphics/X11/Xlib/Window.p_o dist/build/Graphics/X11/Xlib/Image.p_o dist/build/Graphics/X11/Xlib/Extras.p_o dist/build/Graphics/X11/Xinerama.p_o dist/build/Graphics/X11/Xrandr.p_o dist/build/Graphics/X11/XScreenSaver.p_o dist/build/Graphics/X11/ExtraTypes.p_o dist/build/Graphics/X11/ExtraTypes/AP.p_o dist/build/Graphics/X11/ExtraTypes/DEC.p_o dist/build/Graphics/X11/ExtraTypes/HP.p_o dist/build/Graphics/X11/ExtraTypes/Sun.p_o dist/build/Graphics/X11/ExtraTypes/XF86.p_o dist/build/Graphics/X11/ExtraTypes/XorgDefault.p_o dist/build/Graphics/X11/Xlib/Internal.p_o dist/build/cbits/fdset.p_o dist/build/cbits/auxiliaries.p_o dist/build/cbits/XUtils.p_o ar: creating archive dist/build/objs-34820/libHSX11-1.6.1.2-IWliEAOAW3jLTNM8XZxGwo_p.a /usr/local/bin/ghc -shared -dynamic -lXss -lXinerama -lX11 -lXrandr -lXext '-dynload deploy' -optl-Wl,-rpath,/Library/Frameworks/GHC.framework/Versions/7.10.3-x86_64/usr/lib/ghc-7.10.3/array_67iodizgJQIIxYVTp4emlA -optl-Wl,-rpath,/Library/Frameworks/GHC.framework/Versions/7.10.3-x86_64/usr/lib/ghc-7.10.3/base_HQfYBxpPvuw8OunzQu6JGM -optl-Wl,-rpath,/Library/Frameworks/GHC.framework/Versions/7.10.3-x86_64/usr/lib/ghc-7.10.3/rts -optl-Wl,-rpath,/Library/Frameworks/GHC.framework/Versions/7.10.3-x86_64/usr/lib/ghc-7.10.3/conta_2C3ZI8RgPO2LBMidXKTvIU -optl-Wl,-rpath,/Users/USER/Library/Haskell/ghc-7.10.3-x86_64/lib/data-default-0.5.3 -optl-Wl,-rpath,/Users/USER/Library/Haskell/ghc-7.10.3-x86_64/lib/data-default-class-0.0.1 -optl-Wl,-rpath,/Users/USER/Library/Haskell/ghc-7.10.3-x86_64/lib/data-default-instances-base-0.0.1 -optl-Wl,-rpath,/Users/USER/Library/Haskell/ghc-7.10.3-x86_64/lib/data-default-instances-containers-0.0.1 -optl-Wl,-rpath,/Users/USER/Library/Haskell/ghc-7.10.3-x86_64/lib/data-default-instances-dlist-0.0.1 -optl-Wl,-rpath,/Users/USER/Library/Haskell/ghc-7.10.3-x86_64/lib/data-default-instances-old-locale-0.0.1 -optl-Wl,-rpath,/Library/Frameworks/GHC.framework/Versions/7.10.3-x86_64/usr/lib/ghc-7.10.3/deeps_6vMKxt5sPFR0XsbRWvvq59 -optl-Wl,-rpath,/Users/USER/Library/Haskell/ghc-7.10.3-x86_64/lib/dlist-0.7.1.2 -optl-Wl,-rpath,/Library/Frameworks/GHC.framework/Versions/7.10.3-x86_64/usr/lib/ghc-7.10.3/ghcpr_8TmvWUcS1U1IKHT0levwg3 -optl-Wl,-rpath,/Library/Frameworks/GHC.framework/Versions/7.10.3-x86_64/usr/lib/ghc-7.10.3/integ_2aU3IZNMF9a7mQ0OzsZ0dS -optl-Wl,-rpath,/Library/Haskell/ghc-7.10.3-x86_64/lib/old-locale-1.0.0.7 -this-package-key X11_IWliEAOAW3jLTNM8XZxGwo -no-auto-link-packages -package-db dist/package.conf.inplace -package-id base-4.8.2.0-cc43d8e06aa74e9c4c0132becc49ee25 -package-id data-default-0.5.3-9dff3193f506bb1167ea34cbb11b90f2 dist/build/Graphics/X11.dyn_o dist/build/Graphics/X11/Types.dyn_o dist/build/Graphics/X11/Xlib.dyn_o dist/build/Graphics/X11/Xlib/Atom.dyn_o dist/build/Graphics/X11/Xlib/Color.dyn_o dist/build/Graphics/X11/Xlib/Context.dyn_o dist/build/Graphics/X11/Xlib/Cursor.dyn_o dist/build/Graphics/X11/Xlib/Display.dyn_o dist/build/Graphics/X11/Xlib/Event.dyn_o dist/build/Graphics/X11/Xlib/Font.dyn_o dist/build/Graphics/X11/Xlib/Misc.dyn_o dist/build/Graphics/X11/Xlib/Region.dyn_o dist/build/Graphics/X11/Xlib/Screen.dyn_o dist/build/Graphics/X11/Xlib/Types.dyn_o dist/build/Graphics/X11/Xlib/Window.dyn_o dist/build/Graphics/X11/Xlib/Image.dyn_o dist/build/Graphics/X11/Xlib/Extras.dyn_o dist/build/Graphics/X11/Xinerama.dyn_o dist/build/Graphics/X11/Xrandr.dyn_o dist/build/Graphics/X11/XScreenSaver.dyn_o dist/build/Graphics/X11/ExtraTypes.dyn_o dist/build/Graphics/X11/ExtraTypes/AP.dyn_o dist/build/Graphics/X11/ExtraTypes/DEC.dyn_o dist/build/Graphics/X11/ExtraTypes/HP.dyn_o dist/build/Graphics/X11/ExtraTypes/Sun.dyn_o dist/build/Graphics/X11/ExtraTypes/XF86.dyn_o dist/build/Graphics/X11/ExtraTypes/XorgDefault.dyn_o dist/build/Graphics/X11/Xlib/Internal.dyn_o dist/build/cbits/fdset.dyn_o dist/build/cbits/auxiliaries.dyn_o dist/build/cbits/XUtils.dyn_o -o dist/build/libHSX11-1.6.1.2-IWliEAOAW3jLTNM8XZxGwo-ghc7.10.3.dylib ld: library not found for -lXss clang: error: linker command failed with exit code 1 (use -v to see invocation) EOF From nawi at nawi.is Sun Feb 21 21:21:41 2016 From: nawi at nawi.is (Christoph R. Murauer) Date: Sun, 21 Feb 2016 22:21:41 +0100 Subject: [Haskell-beginners] Building xmonad / X11 fails on Mac OS X 10.11.3 El Capitan. In-Reply-To: References: Message-ID: <5ADDE43C-9B1B-4BA3-824C-B9FC843D14C4@nawi.is> Solved. Documented at the xmonad mailing list. From frederic-emmanuel.picca at synchrotron-soleil.fr Mon Feb 22 08:39:17 2016 From: frederic-emmanuel.picca at synchrotron-soleil.fr (PICCA Frederic-Emmanuel) Date: Mon, 22 Feb 2016 08:39:17 +0000 Subject: [Haskell-beginners] ODP: howto Pipe In-Reply-To: References: <56c5e758.905b190a.86e57.6734@mx.google.com> , Message-ID: > First of all, (StateT Diffractometer (Pipe Engine Geometry IO) ()) > isn't the same as (Pipe Engine Geometry (StateT Diffractometer IO) > ()), although I'm not sure what exactly the difference will be, as > I've never used it the former way. This might be again a question for > the Pipes mailing list. ok, I will investigate this part :) > Secondly: > > but now if I remove the get and put lines, I get the segfault. > Okay, I have no idea. As I see it, this shouldn't happen, as you're > getting and putting the same pointer all the time. What if you remove > the StateT altogether and just use the `dif` from the function > argument, are you still getting segfaults? Also what about writting > the function without using pipes, and using Pipes.mapM to make it a > pipe like I mentioned? (if the only Pipes operation you're doing are > an `await` in the beginning and a `yield` at the end, Pipes.mapM > covers it) Yes I get the segfault if I remove all the State Part and use directly the dif. I think that I have something like this , I need to connect the life of one foreignPtr to another one. This is why I put them all into the Diffractometer data. But it seems that this is not the magic bullet in order to garanty the same life time for all of these foreignPtr. I am wonderig if the fact that I use only one of the ForeignPtr in the solveTrajPipe function does not give a clu to haskell that he just need to keep a reference to the used one and get ride of the other one stored in dif. withDiffractometer :: Diffractometer -> (Ptr HklEngineList -> IO b) -> IO b withDiffractometer d fun = do let f_engines = difEngineList d withForeignPtr f_engines fun then I extract a pointer from the engines one but as I am using the withForeingPtr I think that it is ok. I would say that I am not yet a specialist of FFI and haskell, but I love this language a lot when I will manage this problem :)) solveTrajPipe' :: Diffractometer -> Pipe Engine Geometry IO () solveTrajPipe' dif = flip evalStateT dif $ forever $ do -- Inside here we are using `StateT Int (Consumer a IO) r` e <- lift await -- dif <- get let name = engineName e solutions <- lift . lift $ withDiffractometer dif $ \engines -> withCString name $ \cname -> do engine <- c_hkl_engine_list_engine_get_by_name engines cname nullPtr n <- c_hkl_engine_pseudo_axis_names_get engine >>= darrayStringLen solve' engine n e >>= getSolution0 -- put dif lift $ yield solutions Cheers Frederic Ps: just for fun I got this adding just a lift print :) :~/hkl/contrib/haskell$ cabal run Preprocessing executable 'ghkl' for hkl-0.1.0.0... [3 of 5] Compiling Hkl.C ( dist/build/ghkl/ghkl-tmp/Hkl/C.hs, dist/build/ghkl/ghkl-tmp/Hkl/C.p_o ) src/Hkl/C.hsc:125:3: Couldn't match kind `* -> *' with `*' Expected type: Diffractometer -> Proxy () Engine () Geometry IO () Actual type: Diffractometer -> Proxy () Engine () Geometry IO () Kind incompatibility when matching types: Diffractometer :: * -> * Diffractometer :: * The function `lift'ghc: panic! (the 'impossible' happened) (GHC version 7.6.3 for x86_64-unknown-linux): kindFunResult ghc-prim:GHC.Prim.*{(w) tc 34d} Please report this as a GHC bug: http://www.haskell.org/ghc/reportabug From dennis.raddle at gmail.com Mon Feb 22 08:40:53 2016 From: dennis.raddle at gmail.com (Dennis Raddle) Date: Mon, 22 Feb 2016 00:40:53 -0800 Subject: [Haskell-beginners] to avoid naming intermediate variables Message-ID: I recently realized one important reason Haskell is so compact---it provides structures that avoid the need to name intermediate variables. I guess it's obvious, but coming from an imperative background I didn't see this at first. I am starting to recognize situations where all the existing wonderful typeclasses assist in eliminating variables. Function composition is the simplest example. I sometimes write long chains of composed functions. In an imperative language with a less compact function call syntax, that would require so many parentheses that you would probably break it over several statements, then forcing you to use more variables. Then I realized that Arrows allow a little more flexibility when you have different numbers of arguments to feed, say when you split a single argument into two, or want to construct a function that applies to one argument and ignores the other. ...So I had to write something like this. compute :: [Int] -> [Int] -> [Int] -> [(Int,Int)] func :: [Int] -> [(Int,Int)] func xs = compute xs (filter isSmall xs) (filter isLarge xs) but I could also write compute :: ([Int],([Int],[Int])) -> [(Int,Int)] func = compute . (id &&& filter isSmall &&& filter isLarge) So I had to change the inputs to 'compute' into this kind of awkward tuple form, but I eliminated four 'xs', plus eliminated the need to come up with the name 'xs'. Can I get a comment on whether this makes sense as way to do things? D -------------- next part -------------- An HTML attachment was scrubbed... URL: From michael at orlitzky.com Mon Feb 22 15:17:48 2016 From: michael at orlitzky.com (Michael Orlitzky) Date: Mon, 22 Feb 2016 10:17:48 -0500 Subject: [Haskell-beginners] to avoid naming intermediate variables In-Reply-To: References: Message-ID: <56CB269C.7090605@orlitzky.com> On 02/22/2016 03:40 AM, Dennis Raddle wrote: > > ...So I had to write something like this. > > compute :: [Int] -> [Int] -> [Int] -> [(Int,Int)] > > func :: [Int] -> [(Int,Int)] > func xs = compute xs (filter isSmall xs) (filter isLarge xs) > > > but I could also write > > compute :: ([Int],([Int],[Int])) -> [(Int,Int)] > > func = compute . (id &&& filter isSmall &&& filter isLarge) > > So I had to change the inputs to 'compute' into this kind of awkward > tuple form, but I eliminated four 'xs', plus eliminated the need to come > up with the name 'xs'. > > Can I get a comment on whether this makes sense as way to do things? > It's pushing it. Once you've seen the trick with (&&&) it's tempting to use it. When I see (id &&& f &&& g), in my head I get a picture of some argument coming in and being split along three wires that get fed into id, f, and g simultaneously. The output from those three black-boxes then get fed into compute: ----f---- / \ compute <------g------<-- xs \ / ----id--- So while details with the nested tuple are ugly, what will happen is pretty clear to me. But how long did you have to play with the arrow combinators to make this work? If you-two-weeks-ago were to see that line, compute :: ([Int],([Int],[Int])) -> [(Int,Int)] func = compute . (id &&& filter isSmall &&& filter isLarge) how long would it have taken you to figure out what it did? How does it impact your documentation for the "compute" function? I imagine it was something like "takes a list of Ints, the small half of that list, and the large half of that list, and then computes something cool." Now it will be "takes a pair whose first component is a list of Ints, and the second component is a pair whose first component is a list of the small half of the list in the first component of the big pair, and..." It's hard to explain because it's weird to think about. In this case, the second and third arguments to compute can be... computed... from the first, so in practice I would do something like, compute_stuff :: [Int] -> [(Int,Int)] compute_stuff xs = compute xs small_xs big_xs where small_xs = filter isSmall xs big_xs = filter isLarge xs compute :: [Int] -> [Int] -> [Int] -> [(Int,Int)] compute = -- whatever it's supposed to do (Unrelated: it might make more sense to loop through "xs" once and return a pair of the small/large elements. That way you don't have to make two passes. Depends on the size of the list.) If you're just code golfing, you don't need to change the signature of the compute function. Hitting it with "uncurry" once makes it take a tuple, and hitting it with (uncurry . uncurry) makes it take a tuple whose first component is a tuple: -- oh god what have i done func :: [Int] -> [(Int, Int)] func = ((uncurry . uncurry) compute . ((id &&& filter isSmall) &&& filter isLarge)) From dennis.raddle at gmail.com Mon Feb 22 15:35:33 2016 From: dennis.raddle at gmail.com (Dennis Raddle) Date: Mon, 22 Feb 2016 07:35:33 -0800 Subject: [Haskell-beginners] to avoid naming intermediate variables In-Reply-To: <56CB269C.7090605@orlitzky.com> References: <56CB269C.7090605@orlitzky.com> Message-ID: Yeah, maybe I've been a little too enthusiastic about code golfing. I've noticed that haskell programs usually have short functions (compared to imperative languages). I love this---I love how when you get a function down to four or fewer lines, you can tell its structure in a glance. Yes, some Haskell structures can look confusing at first, but I find that with practice looking at them, they start to look natural. Like the way that your mind pictures &&& splitting the input---I'm sure you find that doesn't take any effort and feels like a common and natural pattern. It seems to work like that with much of Haskell. Oh, can I bring up one other intermediate variable elimination situation? I used to do things like func :: IO MyData func = do x <- readMyData return $ someProcessing x When I first encountered Monads, I was confused by functions that move things into Monads, like 'liftM'. But I am starting to see the light. I realized I could do func = someProcessing `liftM` readMyData Or func = readMyData >>= someProcessing I was explaining to a friend that Haskell's abstracted patterns seem confusing to me, coming from an imperative background. She only has a little experience programming, so I tried giving some analogies. Say you are an imperative programmer and you are do a physical simulation of automobiles. You see that they all have an engine, so you write some code that handles abstracted common features of engines. In Haskell, abstracted patterns are more like this--say you have a a forklift that manipulates boxes. say that's your "function." Then you write a function that produces a forklift that manipulates boxes that are inside trucks. In the imperative world, it's like "huh? where does that get you?" But it makes more sense now. D -------------- next part -------------- An HTML attachment was scrubbed... URL: From xiaonan830818 at gmail.com Wed Feb 24 10:31:49 2016 From: xiaonan830818 at gmail.com (Nan Xiao) Date: Wed, 24 Feb 2016 18:31:49 +0800 Subject: [Haskell-beginners] The (x:xs) in function parameter is a tuple? Message-ID: Hi all, Greetings from me! I am confused about the function parameters and tuple. E.g.: occurs value [] = 0 occurs value (x:xs) = (if value == x then 1 else 0) + occurs value xs should we consider (x:xs) as a tuple? Thanks in advance! Best Regards Nan Xiao From sumit.sahrawat.apm13 at iitbhu.ac.in Wed Feb 24 10:44:04 2016 From: sumit.sahrawat.apm13 at iitbhu.ac.in (Sumit Sahrawat, Maths & Computing, IIT (BHU)) Date: Wed, 24 Feb 2016 16:14:04 +0530 Subject: [Haskell-beginners] The (x:xs) in function parameter is a tuple? In-Reply-To: References: Message-ID: (:) is a constructor. For example, you can define lists as: data List a = Nil | Cons a (List a) GHC does some magic to provide us with the same definition, but with Nil replaced by [] and Cons replaced by (:). As constructors can be pattern matched on, you can also match on a (:), which is a data constructor. You might consider (x:xs) as a tuple, only if you're willing to consider (Cons x xs) as a tuple. It is a tuple (ordered collection of two values), but not a tuple according to their definition in haskell. What kind of tuple are you talking about? Hope this helps. Regards, Sumit On 24 February 2016 at 16:01, Nan Xiao wrote: > Hi all, > > Greetings from me! > > I am confused about the function parameters and tuple. E.g.: > > occurs value [] = 0 > occurs value (x:xs) = (if value == x then 1 else 0) + occurs value xs > > should we consider (x:xs) as a tuple? > > Thanks in advance! > > Best Regards > Nan Xiao > _______________________________________________ > Beginners mailing list > Beginners at haskell.org > http://mail.haskell.org/cgi-bin/mailman/listinfo/beginners > -------------- next part -------------- An HTML attachment was scrubbed... URL: From imantc at gmail.com Wed Feb 24 10:45:23 2016 From: imantc at gmail.com (Imants Cekusins) Date: Wed, 24 Feb 2016 11:45:23 +0100 Subject: [Haskell-beginners] The (x:xs) in function parameter is a tuple? In-Reply-To: References: Message-ID: Hello Xiao, (one_element) -- is evaluation (element,element,...) -- is tuple (1:[2]) -- [1,2] because it is one "array element" (1,2) -- is a tuple because there are 2 elements From rein.henrichs at gmail.com Wed Feb 24 18:24:06 2016 From: rein.henrichs at gmail.com (Rein Henrichs) Date: Wed, 24 Feb 2016 18:24:06 +0000 Subject: [Haskell-beginners] The (x:xs) in function parameter is a tuple? In-Reply-To: References: Message-ID: A tuple can have any number of elements. (1,2) is a 2-tuple. (1,2,3) is a 3-tuple. (x:xs) and (x,y) are differently typed: xs must be a list of the type of x, while y can be any type. (x:xs) is not a tuple. It is a list by definition. On Wed, Feb 24, 2016 at 2:45 AM Imants Cekusins wrote: > Hello Xiao, > > (one_element) -- is evaluation > (element,element,...) -- is tuple > > (1:[2]) -- [1,2] because it is one "array element" > (1,2) -- is a tuple because there are 2 elements > _______________________________________________ > Beginners mailing list > Beginners at haskell.org > http://mail.haskell.org/cgi-bin/mailman/listinfo/beginners > -------------- next part -------------- An HTML attachment was scrubbed... URL: From math.simplex at gmail.com Wed Feb 24 18:37:08 2016 From: math.simplex at gmail.com (Graham Gill) Date: Wed, 24 Feb 2016 13:37:08 -0500 Subject: [Haskell-beginners] The (x:xs) in function parameter is a tuple? In-Reply-To: References: Message-ID: <56CDF854.7070508@gmail.com> Hi Nan, are you just confused about the use of the parentheses "(" and ")"? (x1,x2), (x1,x2,x3), ... are tuples in Haskell, but (x:xs) is not. (There's no "one-ple", or 1-tuple, in Haskell.) In occurs value [] = 0 occurs value (x:xs) = (if value == x then 1 else 0) + occurs value xs the "(" and ")" around "x:xs" are just there for grouping, for operator precedence reasons. Function application binds more tightly than ":". If you leave the parentheses off, such as in occurs value x:xs = ... you'll get a parse error. Graham On 2/24/2016 5:31 AM, Nan Xiao wrote: > Hi all, > > Greetings from me! > > I am confused about the function parameters and tuple. E.g.: > > occurs value [] = 0 > occurs value (x:xs) = (if value == x then 1 else 0) + occurs value xs > > should we consider (x:xs) as a tuple? > > Thanks in advance! > > Best Regards > Nan Xiao > _______________________________________________ > Beginners mailing list > Beginners at haskell.org > http://mail.haskell.org/cgi-bin/mailman/listinfo/beginners From maydwell at gmail.com Wed Feb 24 21:07:04 2016 From: maydwell at gmail.com (Lyndon Maydwell) Date: Thu, 25 Feb 2016 08:07:04 +1100 Subject: [Haskell-beginners] Stack minimal dependency specification, or dependency tree output Message-ID: Hi Beginners, I'm finally getting my hands dirty with Stack, and am using it in conjunction with Docker, but not with the built-in docker functionality. My Dockerfile is constructed so that it first installs a whole bunch of dependencies globally, like so: ... RUN stack install HUnit ... Then after that, installs the project: ... COPY . /app WORKDIR /app RUN stack install ... This means that on repeated docker builds the app build and install time should be limited to just the application itself, because the dependency builds were cached. Which is great! However, I'm currently generating the list of dependencies just by looking at the output of the stack build of the app, and this displays everything as a flat list. I'd like to see some kind of tree instead, so that when I pre-install the dependencies, I can specify a minimal list, rather than a whole slew of dependencies that would be pulled in transitively anyway. Is there an easy way to do this? Regards, - Lyndon -------------- next part -------------- An HTML attachment was scrubbed... URL: From mark.fine at gmail.com Wed Feb 24 22:04:19 2016 From: mark.fine at gmail.com (Mark Fine) Date: Wed, 24 Feb 2016 14:04:19 -0800 Subject: [Haskell-beginners] Stack minimal dependency specification, or dependency tree output In-Reply-To: References: Message-ID: You can ask stack to build only dependencies and use that as a cache layer for docker. We do something like: FROM haskell:7.10 WORKDIR /app COPY LICENSE Setup.hs simple-app.cabal stack.yaml /app/ RUN stack setup RUN stack build simple-app --only-dependencies COPY main /app/main COPY src /app/src RUN stack build simple-app --copy-bins On Wed, Feb 24, 2016 at 1:07 PM, Lyndon Maydwell wrote: > Hi Beginners, > > > I'm finally getting my hands dirty with Stack, and am using it in > conjunction with Docker, but not with the built-in docker functionality. > > My Dockerfile is constructed so that it first installs a whole bunch of > dependencies globally, like so: > > ... > RUN stack install HUnit > ... > > Then after that, installs the project: > > ... > COPY . /app > WORKDIR /app > RUN stack install > ... > > This means that on repeated docker builds the app build and install time > should be limited to just the application itself, because the dependency > builds were cached. Which is great! However, I'm currently generating the > list of dependencies just by looking at the output of the stack build of > the app, and this displays everything as a flat list. > > I'd like to see some kind of tree instead, so that when I pre-install the > dependencies, I can specify a minimal list, rather than a whole slew of > dependencies that would be pulled in transitively anyway. > > Is there an easy way to do this? > > > Regards, > > - Lyndon > > > _______________________________________________ > Beginners mailing list > Beginners at haskell.org > http://mail.haskell.org/cgi-bin/mailman/listinfo/beginners > > -------------- next part -------------- An HTML attachment was scrubbed... URL: From maydwell at gmail.com Wed Feb 24 22:10:30 2016 From: maydwell at gmail.com (Lyndon Maydwell) Date: Thu, 25 Feb 2016 09:10:30 +1100 Subject: [Haskell-beginners] Stack minimal dependency specification, or dependency tree output In-Reply-To: References: Message-ID: Hi Mark, That would be great, and I have tried that, but there is one issue that caused me to take the current approach instead. The issue is that every change to * Setup.hs * simple-app.cabal * stack.yaml will cause the docker to consider the copy statement > COPY LICENSE Setup.hs simple-app.cabal stack.yaml /app/ as a fresh checkpoint, and make the cache unusable. Since I've frequently changing stack.yaml, and app.cabal, this won't help me much. Not sure if there's a way around that with this method. Let me know if I've overlooked something with your approach! - Lyndon On Thu, Feb 25, 2016 at 9:04 AM, Mark Fine wrote: > You can ask stack to build only dependencies and use that as a cache layer > for docker. We do something like: > > FROM haskell:7.10 > > WORKDIR /app > > COPY LICENSE Setup.hs simple-app.cabal stack.yaml /app/ > RUN stack setup > RUN stack build simple-app --only-dependencies > > COPY main /app/main > COPY src /app/src > RUN stack build simple-app --copy-bins > > > On Wed, Feb 24, 2016 at 1:07 PM, Lyndon Maydwell > wrote: > >> Hi Beginners, >> >> >> I'm finally getting my hands dirty with Stack, and am using it in >> conjunction with Docker, but not with the built-in docker functionality. >> >> My Dockerfile is constructed so that it first installs a whole bunch of >> dependencies globally, like so: >> >> ... >> RUN stack install HUnit >> ... >> >> Then after that, installs the project: >> >> ... >> COPY . /app >> WORKDIR /app >> RUN stack install >> ... >> >> This means that on repeated docker builds the app build and install time >> should be limited to just the application itself, because the dependency >> builds were cached. Which is great! However, I'm currently generating the >> list of dependencies just by looking at the output of the stack build of >> the app, and this displays everything as a flat list. >> >> I'd like to see some kind of tree instead, so that when I pre-install the >> dependencies, I can specify a minimal list, rather than a whole slew of >> dependencies that would be pulled in transitively anyway. >> >> Is there an easy way to do this? >> >> >> Regards, >> >> - Lyndon >> >> >> _______________________________________________ >> 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: From bayesragem at gmail.com Wed Feb 24 22:28:52 2016 From: bayesragem at gmail.com (Josh Barney) Date: Wed, 24 Feb 2016 17:28:52 -0500 Subject: [Haskell-beginners] Stack minimal dependency specification, or dependency tree output In-Reply-To: References: Message-ID: <7DCDE7B1-89F6-471E-9327-F4DACAC290DF@gmail.com> > On Feb 24, 2016, at 5:10 PM, Lyndon Maydwell wrote: > > Hi Mark, > > > That would be great, and I have tried that, but there is one issue that caused me to take the current approach instead. > > The issue is that every change to > > * Setup.hs > * simple-app.cabal > * stack.yaml > > will cause the docker to consider the copy statement > > > COPY LICENSE Setup.hs simple-app.cabal stack.yaml /app/ > > as a fresh checkpoint, and make the cache unusable. Since I've frequently changing stack.yaml, and app.cabal, this won't help me much. > > Not sure if there's a way around that with this method. > > Let me know if I've overlooked something with your approach! > > > - Lyndon >> I have found that it works well to use a dummy file that does not change in order to set up a cache. You can then copy over the real file; preserving the cached docker layer. Josh From maydwell at gmail.com Wed Feb 24 22:33:06 2016 From: maydwell at gmail.com (Lyndon Maydwell) Date: Thu, 25 Feb 2016 09:33:06 +1100 Subject: [Haskell-beginners] Stack minimal dependency specification, or dependency tree output In-Reply-To: <7DCDE7B1-89F6-471E-9327-F4DACAC290DF@gmail.com> References: <7DCDE7B1-89F6-471E-9327-F4DACAC290DF@gmail.com> Message-ID: Awesome! I'll give that a go. Thanks, - Lyndon On Thu, Feb 25, 2016 at 9:28 AM, Josh Barney wrote: > > > > On Feb 24, 2016, at 5:10 PM, Lyndon Maydwell wrote: > > > > Hi Mark, > > > > > > That would be great, and I have tried that, but there is one issue that > caused me to take the current approach instead. > > > > The issue is that every change to > > > > * Setup.hs > > * simple-app.cabal > > * stack.yaml > > > > will cause the docker to consider the copy statement > > > > > COPY LICENSE Setup.hs simple-app.cabal stack.yaml /app/ > > > > as a fresh checkpoint, and make the cache unusable. Since I've > frequently changing stack.yaml, and app.cabal, this won't help me much. > > > > Not sure if there's a way around that with this method. > > > > Let me know if I've overlooked something with your approach! > > > > > > - Lyndon > >> > > I have found that it works well to use a dummy file that does not change > in order to set up a cache. You can then copy over the real file; > preserving the cached docker layer. > > Josh > _______________________________________________ > Beginners mailing list > Beginners at haskell.org > http://mail.haskell.org/cgi-bin/mailman/listinfo/beginners > -------------- next part -------------- An HTML attachment was scrubbed... URL: From simon.jakobi at googlemail.com Wed Feb 24 22:55:49 2016 From: simon.jakobi at googlemail.com (Simon Jakobi) Date: Wed, 24 Feb 2016 23:55:49 +0100 Subject: [Haskell-beginners] Stack minimal dependency specification, or dependency tree output In-Reply-To: References: Message-ID: Hi Lyndon, I'd like to see some kind of tree instead, so that when I pre-install the > dependencies, I can specify a minimal list, rather than a whole slew of > dependencies that would be pulled in transitively anyway. There's "stack list-dependencies" but that includes the transitive dependencies. You can get the dependency tree (or rather dependency graph) with "stack dot --external" "stack dot --external --depth 0" will show only the direct dependencies of your project. More stack dot examples: http://docs.haskellstack.org/en/stable/dependency_visualization/ Cheers, Simon -------------- next part -------------- An HTML attachment was scrubbed... URL: From xiaonan830818 at gmail.com Wed Feb 24 23:49:56 2016 From: xiaonan830818 at gmail.com (Nan Xiao) Date: Thu, 25 Feb 2016 07:49:56 +0800 Subject: [Haskell-beginners] The (x:xs) in function parameter is a tuple? In-Reply-To: <56CDF854.7070508@gmail.com> References: <56CDF854.7070508@gmail.com> Message-ID: Hi all, Firstly, thanks very much for all responses! Rein referred "A tuple can have any number of elements", while Graham referred "There's no "one-ple", or 1-tuple, in Haskell.". So which one is right? The tuple at least contains 2 elements? Thanks very much in advance! Best Regards Nan Xiao On Thu, Feb 25, 2016 at 2:37 AM, Graham Gill wrote: > Hi Nan, are you just confused about the use of the parentheses "(" and ")"? > > (x1,x2), (x1,x2,x3), ... are tuples in Haskell, but (x:xs) is not. (There's > no "one-ple", or 1-tuple, in Haskell.) In > > occurs value [] = 0 > occurs value (x:xs) = (if value == x then 1 else 0) + occurs value xs > > the "(" and ")" around "x:xs" are just there for grouping, for operator > precedence reasons. Function application binds more tightly than ":". If you > leave the parentheses off, such as in > > occurs value x:xs = ... > > you'll get a parse error. > > Graham > > > > On 2/24/2016 5:31 AM, Nan Xiao wrote: >> >> Hi all, >> >> Greetings from me! >> >> I am confused about the function parameters and tuple. E.g.: >> >> occurs value [] = 0 >> occurs value (x:xs) = (if value == x then 1 else 0) + occurs value xs >> >> should we consider (x:xs) as a tuple? >> >> Thanks in advance! >> >> Best Regards >> Nan Xiao >> _______________________________________________ >> 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 From maydwell at gmail.com Wed Feb 24 23:58:14 2016 From: maydwell at gmail.com (Lyndon Maydwell) Date: Thu, 25 Feb 2016 10:58:14 +1100 Subject: [Haskell-beginners] Stack minimal dependency specification, or dependency tree output In-Reply-To: References: Message-ID: Hi Simon, > stack dot --external --depth 0 That's exactly what I was first looking for! Cheers :) - Lyndon On Thu, Feb 25, 2016 at 9:55 AM, Simon Jakobi wrote: > Hi Lyndon, > > I'd like to see some kind of tree instead, so that when I pre-install the >> dependencies, I can specify a minimal list, rather than a whole slew of >> dependencies that would be pulled in transitively anyway. > > > There's "stack list-dependencies" but that includes the transitive > dependencies. > > You can get the dependency tree (or rather dependency graph) with "stack > dot --external" > > "stack dot --external --depth 0" will show only the direct dependencies of > your project. > > More stack dot examples: > http://docs.haskellstack.org/en/stable/dependency_visualization/ > > Cheers, > Simon > > > > _______________________________________________ > Beginners mailing list > Beginners at haskell.org > http://mail.haskell.org/cgi-bin/mailman/listinfo/beginners > > -------------- next part -------------- An HTML attachment was scrubbed... URL: From imantc at gmail.com Thu Feb 25 00:02:02 2016 From: imantc at gmail.com (Imants Cekusins) Date: Thu, 25 Feb 2016 01:02:02 +0100 Subject: [Haskell-beginners] The (x:xs) in function parameter is a tuple? In-Reply-To: References: <56CDF854.7070508@gmail.com> Message-ID: My guess is: tuple must contain 2+ elements. Try to enter (1) in ghci. It is displayed as 1 Parentheses are only recognized as a tuple if there are elements separated by a comma. Otherwise an expression is assumed. -------------- next part -------------- An HTML attachment was scrubbed... URL: From dennis.raddle at gmail.com Thu Feb 25 00:03:10 2016 From: dennis.raddle at gmail.com (Dennis Raddle) Date: Wed, 24 Feb 2016 16:03:10 -0800 Subject: [Haskell-beginners] general observation about programming Message-ID: This is more about programming in general than Haskell, although Haskellers probably know it well. I don't claim to have expert knowledge on this, but I'm gradually getting better at it. When I set out to write a program, or refactor a program, or modify a program, it helps to set out my thinking in a clear way. And how I make it clear is to document my thoughts. An outline is one good way to organize thoughts and is probably my main tool. But good English prose is also helpful. The key factor is "editing." In what sense do I mean that? Good writers do it, and the Haskell documentation does it. I mean (1) brevity and (2) good flow. To achieve brevity, you must think about the essence of each statement and trim away the unnecessary stuff. Good flow refers to how the document builds up and modifies your concepts as you read it. A document can actually mirror an effective learning process, or influence and change your process. I work with my documentation, making several editing passes. By the time I'm done, I am in a great position to write a concise and flexible program. It's interesting that not only is Haskell a concise language, but the Haskell library documentation is concise. Contrast that with the Python documentation which often wanders about into areas that are irrelevant--it could easily be cut into one third its present size. Mike -------------- next part -------------- An HTML attachment was scrubbed... URL: From bayesragem at gmail.com Thu Feb 25 04:35:02 2016 From: bayesragem at gmail.com (Josh Barney) Date: Wed, 24 Feb 2016 23:35:02 -0500 Subject: [Haskell-beginners] The (x:xs) in function parameter is a tuple? In-Reply-To: References: <56CDF854.7070508@gmail.com> Message-ID: The way I learned it: A tuple type is defined by the types inside it, so an (int,int) is not the same type as an (int, maybe(int)). With a one-tuple the type would just be (int) and that provides zero benefit. Instead of trying to do `first (...my expression...)` to get the first element of the one tuple, it just becomes the value inside. Sent from my iPhone > On Feb 24, 2016, at 7:02 PM, Imants Cekusins wrote: > > My guess is: tuple must contain 2+ elements. > > Try to enter (1) in ghci. It is displayed as 1 > > Parentheses are only recognized as a tuple if there are elements separated by a comma. Otherwise an expression is assumed. > > _______________________________________________ > Beginners mailing list > Beginners at haskell.org > http://mail.haskell.org/cgi-bin/mailman/listinfo/beginners -------------- next part -------------- An HTML attachment was scrubbed... URL: From max.voit+mlhb at with-eyes.net Thu Feb 25 15:14:05 2016 From: max.voit+mlhb at with-eyes.net (Max Voit) Date: Thu, 25 Feb 2016 16:14:05 +0100 Subject: [Haskell-beginners] The (x:xs) in function parameter is a tuple? In-Reply-To: References: <56CDF854.7070508@gmail.com> Message-ID: <20160225161405.2a40aec8@veeloqu.lan> On Thu, 25 Feb 2016 07:49:56 +0800 Nan Xiao wrote: > Rein referred "A tuple can have any number of elements", while Graham > referred "There's no "one-ple", or 1-tuple, in Haskell.". So which one > is right? The tuple at least contains 2 elements? There is no one-tuple; however, there's a zero-tuple. Also no arbitrary number of tuple elements allowed, due to definition (we're at 61 for some reason). Refer to http://hackage.haskell.org/package/ghc-prim-0.4.0.0/docs/GHC-Tuple.html best, Max From dbrooks at runforyourlife.org Thu Feb 25 16:17:45 2016 From: dbrooks at runforyourlife.org (Dudley Brooks) Date: Thu, 25 Feb 2016 08:17:45 -0800 Subject: [Haskell-beginners] general observation about programming In-Reply-To: References: Message-ID: <56CF2929.10600@runforyourlife.org> Ages and ages ago I saw this advice about programming: Q: "What's the best language for a programmer to know?" A: "English" (or whatever your native language is) -- Dudley On 2/24/16 4:03 PM, Dennis Raddle wrote: > This is more about programming in general than Haskell, although > Haskellers probably know it well. > > I don't claim to have expert knowledge on this, but I'm gradually > getting better at it. > > When I set out to write a program, or refactor a program, or modify a > program, it helps to set out my thinking in a clear way. And how I > make it clear is to document my thoughts. > > An outline is one good way to organize thoughts and is probably my > main tool. But good English prose is also helpful. > > The key factor is "editing." In what sense do I mean that? Good > writers do it, and the Haskell documentation does it. I mean (1) > brevity and (2) good flow. To achieve brevity, you must think about > the essence of each statement and trim away the unnecessary stuff. > Good flow refers to how the document builds up and modifies your > concepts as you read it. A document can actually mirror an effective > learning process, or influence and change your process. > > I work with my documentation, making several editing passes. By the > time I'm done, I am in a great position to write a concise and > flexible program. > > It's interesting that not only is Haskell a concise language, but the > Haskell library documentation is concise. Contrast that with the > Python documentation which often wanders about into areas that are > irrelevant--it could easily be cut into one third its present size. > > Mike > > > > > _______________________________________________ > Beginners mailing list > Beginners at haskell.org > http://mail.haskell.org/cgi-bin/mailman/listinfo/beginners -------------- next part -------------- An HTML attachment was scrubbed... URL: From mike_k_houghton at yahoo.co.uk Thu Feb 25 18:41:20 2016 From: mike_k_houghton at yahoo.co.uk (Mike Houghton) Date: Thu, 25 Feb 2016 18:41:20 +0000 Subject: [Haskell-beginners] Folders and sub-folders Message-ID: <95C6683E-A31F-4EAC-8C7E-73FDB1F942B9@yahoo.co.uk> Hi, I?m trying to build up a list of all folders (including subfolders) from a given root folder. So I have folders :: FilePath -> IO [FilePath] folders fp = do all <- getDirectoryContents fp filterM doesDirectoryExist $ map (fp ) all and this just gets the immediate folders within the given folder. I?m stuck on how to recursively call folders and build up the IO [FilePath] folders :: FilePath -> IO [FilePath] folders fp = do all <- getDirectoryContents fp -- z :: IO [FilePath] let z = filterM doesDirectoryExist $ map (fp ) all ? z? :: [FilePath] z' <- z ? ?? what should happen here? z : (map folders z?) Couldn't match expected type ?[FilePath]? with actual type ?IO [FilePath]? In the first argument of ?(:)?, namely ?z? In a stmt of a 'do' block: z : (map folders z') etc... Thanks Mike -------------- next part -------------- An HTML attachment was scrubbed... URL: From imantc at gmail.com Thu Feb 25 19:07:37 2016 From: imantc at gmail.com (Imants Cekusins) Date: Thu, 25 Feb 2016 20:07:37 +0100 Subject: [Haskell-beginners] Folders and sub-folders In-Reply-To: <95C6683E-A31F-4EAC-8C7E-73FDB1F942B9@yahoo.co.uk> References: <95C6683E-A31F-4EAC-8C7E-73FDB1F942B9@yahoo.co.uk> Message-ID: Hello Mike, below code find all files recursively from a starting point. It works. You'd need to tweak it to find folders instead. import System.Directory import Data.List findAllFiles::FilePath -> IO [FilePath] findAllFiles base0 = gd1 base0 >>= \list1 -> concatMap' recurse3 list1 where gd1 d1 = filter f2 <$> (getDirectoryContents d1) f2 "." = False f2 ".." = False f2 _ = True recurse3 md3 = doesDirectoryExist md3full >>= \isDir3 -> if isDir3 then findAllFiles md3full else pure [md3full] where md3full = base0 ++ "/" ++ md3 concatMap':: (a -> IO [b]) -> [a] -> IO [b] concatMap' m0 list0 = sequence (m0 <$> list0) >>= \list2 -> pure $ concat list2 From jeffbrown.the at gmail.com Thu Feb 25 19:19:24 2016 From: jeffbrown.the at gmail.com (Jeffrey Brown) Date: Thu, 25 Feb 2016 11:19:24 -0800 Subject: [Haskell-beginners] general observation about programming In-Reply-To: <56CF2929.10600@runforyourlife.org> References: <56CF2929.10600@runforyourlife.org> Message-ID: Something I like about functional programming is how it interfaces with natural language. Haskell, somehow to a greater extent than other languages, encourages me to divide functions into one or two-liners. Each has a type signature that means something in English. Further, each gives you the opportunity to choose a good name for the function and its arguments. After doing those things, the function is much easier to write, and much easier to read -- so much so that often you don't have to read the function body at all, just the type signature, function name and argument names. On Thu, Feb 25, 2016 at 8:17 AM, Dudley Brooks wrote: > Ages and ages ago I saw this advice about programming: > > Q: "What's the best language for a programmer to know?" > > A: "English" (or whatever your native language is) > > -- Dudley > > > On 2/24/16 4:03 PM, Dennis Raddle wrote: > > This is more about programming in general than Haskell, although > Haskellers probably know it well. > > I don't claim to have expert knowledge on this, but I'm gradually getting > better at it. > > When I set out to write a program, or refactor a program, or modify a > program, it helps to set out my thinking in a clear way. And how I make it > clear is to document my thoughts. > > An outline is one good way to organize thoughts and is probably my main > tool. But good English prose is also helpful. > > The key factor is "editing." In what sense do I mean that? Good writers do > it, and the Haskell documentation does it. I mean (1) brevity and (2) good > flow. To achieve brevity, you must think about the essence of each > statement and trim away the unnecessary stuff. Good flow refers to how the > document builds up and modifies your concepts as you read it. A document > can actually mirror an effective learning process, or influence and change > your process. > > I work with my documentation, making several editing passes. By the time > I'm done, I am in a great position to write a concise and flexible program. > > It's interesting that not only is Haskell a concise language, but the > Haskell library documentation is concise. Contrast that with the Python > documentation which often wanders about into areas that are irrelevant--it > could easily be cut into one third its present size. > > Mike > > > > > _______________________________________________ > Beginners mailing listBeginners at haskell.orghttp://mail.haskell.org/cgi-bin/mailman/listinfo/beginners > > > > _______________________________________________ > Beginners mailing list > Beginners at haskell.org > http://mail.haskell.org/cgi-bin/mailman/listinfo/beginners > > -- Jeffrey Benjamin Brown -------------- next part -------------- An HTML attachment was scrubbed... URL: From rein.henrichs at gmail.com Thu Feb 25 22:43:53 2016 From: rein.henrichs at gmail.com (Rein Henrichs) Date: Thu, 25 Feb 2016 22:43:53 +0000 Subject: [Haskell-beginners] The (x:xs) in function parameter is a tuple? In-Reply-To: <20160225161405.2a40aec8@veeloqu.lan> References: <56CDF854.7070508@gmail.com> <20160225161405.2a40aec8@veeloqu.lan> Message-ID: Nan, generally speaking (e.g., in maths) tuples can contain any number of elements. Haskell specifically disallows one-tuples because of the ambiguity in parsing them. Instead, (expr) is just evaluated as expr. On the other hand, it does allow (), which is a zero-tuple. Haskell's compilers also impose an upper bound on the practical size of a tuple (for modern GHC, that's 61, as Max mentioned) but that isn't a restriction of the Haskell language itself. If you want, you can consider Identity a to be a one-tuple, but it obviously doesn't use tuple syntax. As a side note, a 1-tuple is occasionally called a monad in other disciplines, while a monad is actually defined as a triple (a three-tuple) in maths. None of that is relevant to Haskell though. On Thu, Feb 25, 2016 at 7:14 AM Max Voit wrote: > On Thu, 25 Feb 2016 07:49:56 +0800 > Nan Xiao wrote: > > > Rein referred "A tuple can have any number of elements", while Graham > > referred "There's no "one-ple", or 1-tuple, in Haskell.". So which one > > is right? The tuple at least contains 2 elements? > > There is no one-tuple; however, there's a zero-tuple. Also no arbitrary > number of tuple elements allowed, due to definition (we're at 61 for > some reason). Refer to > > http://hackage.haskell.org/package/ghc-prim-0.4.0.0/docs/GHC-Tuple.html > > best, Max > _______________________________________________ > Beginners mailing list > Beginners at haskell.org > http://mail.haskell.org/cgi-bin/mailman/listinfo/beginners > -------------- next part -------------- An HTML attachment was scrubbed... URL: From mike.pentney at physics.org Fri Feb 26 09:55:22 2016 From: mike.pentney at physics.org (Mike Pentney) Date: Fri, 26 Feb 2016 09:55:22 +0000 Subject: [Haskell-beginners] general observation about programming In-Reply-To: References: <56CF2929.10600@runforyourlife.org> Message-ID: <56D0210A.30301@physics.org> As a newbie, something I dislike about Haskell is the use of infix operators like <||> which are unpronouncable and therefore (if you don't happen to know the notation the symbol is based on) are more or less meaningless. And Haskellers often seem to prefer 1 and 2 character variable names, which again convey little or no information. And don't get me started on point-free code...! N.B. I am not trying to start a flame war, these are just comments from my experience of trying to get beyond text-book examples and start using Haskell libraries and trying to learn from open source code. In general I find idiomatic Haskell hard to understand, and for me this is a barrier to using Haskell for real projects. Maybe someday I'll have learnt enough to get past this problem, but as the language and libraries seem to evolve quickly, I have my doubts... On 25/02/16 19:19, Jeffrey Brown wrote: > Something I like about functional programming is how it interfaces with natural language. > Haskell, somehow to a greater extent than other languages, encourages me to divide functions > into one or two-liners. Each has a type signature that means something in English. Further, each > gives you the opportunity to choose a good name for the function and its arguments. After doing > those things, the function is much easier to write, and much easier to read -- so much so that > often you don't have to read the function body at all, just the type signature, function name > and argument names. > > On Thu, Feb 25, 2016 at 8:17 AM, Dudley Brooks > wrote: > > Ages and ages ago I saw this advice about programming: > > Q: "What's the best language for a programmer to know?" > > A: "English" (or whatever your native language is) > > -- Dudley > > > On 2/24/16 4:03 PM, Dennis Raddle wrote: > >> This is more about programming in general than Haskell, although Haskellers probably know >> it well. >> >> I don't claim to have expert knowledge on this, but I'm gradually getting better at it. >> >> When I set out to write a program, or refactor a program, or modify a program, it helps to >> set out my thinking in a clear way. And how I make it clear is to document my thoughts. >> >> An outline is one good way to organize thoughts and is probably my main tool. But good >> English prose is also helpful. >> >> The key factor is "editing." In what sense do I mean that? Good writers do it, and the >> Haskell documentation does it. I mean (1) brevity and (2) good flow. To achieve brevity, >> you must think about the essence of each statement and trim away the unnecessary stuff. >> Good flow refers to how the document builds up and modifies your concepts as you read it. >> A document can actually mirror an effective learning process, or influence and change your >> process. >> >> I work with my documentation, making several editing passes. By the time I'm done, I am in >> a great position to write a concise and flexible program. >> >> It's interesting that not only is Haskell a concise language, but the Haskell library >> documentation is concise. Contrast that with the Python documentation which often wanders >> about into areas that are irrelevant--it could easily be cut into one third its present size. >> >> 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 > > > > > -- > Jeffrey Benjamin Brown > > > _______________________________________________ > Beginners mailing list > Beginners at haskell.org > http://mail.haskell.org/cgi-bin/mailman/listinfo/beginners > From mike_k_houghton at yahoo.co.uk Fri Feb 26 10:42:07 2016 From: mike_k_houghton at yahoo.co.uk (Mike Houghton) Date: Fri, 26 Feb 2016 10:42:07 +0000 Subject: [Haskell-beginners] Folders and sub-folders In-Reply-To: References: <95C6683E-A31F-4EAC-8C7E-73FDB1F942B9@yahoo.co.uk> Message-ID: <826550DC-D6C8-401E-8B53-A9D4D4781B6C@yahoo.co.uk> Thanks. I sweated it bit more and got isOk FilePath -> Bool isOk = not . isPrefixOf "." folders :: FilePath -> IO [FilePath] folders fp = do all <- getDirectoryContents fp z' <- filterM doesDirectoryExist $ map (fp ) (filter isOk all) x' <- mapM (\x -> folders x) z' return $ z' ++ (concat x') :: which seems to work. > On 25 Feb 2016, at 19:07, Imants Cekusins wrote: > > Hello Mike, > > below code find all files recursively from a starting point. It works. > > You'd need to tweak it to find folders instead. > > > import System.Directory > import Data.List > > > findAllFiles::FilePath -> IO [FilePath] > findAllFiles base0 = gd1 base0 >>> = \list1 -> concatMap' recurse3 list1 > where gd1 d1 = filter f2 <$> (getDirectoryContents d1) > f2 "." = False > f2 ".." = False > f2 _ = True > recurse3 md3 = doesDirectoryExist md3full >>> = \isDir3 -> > if isDir3 then findAllFiles md3full > else pure [md3full] > where md3full = base0 ++ "/" ++ md3 > > > > concatMap':: (a -> IO [b]) -> [a] -> IO [b] > concatMap' m0 list0 = sequence (m0 <$> list0) >>> = \list2 -> pure $ concat list2 > _______________________________________________ > Beginners mailing list > Beginners at haskell.org > http://mail.haskell.org/cgi-bin/mailman/listinfo/beginners From hsyl20 at gmail.com Fri Feb 26 13:01:43 2016 From: hsyl20 at gmail.com (Sylvain Henry) Date: Fri, 26 Feb 2016 14:01:43 +0100 Subject: [Haskell-beginners] Folders and sub-folders In-Reply-To: <826550DC-D6C8-401E-8B53-A9D4D4781B6C@yahoo.co.uk> References: <95C6683E-A31F-4EAC-8C7E-73FDB1F942B9@yahoo.co.uk> <826550DC-D6C8-401E-8B53-A9D4D4781B6C@yahoo.co.uk> Message-ID: Your "isOk" function will filter out hidden directories on Unix (which may be what you want?). Otherwise: isOk = (`notElem` [".",".."]) Also "\x -> folders x" = "folders" 2016-02-26 11:42 GMT+01:00 Mike Houghton : > Thanks. > > > I sweated it bit more and got > > > > isOk FilePath -> Bool > isOk = not . isPrefixOf "." > > folders :: FilePath -> IO [FilePath] > folders fp = do > all <- getDirectoryContents fp > z' <- filterM doesDirectoryExist $ map (fp ) (filter isOk all) > x' <- mapM (\x -> folders x) z' > return $ z' ++ (concat x') :: > > which seems to work. > > > > On 25 Feb 2016, at 19:07, Imants Cekusins wrote: > > > > Hello Mike, > > > > below code find all files recursively from a starting point. It works. > > > > You'd need to tweak it to find folders instead. > > > > > > import System.Directory > > import Data.List > > > > > > findAllFiles::FilePath -> IO [FilePath] > > findAllFiles base0 = gd1 base0 > >>> = \list1 -> concatMap' recurse3 list1 > > where gd1 d1 = filter f2 <$> (getDirectoryContents d1) > > f2 "." = False > > f2 ".." = False > > f2 _ = True > > recurse3 md3 = doesDirectoryExist md3full > >>> = \isDir3 -> > > if isDir3 then findAllFiles md3full > > else pure [md3full] > > where md3full = base0 ++ "/" ++ md3 > > > > > > > > concatMap':: (a -> IO [b]) -> [a] -> IO [b] > > concatMap' m0 list0 = sequence (m0 <$> list0) > >>> = \list2 -> pure $ concat list2 > > _______________________________________________ > > 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: From driemer.riemer at gmail.com Fri Feb 26 14:56:35 2016 From: driemer.riemer at gmail.com (driemer.riemer at gmail.com) Date: Fri, 26 Feb 2016 07:56:35 -0700 Subject: [Haskell-beginners] general observation about programming In-Reply-To: <56D0210A.30301@physics.org> References: <56CF2929.10600@runforyourlife.org> <56D0210A.30301@physics.org> Message-ID: <90958F7A-C5B1-4CB1-B3E5-DE268C929BFC@gmail.com> Sure what is your availability? Sent from my iPhone Please disregard errors as this is a smaller device. > On Feb 26, 2016, at 02:55, Mike Pentney wrote: > > As a newbie, something I dislike about Haskell is the use of infix operators like <||> which are unpronouncable and therefore (if you don't happen to know the notation the symbol is based on) are more or less meaningless. > > And Haskellers often seem to prefer 1 and 2 character variable names, which again convey little or no information. > > And don't get me started on point-free code...! > > N.B. I am not trying to start a flame war, these are just comments from my experience of trying to get beyond text-book examples and start using Haskell libraries and trying to learn from open source code. In general I find idiomatic Haskell hard to understand, and for me this is a barrier to using Haskell for real projects. Maybe someday I'll have learnt enough to get past this problem, but as the language and libraries seem to evolve quickly, I have my doubts... > > >> On 25/02/16 19:19, Jeffrey Brown wrote: >> Something I like about functional programming is how it interfaces with natural language. >> Haskell, somehow to a greater extent than other languages, encourages me to divide functions >> into one or two-liners. Each has a type signature that means something in English. Further, each >> gives you the opportunity to choose a good name for the function and its arguments. After doing >> those things, the function is much easier to write, and much easier to read -- so much so that >> often you don't have to read the function body at all, just the type signature, function name >> and argument names. >> >> On Thu, Feb 25, 2016 at 8:17 AM, Dudley Brooks > > wrote: >> >> Ages and ages ago I saw this advice about programming: >> >> Q: "What's the best language for a programmer to know?" >> >> A: "English" (or whatever your native language is) >> >> -- Dudley >> >> >>> On 2/24/16 4:03 PM, Dennis Raddle wrote: >>> >>> This is more about programming in general than Haskell, although Haskellers probably know >>> it well. >>> >>> I don't claim to have expert knowledge on this, but I'm gradually getting better at it. >>> >>> When I set out to write a program, or refactor a program, or modify a program, it helps to >>> set out my thinking in a clear way. And how I make it clear is to document my thoughts. >>> >>> An outline is one good way to organize thoughts and is probably my main tool. But good >>> English prose is also helpful. >>> >>> The key factor is "editing." In what sense do I mean that? Good writers do it, and the >>> Haskell documentation does it. I mean (1) brevity and (2) good flow. To achieve brevity, >>> you must think about the essence of each statement and trim away the unnecessary stuff. >>> Good flow refers to how the document builds up and modifies your concepts as you read it. >>> A document can actually mirror an effective learning process, or influence and change your >>> process. >>> >>> I work with my documentation, making several editing passes. By the time I'm done, I am in >>> a great position to write a concise and flexible program. >>> >>> It's interesting that not only is Haskell a concise language, but the Haskell library >>> documentation is concise. Contrast that with the Python documentation which often wanders >>> about into areas that are irrelevant--it could easily be cut into one third its present size. >>> >>> 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 >> >> >> >> >> -- >> Jeffrey Benjamin Brown >> >> >> _______________________________________________ >> 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 From dbrooks at runforyourlife.org Fri Feb 26 15:29:03 2016 From: dbrooks at runforyourlife.org (Dudley Brooks) Date: Fri, 26 Feb 2016 07:29:03 -0800 Subject: [Haskell-beginners] general observation about programming In-Reply-To: <56D0210A.30301@physics.org> References: <56CF2929.10600@runforyourlife.org> <56D0210A.30301@physics.org> Message-ID: <56D06F3F.9090002@runforyourlife.org> One problem is that, while the symbolic operators do seem to have names (specified in the standards?) which are often sufficiently explanatory, you can find many tutorials which never even mention those names. On 2/26/16 1:55 AM, Mike Pentney wrote: > As a newbie, something I dislike about Haskell is the use of infix > operators like <||> which are unpronouncable and therefore (if you > don't happen to know the notation the symbol is based on) are more or > less meaningless. > > And Haskellers often seem to prefer 1 and 2 character variable names, > which again convey little or no information. > > And don't get me started on point-free code...! > > N.B. I am not trying to start a flame war, these are just comments > from my experience of trying to get beyond text-book examples and > start using Haskell libraries and trying to learn from open source > code. In general I find idiomatic Haskell hard to understand, and for > me this is a barrier to using Haskell for real projects. Maybe someday > I'll have learnt enough to get past this problem, but as the language > and libraries seem to evolve quickly, I have my doubts... > > > On 25/02/16 19:19, Jeffrey Brown wrote: >> Something I like about functional programming is how it interfaces >> with natural language. >> Haskell, somehow to a greater extent than other languages, encourages >> me to divide functions >> into one or two-liners. Each has a type signature that means >> something in English. Further, each >> gives you the opportunity to choose a good name for the function and >> its arguments. After doing >> those things, the function is much easier to write, and much easier >> to read -- so much so that >> often you don't have to read the function body at all, just the type >> signature, function name >> and argument names. >> >> On Thu, Feb 25, 2016 at 8:17 AM, Dudley Brooks >> > > wrote: >> >> Ages and ages ago I saw this advice about programming: >> >> Q: "What's the best language for a programmer to know?" >> >> A: "English" (or whatever your native language is) >> >> -- Dudley >> >> >> On 2/24/16 4:03 PM, Dennis Raddle wrote: >> >>> This is more about programming in general than Haskell, although >>> Haskellers probably know >>> it well. >>> >>> I don't claim to have expert knowledge on this, but I'm >>> gradually getting better at it. >>> >>> When I set out to write a program, or refactor a program, or >>> modify a program, it helps to >>> set out my thinking in a clear way. And how I make it clear is >>> to document my thoughts. >>> >>> An outline is one good way to organize thoughts and is probably >>> my main tool. But good >>> English prose is also helpful. >>> >>> The key factor is "editing." In what sense do I mean that? Good >>> writers do it, and the >>> Haskell documentation does it. I mean (1) brevity and (2) good >>> flow. To achieve brevity, >>> you must think about the essence of each statement and trim away >>> the unnecessary stuff. >>> Good flow refers to how the document builds up and modifies your >>> concepts as you read it. >>> A document can actually mirror an effective learning process, or >>> influence and change your >>> process. >>> >>> I work with my documentation, making several editing passes. By >>> the time I'm done, I am in >>> a great position to write a concise and flexible program. >>> >>> It's interesting that not only is Haskell a concise language, >>> but the Haskell library >>> documentation is concise. Contrast that with the Python >>> documentation which often wanders >>> about into areas that are irrelevant--it could easily be cut >>> into one third its present size. >>> >>> 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 >> >> >> >> >> -- >> Jeffrey Benjamin Brown >> >> >> _______________________________________________ >> 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 From matthewjwilliams101 at gmail.com Fri Feb 26 16:19:26 2016 From: matthewjwilliams101 at gmail.com (MJ Williams) Date: Fri, 26 Feb 2016 16:19:26 +0000 Subject: [Haskell-beginners] general observation about programming In-Reply-To: <56D06F3F.9090002@runforyourlife.org> References: <56CF2929.10600@runforyourlife.org> <56D0210A.30301@physics.org> <56D06F3F.9090002@runforyourlife.org> Message-ID: As I see it, Haskell and pure functional languages aren't `necessarily' about readability so much as expressing thought in mathematical terms. The readability comes with the consistency and transparency of well-formed mathematical notation. by the way, that's transparency in laymen's sense and not referential transparency. Matthew On 26/02/2016, Dudley Brooks wrote: > One problem is that, while the symbolic operators do seem to have names > (specified in the standards?) which are often sufficiently explanatory, > you can find many tutorials which never even mention those names. > > On 2/26/16 1:55 AM, Mike Pentney wrote: > >> As a newbie, something I dislike about Haskell is the use of infix >> operators like <||> which are unpronouncable and therefore (if you >> don't happen to know the notation the symbol is based on) are more or >> less meaningless. >> >> And Haskellers often seem to prefer 1 and 2 character variable names, >> which again convey little or no information. >> >> And don't get me started on point-free code...! >> >> N.B. I am not trying to start a flame war, these are just comments >> from my experience of trying to get beyond text-book examples and >> start using Haskell libraries and trying to learn from open source >> code. In general I find idiomatic Haskell hard to understand, and for >> me this is a barrier to using Haskell for real projects. Maybe someday >> I'll have learnt enough to get past this problem, but as the language >> and libraries seem to evolve quickly, I have my doubts... >> >> >> On 25/02/16 19:19, Jeffrey Brown wrote: >>> Something I like about functional programming is how it interfaces >>> with natural language. >>> Haskell, somehow to a greater extent than other languages, encourages >>> me to divide functions >>> into one or two-liners. Each has a type signature that means >>> something in English. Further, each >>> gives you the opportunity to choose a good name for the function and >>> its arguments. After doing >>> those things, the function is much easier to write, and much easier >>> to read -- so much so that >>> often you don't have to read the function body at all, just the type >>> signature, function name >>> and argument names. >>> >>> On Thu, Feb 25, 2016 at 8:17 AM, Dudley Brooks >>> >> > wrote: >>> >>> Ages and ages ago I saw this advice about programming: >>> >>> Q: "What's the best language for a programmer to know?" >>> >>> A: "English" (or whatever your native language is) >>> >>> -- Dudley >>> >>> >>> On 2/24/16 4:03 PM, Dennis Raddle wrote: >>> >>>> This is more about programming in general than Haskell, although >>>> Haskellers probably know >>>> it well. >>>> >>>> I don't claim to have expert knowledge on this, but I'm >>>> gradually getting better at it. >>>> >>>> When I set out to write a program, or refactor a program, or >>>> modify a program, it helps to >>>> set out my thinking in a clear way. And how I make it clear is >>>> to document my thoughts. >>>> >>>> An outline is one good way to organize thoughts and is probably >>>> my main tool. But good >>>> English prose is also helpful. >>>> >>>> The key factor is "editing." In what sense do I mean that? Good >>>> writers do it, and the >>>> Haskell documentation does it. I mean (1) brevity and (2) good >>>> flow. To achieve brevity, >>>> you must think about the essence of each statement and trim away >>>> the unnecessary stuff. >>>> Good flow refers to how the document builds up and modifies your >>>> concepts as you read it. >>>> A document can actually mirror an effective learning process, or >>>> influence and change your >>>> process. >>>> >>>> I work with my documentation, making several editing passes. By >>>> the time I'm done, I am in >>>> a great position to write a concise and flexible program. >>>> >>>> It's interesting that not only is Haskell a concise language, >>>> but the Haskell library >>>> documentation is concise. Contrast that with the Python >>>> documentation which often wanders >>>> about into areas that are irrelevant--it could easily be cut >>>> into one third its present size. >>>> >>>> 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 >>> >>> >>> >>> >>> -- >>> Jeffrey Benjamin Brown >>> >>> >>> _______________________________________________ >>> 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 > From rein.henrichs at gmail.com Fri Feb 26 17:41:40 2016 From: rein.henrichs at gmail.com (Rein Henrichs) Date: Fri, 26 Feb 2016 17:41:40 +0000 Subject: [Haskell-beginners] general observation about programming In-Reply-To: References: <56CF2929.10600@runforyourlife.org> <56D0210A.30301@physics.org> <56D06F3F.9090002@runforyourlife.org> Message-ID: Pointfree is good for reasoning about *composition*. It can often be more readable than pointful code when the focus of the function is on composition of other functions. For example, take this function from Bird's *Pearls of Functional Algorithm Design*: boxes = map ungroup . ungroup . map cols . group . map group Compare the pointful version: boxes matrix = map ungroup (ungroup (map cols (group (map group matrix)))) Readibility is subjective, but I think many people will agree that the pointfree version is easier to read. On Fri, Feb 26, 2016 at 8:19 AM MJ Williams wrote: > As I see it, Haskell and pure functional languages aren't > `necessarily' about readability so much as expressing thought in > mathematical terms. The readability comes with the consistency and > transparency of well-formed mathematical notation. > by the way, that's transparency in laymen's sense and not referential > transparency. > Matthew > > > On 26/02/2016, Dudley Brooks wrote: > > One problem is that, while the symbolic operators do seem to have names > > (specified in the standards?) which are often sufficiently explanatory, > > you can find many tutorials which never even mention those names. > > > > On 2/26/16 1:55 AM, Mike Pentney wrote: > > > >> As a newbie, something I dislike about Haskell is the use of infix > >> operators like <||> which are unpronouncable and therefore (if you > >> don't happen to know the notation the symbol is based on) are more or > >> less meaningless. > >> > >> And Haskellers often seem to prefer 1 and 2 character variable names, > >> which again convey little or no information. > >> > >> And don't get me started on point-free code...! > >> > >> N.B. I am not trying to start a flame war, these are just comments > >> from my experience of trying to get beyond text-book examples and > >> start using Haskell libraries and trying to learn from open source > >> code. In general I find idiomatic Haskell hard to understand, and for > >> me this is a barrier to using Haskell for real projects. Maybe someday > >> I'll have learnt enough to get past this problem, but as the language > >> and libraries seem to evolve quickly, I have my doubts... > >> > >> > >> On 25/02/16 19:19, Jeffrey Brown wrote: > >>> Something I like about functional programming is how it interfaces > >>> with natural language. > >>> Haskell, somehow to a greater extent than other languages, encourages > >>> me to divide functions > >>> into one or two-liners. Each has a type signature that means > >>> something in English. Further, each > >>> gives you the opportunity to choose a good name for the function and > >>> its arguments. After doing > >>> those things, the function is much easier to write, and much easier > >>> to read -- so much so that > >>> often you don't have to read the function body at all, just the type > >>> signature, function name > >>> and argument names. > >>> > >>> On Thu, Feb 25, 2016 at 8:17 AM, Dudley Brooks > >>> >>> > wrote: > >>> > >>> Ages and ages ago I saw this advice about programming: > >>> > >>> Q: "What's the best language for a programmer to know?" > >>> > >>> A: "English" (or whatever your native language is) > >>> > >>> -- Dudley > >>> > >>> > >>> On 2/24/16 4:03 PM, Dennis Raddle wrote: > >>> > >>>> This is more about programming in general than Haskell, although > >>>> Haskellers probably know > >>>> it well. > >>>> > >>>> I don't claim to have expert knowledge on this, but I'm > >>>> gradually getting better at it. > >>>> > >>>> When I set out to write a program, or refactor a program, or > >>>> modify a program, it helps to > >>>> set out my thinking in a clear way. And how I make it clear is > >>>> to document my thoughts. > >>>> > >>>> An outline is one good way to organize thoughts and is probably > >>>> my main tool. But good > >>>> English prose is also helpful. > >>>> > >>>> The key factor is "editing." In what sense do I mean that? Good > >>>> writers do it, and the > >>>> Haskell documentation does it. I mean (1) brevity and (2) good > >>>> flow. To achieve brevity, > >>>> you must think about the essence of each statement and trim away > >>>> the unnecessary stuff. > >>>> Good flow refers to how the document builds up and modifies your > >>>> concepts as you read it. > >>>> A document can actually mirror an effective learning process, or > >>>> influence and change your > >>>> process. > >>>> > >>>> I work with my documentation, making several editing passes. By > >>>> the time I'm done, I am in > >>>> a great position to write a concise and flexible program. > >>>> > >>>> It's interesting that not only is Haskell a concise language, > >>>> but the Haskell library > >>>> documentation is concise. Contrast that with the Python > >>>> documentation which often wanders > >>>> about into areas that are irrelevant--it could easily be cut > >>>> into one third its present size. > >>>> > >>>> 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 > >>> > >>> > >>> > >>> > >>> -- > >>> Jeffrey Benjamin Brown > >>> > >>> > >>> _______________________________________________ > >>> 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: From mike_k_houghton at yahoo.co.uk Fri Feb 26 18:13:33 2016 From: mike_k_houghton at yahoo.co.uk (Mike Houghton) Date: Fri, 26 Feb 2016 18:13:33 +0000 Subject: [Haskell-beginners] Folders and sub-folders In-Reply-To: References: <95C6683E-A31F-4EAC-8C7E-73FDB1F942B9@yahoo.co.uk> <826550DC-D6C8-401E-8B53-A9D4D4781B6C@yahoo.co.uk> Message-ID: <6D1F3B6C-A168-4C94-BC17-1E1240B31DD6@yahoo.co.uk> Cool, thanks. > On 26 Feb 2016, at 13:01, Sylvain Henry wrote: > > Your "isOk" function will filter out hidden directories on Unix (which may be what you want?). > > Otherwise: isOk = (`notElem` [".",".."]) > > Also "\x -> folders x" = "folders" > > 2016-02-26 11:42 GMT+01:00 Mike Houghton >: > Thanks. > > > I sweated it bit more and got > > > > isOk FilePath -> Bool > isOk = not . isPrefixOf "." > > folders :: FilePath -> IO [FilePath] > folders fp = do > all <- getDirectoryContents fp > z' <- filterM doesDirectoryExist $ map (fp ) (filter isOk all) > x' <- mapM (\x -> folders x) z' > return $ z' ++ (concat x') :: > > which seems to work. > > > > On 25 Feb 2016, at 19:07, Imants Cekusins > wrote: > > > > Hello Mike, > > > > below code find all files recursively from a starting point. It works. > > > > You'd need to tweak it to find folders instead. > > > > > > import System.Directory > > import Data.List > > > > > > findAllFiles::FilePath -> IO [FilePath] > > findAllFiles base0 = gd1 base0 > >>> = \list1 -> concatMap' recurse3 list1 > > where gd1 d1 = filter f2 <$> (getDirectoryContents d1) > > f2 "." = False > > f2 ".." = False > > f2 _ = True > > recurse3 md3 = doesDirectoryExist md3full > >>> = \isDir3 -> > > if isDir3 then findAllFiles md3full > > else pure [md3full] > > where md3full = base0 ++ "/" ++ md3 > > > > > > > > concatMap':: (a -> IO [b]) -> [a] -> IO [b] > > concatMap' m0 list0 = sequence (m0 <$> list0) > >>> = \list2 -> pure $ concat list2 > > _______________________________________________ > > 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: From jeffbrown.the at gmail.com Fri Feb 26 19:52:39 2016 From: jeffbrown.the at gmail.com (Jeffrey Brown) Date: Fri, 26 Feb 2016 11:52:39 -0800 Subject: [Haskell-beginners] general observation about programming In-Reply-To: <56D0210A.30301@physics.org> References: <56CF2929.10600@runforyourlife.org> <56D0210A.30301@physics.org> Message-ID: If you want to know how to pronounce an infix, GHCI and Hackage can very often solve the problem for you. For instance: > :i <$> (<$>) :: Functor f => (a -> b) -> f a -> f b -- Defined in ?Data.Functor? infixl 4 <$> > If you then lookup Data.Functor on Hackage, you'll find in the description of <$> "An infix synonym for fmap." Even if there's no comment provided, you can from there view source; often you'll find a one-word definition like "(>>=) = bind". On Fri, Feb 26, 2016 at 1:55 AM, Mike Pentney wrote: > As a newbie, something I dislike about Haskell is the use of infix > operators like <||> which are unpronouncable and therefore (if you don't > happen to know the notation the symbol is based on) are more or less > meaningless. > > And Haskellers often seem to prefer 1 and 2 character variable names, > which again convey little or no information. > > And don't get me started on point-free code...! > > N.B. I am not trying to start a flame war, these are just comments from my > experience of trying to get beyond text-book examples and start using > Haskell libraries and trying to learn from open source code. In general I > find idiomatic Haskell hard to understand, and for me this is a barrier to > using Haskell for real projects. Maybe someday I'll have learnt enough to > get past this problem, but as the language and libraries seem to evolve > quickly, I have my doubts... > > > On 25/02/16 19:19, Jeffrey Brown wrote: > >> Something I like about functional programming is how it interfaces with >> natural language. >> Haskell, somehow to a greater extent than other languages, encourages me >> to divide functions >> into one or two-liners. Each has a type signature that means something in >> English. Further, each >> gives you the opportunity to choose a good name for the function and its >> arguments. After doing >> those things, the function is much easier to write, and much easier to >> read -- so much so that >> often you don't have to read the function body at all, just the type >> signature, function name >> and argument names. >> >> On Thu, Feb 25, 2016 at 8:17 AM, Dudley Brooks < >> dbrooks at runforyourlife.org >> > wrote: >> >> Ages and ages ago I saw this advice about programming: >> >> Q: "What's the best language for a programmer to know?" >> >> A: "English" (or whatever your native language is) >> >> -- Dudley >> >> >> On 2/24/16 4:03 PM, Dennis Raddle wrote: >> >> This is more about programming in general than Haskell, although >>> Haskellers probably know >>> it well. >>> >>> I don't claim to have expert knowledge on this, but I'm gradually >>> getting better at it. >>> >>> When I set out to write a program, or refactor a program, or modify >>> a program, it helps to >>> set out my thinking in a clear way. And how I make it clear is to >>> document my thoughts. >>> >>> An outline is one good way to organize thoughts and is probably my >>> main tool. But good >>> English prose is also helpful. >>> >>> The key factor is "editing." In what sense do I mean that? Good >>> writers do it, and the >>> Haskell documentation does it. I mean (1) brevity and (2) good flow. >>> To achieve brevity, >>> you must think about the essence of each statement and trim away the >>> unnecessary stuff. >>> Good flow refers to how the document builds up and modifies your >>> concepts as you read it. >>> A document can actually mirror an effective learning process, or >>> influence and change your >>> process. >>> >>> I work with my documentation, making several editing passes. By the >>> time I'm done, I am in >>> a great position to write a concise and flexible program. >>> >>> It's interesting that not only is Haskell a concise language, but >>> the Haskell library >>> documentation is concise. Contrast that with the Python >>> documentation which often wanders >>> about into areas that are irrelevant--it could easily be cut into >>> one third its present size. >>> >>> 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 >> >> >> >> >> -- >> Jeffrey Benjamin Brown >> >> >> _______________________________________________ >> 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 > -- Jeffrey Benjamin Brown -------------- next part -------------- An HTML attachment was scrubbed... URL: From michael at orlitzky.com Fri Feb 26 22:08:06 2016 From: michael at orlitzky.com (Michael Orlitzky) Date: Fri, 26 Feb 2016 17:08:06 -0500 Subject: [Haskell-beginners] general observation about programming In-Reply-To: References: <56CF2929.10600@runforyourlife.org> <56D0210A.30301@physics.org> <56D06F3F.9090002@runforyourlife.org> Message-ID: <56D0CCC6.5030107@orlitzky.com> On 02/26/2016 12:41 PM, Rein Henrichs wrote: > Pointfree is good for reasoning about *composition*. It can often be > more readable than pointful code when the focus of the function is on > composition of other functions. For example, take this function from > Bird's /Pearls of Functional Algorithm Design/: > > boxes = map ungroup . ungroup . map cols . group . map group > > Compare the pointful version: > > boxes matrix = map ungroup (ungroup (map cols (group (map group matrix)))) > > Readibility is subjective, but I think many people will agree that the > pointfree version is easier to read. > Sure, but does anyone have any idea what that first version is supposed to do? It would be much better to write it out: boxes matrix = one_big_list where -- The function (group . map group) produces a list of box -- matrices, transposing each one in the process. transposed_box_matrices = group (map group matrix) -- The "cols" function performs a transpose, so mapping it over -- transposed_matrices gives us the box matrices we want. box_matrices = map cols transposed_box_matrices -- Now we concat everything into one big matrix for some reason. -- This is the inverse of the (group . map group) that we did -- earlier. one_big_list = map ungroup (ungroup box_matrices) You don't even need to write a book to explain what it does =) From dennis.raddle at gmail.com Sat Feb 27 00:53:48 2016 From: dennis.raddle at gmail.com (Dennis Raddle) Date: Fri, 26 Feb 2016 16:53:48 -0800 Subject: [Haskell-beginners] general observation about programming In-Reply-To: <56D0CCC6.5030107@orlitzky.com> References: <56CF2929.10600@runforyourlife.org> <56D0210A.30301@physics.org> <56D06F3F.9090002@runforyourlife.org> <56D0CCC6.5030107@orlitzky.com> Message-ID: On Fri, Feb 26, 2016 at 2:08 PM, Michael Orlitzky wrote: > On 02/26/2016 12:41 PM, Rein Henrichs wrote: > > Pointfree is good for reasoning about *composition*. It can often be > > more readable than pointful code when the focus of the function is on > > composition of other functions. For example, take this function from > > Bird's /Pearls of Functional Algorithm Design/: > > > > boxes = map ungroup . ungroup . map cols . group . map group > > > > Compare the pointful version: > > > > boxes matrix = map ungroup (ungroup (map cols (group (map group > matrix)))) > > > > Readibility is subjective, but I think many people will agree that the > > pointfree version is easier to read. > > > > Sure, but does anyone have any idea what that first version is supposed > to do? It would be much better to write it out: > > On Haskell's readability, I am getting better at reading point-free and idiomatic Haskell with practice, and I now think that a short Haskell function with a meaningful type signature is much more readable that other languages I've used. On using short variable names, that plus point free style can make a lot of expressions into one-liners, which I see as an advantage for comprehension on the whole, even if you need to learn what the variables mean. Using 'm' for a map, 'l' for a list, and other conventions helps. Some styles make a program more readable when it is first encountered, but my own pet project is something I've worked with for a long time, allowing me to establish consistent and carefully thought-out naming schemes, not to mention I'm familiar with the concepts, so I find it easier to read my own code (say, written a long time ago) when it's concise (meaning point-free in many cases). One could argue that a public project needs to put greater focus on readability to the uninitiated. The Haskell hierarchical libraries are public, and their design seems, as far as I can tell, intended to trade off toward the person who has become expert in them rather than making everything obvious to the beginner. But maybe I'm wrong about that. D -------------- next part -------------- An HTML attachment was scrubbed... URL: From maydwell at gmail.com Sat Feb 27 03:21:47 2016 From: maydwell at gmail.com (Lyndon Maydwell) Date: Sat, 27 Feb 2016 14:21:47 +1100 Subject: [Haskell-beginners] Stack minimal dependency specification, or dependency tree output In-Reply-To: References: Message-ID: Hi again Simon, While `stack dot --external --depth 0` gets the job done, I had a little play around with the idea of finding the initial nodes on the implicit dependency graph, rather than a traversal from the initial dependency list, and the results for this project are quite a bit shorter: lyndon at endpin master ? ~/Silverpond/promise_backend stack dot --external | grep -v PromiseBackend | stack-minimal-dependencies-exe Right (fromList [Node "StringId \"errors\"" ,Node "StringId \"snap\"" ,Node "StringId \"wreq\""]) lyndon at endpin master ? ~/Silverpond/promise_backend stack dot --external --depth=0 strict digraph deps { "PromiseBackend" [style=dashed]; "PromiseBackend" -> "aeson"; "PromiseBackend" -> "base"; "PromiseBackend" -> "bytestring"; "PromiseBackend" -> "containers"; "PromiseBackend" -> "errors"; "PromiseBackend" -> "lens"; "PromiseBackend" -> "lens-aeson"; "PromiseBackend" -> "mtl"; "PromiseBackend" -> "snap"; "PromiseBackend" -> "text"; "PromiseBackend" -> "transformers"; "PromiseBackend" -> "unordered-containers"; "PromiseBackend" -> "wreq"; } Not that it really matters, but thought it might be interesting for anyone who was following this thread. The code I used to compute this is awful, and lives here: https://github.com/sordina/stack-minimal-dependencies/blob/master/app/Main.hs :) Later! - Lyndon On Thu, Feb 25, 2016 at 10:58 AM, Lyndon Maydwell wrote: > Hi Simon, > > > > stack dot --external --depth 0 > > > That's exactly what I was first looking for! > > Cheers :) > > > - Lyndon > > On Thu, Feb 25, 2016 at 9:55 AM, Simon Jakobi > wrote: > >> Hi Lyndon, >> >> I'd like to see some kind of tree instead, so that when I pre-install the >>> dependencies, I can specify a minimal list, rather than a whole slew of >>> dependencies that would be pulled in transitively anyway. >> >> >> There's "stack list-dependencies" but that includes the transitive >> dependencies. >> >> You can get the dependency tree (or rather dependency graph) with "stack >> dot --external" >> >> "stack dot --external --depth 0" will show only the direct dependencies >> of your project. >> >> More stack dot examples: >> http://docs.haskellstack.org/en/stable/dependency_visualization/ >> >> Cheers, >> Simon >> >> >> >> _______________________________________________ >> Beginners mailing list >> Beginners at haskell.org >> http://mail.haskell.org/cgi-bin/mailman/listinfo/beginners >> >> > -------------- next part -------------- An HTML attachment was scrubbed... URL: From rustompmody at gmail.com Sat Feb 27 06:17:13 2016 From: rustompmody at gmail.com (Rustom Mody) Date: Sat, 27 Feb 2016 11:47:13 +0530 Subject: [Haskell-beginners] general observation about programming In-Reply-To: References: <56CF2929.10600@runforyourlife.org> <56D0210A.30301@physics.org> <56D06F3F.9090002@runforyourlife.org> Message-ID: On Fri, Feb 26, 2016 at 11:11 PM, Rein Henrichs wrote: > Pointfree is good for reasoning about *composition*. It can often be more > readable than pointful code when the focus of the function is on > composition of other functions. For example, take this function from Bird's *Pearls > of Functional Algorithm Design*: > > boxes = map ungroup . ungroup . map cols . group . map group > And better if you read it in the right (ie left to right order) boxes = map group >>> group >>> map cols >> ungroup >>> map ungroup (From Control.Arrow) Even better if the 3-char clunky >>> is reduced to the 1-char ? map group ? group ? map cols ? ungroup ? map ungroup (From Control.Arrow.Unicode) [Those who find this unnatural/difficult/arcane/etc may like to check out Unix-pipes (or English :-) ] Some wishful thinking in the same direction (uses python but python is not really relevant) : http://blog.languager.org/2014/04/unicoded-python.html Which to some extent I found works in Haskell : http://blog.languager.org/2014/05/unicode-in-haskell-source.html If only Haskell would go further!! -------------- next part -------------- An HTML attachment was scrubbed... URL: From jeffbrown.the at gmail.com Sat Feb 27 20:56:36 2016 From: jeffbrown.the at gmail.com (Jeffrey Brown) Date: Sat, 27 Feb 2016 12:56:36 -0800 Subject: [Haskell-beginners] general observation about programming In-Reply-To: References: <56CF2929.10600@runforyourlife.org> <56D0210A.30301@physics.org> <56D06F3F.9090002@runforyourlife.org> Message-ID: It is, I agree, not appropriate everywhere, but point-free code can in the right place be much more readable. Maps are a good example. Compare: map (f . g . h) xs to map (\x -> f $ g $ h x) xs On Fri, Feb 26, 2016 at 10:17 PM, Rustom Mody wrote: > > > On Fri, Feb 26, 2016 at 11:11 PM, Rein Henrichs > wrote: > >> Pointfree is good for reasoning about *composition*. It can often be >> more readable than pointful code when the focus of the function is on >> composition of other functions. For example, take this function from Bird's *Pearls >> of Functional Algorithm Design*: >> >> boxes = map ungroup . ungroup . map cols . group . map group >> > > And better if you read it in the right (ie left to right order) > > > boxes = map group >>> group >>> map cols >> ungroup >>> map ungroup > (From Control.Arrow) > > Even better if the 3-char clunky >>> is reduced to the 1-char ? > map group ? group ? map cols ? ungroup ? map ungroup > (From Control.Arrow.Unicode) > [Those who find this unnatural/difficult/arcane/etc may like to check out > Unix-pipes (or English :-) ] > > Some wishful thinking in the same direction > (uses python but python is not really relevant) : > http://blog.languager.org/2014/04/unicoded-python.html > Which to some extent I found works in Haskell : > http://blog.languager.org/2014/05/unicode-in-haskell-source.html > If only Haskell would go further!! > > _______________________________________________ > Beginners mailing list > Beginners at haskell.org > http://mail.haskell.org/cgi-bin/mailman/listinfo/beginners > > -- Jeffrey Benjamin Brown -------------- next part -------------- An HTML attachment was scrubbed... URL: From hjgtuyl at chello.nl Sun Feb 28 01:35:15 2016 From: hjgtuyl at chello.nl (Henk-Jan van Tuyl) Date: Sun, 28 Feb 2016 02:35:15 +0100 Subject: [Haskell-beginners] general observation about programming In-Reply-To: References: <56CF2929.10600@runforyourlife.org> <56D0210A.30301@physics.org> <56D06F3F.9090002@runforyourlife.org> Message-ID: On Sat, 27 Feb 2016 07:17:13 +0100, Rustom Mody wrote: > On Fri, Feb 26, 2016 at 11:11 PM, Rein Henrichs > wrote: > >> Pointfree is good for reasoning about *composition*. It can often be >> more >> readable than pointful code when the focus of the function is on >> composition of other functions. For example, take this function from >> Bird's *Pearls >> of Functional Algorithm Design*: >> >> boxes = map ungroup . ungroup . map cols . group . map group >> > > And better if you read it in the right (ie left to right order) > > > boxes = map group >>> group >>> map cols >> ungroup >>> map ungroup > (From Control.Arrow) > > Even better if the 3-char clunky >>> is reduced to the 1-char ? > map group ? group ? map cols ? ungroup ? map ungroup > (From Control.Arrow.Unicode) You can also use & from Data.Function (since base 4.8.0.0) map group & group & map cols & ungroup & map ungroup Regards, Henk-Jan van Tuyl -- Folding at home What if you could share your unused computer power to help find a cure? In just 5 minutes you can join the world's biggest networked computer and get us closer sooner. Watch the video. http://folding.stanford.edu/ http://Van.Tuyl.eu/ http://members.chello.nl/hjgtuyl/tourdemonad.html Haskell programming -- From tanuki at gmail.com Sun Feb 28 01:46:56 2016 From: tanuki at gmail.com (Theodore Lief Gannon) Date: Sat, 27 Feb 2016 17:46:56 -0800 Subject: [Haskell-beginners] general observation about programming In-Reply-To: References: <56CF2929.10600@runforyourlife.org> <56D0210A.30301@physics.org> <56D06F3F.9090002@runforyourlife.org> Message-ID: >Those who find this unnatural/difficult/arcane/etc may like to check out Unix-pipes (or English :-) But chaining (a la pipes) isn't quite the same as composition. It's better compared with do-notation, which *does* use the ordering you suggest. As for English: try pronouncing (.) as "of." On Feb 26, 2016 10:17 PM, "Rustom Mody" wrote: > > > On Fri, Feb 26, 2016 at 11:11 PM, Rein Henrichs > wrote: > >> Pointfree is good for reasoning about *composition*. It can often be >> more readable than pointful code when the focus of the function is on >> composition of other functions. For example, take this function from Bird's *Pearls >> of Functional Algorithm Design*: >> >> boxes = map ungroup . ungroup . map cols . group . map group >> > > And better if you read it in the right (ie left to right order) > > > boxes = map group >>> group >>> map cols >> ungroup >>> map ungroup > (From Control.Arrow) > > Even better if the 3-char clunky >>> is reduced to the 1-char ? > map group ? group ? map cols ? ungroup ? map ungroup > (From Control.Arrow.Unicode) > [Those who find this unnatural/difficult/arcane/etc may like to check out > Unix-pipes (or English :-) ] > > Some wishful thinking in the same direction > (uses python but python is not really relevant) : > http://blog.languager.org/2014/04/unicoded-python.html > Which to some extent I found works in Haskell : > http://blog.languager.org/2014/05/unicode-in-haskell-source.html > If only Haskell would go further!! > > _______________________________________________ > Beginners mailing list > Beginners at haskell.org > http://mail.haskell.org/cgi-bin/mailman/listinfo/beginners > > -------------- next part -------------- An HTML attachment was scrubbed... URL: From michael at orlitzky.com Sun Feb 28 02:53:14 2016 From: michael at orlitzky.com (Michael Orlitzky) Date: Sat, 27 Feb 2016 21:53:14 -0500 Subject: [Haskell-beginners] general observation about programming In-Reply-To: References: <56CF2929.10600@runforyourlife.org> <56D0210A.30301@physics.org> <56D06F3F.9090002@runforyourlife.org> Message-ID: <56D2611A.1080803@orlitzky.com> On 02/27/2016 08:35 PM, Henk-Jan van Tuyl wrote: >> >> Even better if the 3-char clunky >>> is reduced to the 1-char ? >> map group ? group ? map cols ? ungroup ? map ungroup >> (From Control.Arrow.Unicode) > > You can also use & from Data.Function (since base 4.8.0.0) > map group & group & map cols & ungroup & map ungroup > I would love to hear the elevator pitch for making "and" mean "backwards function application". Might as well go full retard: boxes m = m & ((? ungroup . map cols <<< group >>> map group) $ map ungroup) As you can see, it gets more clear the more operators you use. Note that (&) isn't backwards composition -- it's backwards application. So it's analogous to "$" and not the "." operator. You can just google "&" to find that out though. From rustompmody at gmail.com Sun Feb 28 03:24:36 2016 From: rustompmody at gmail.com (Rustom Mody) Date: Sun, 28 Feb 2016 08:54:36 +0530 Subject: [Haskell-beginners] general observation about programming In-Reply-To: References: <56CF2929.10600@runforyourlife.org> <56D0210A.30301@physics.org> <56D06F3F.9090002@runforyourlife.org> Message-ID: On Sun, Feb 28, 2016 at 2:26 AM, Jeffrey Brown wrote: > It is, I agree, not appropriate everywhere, but point-free code can in the > right place be much more readable. Maps are a good example. Compare: > > map (f . g . h) xs > > to > > map (\x -> f $ g $ h x) xs > Not quite a fair comparison How about? [ f (g (h x)) | x <- xs ] -------------- next part -------------- An HTML attachment was scrubbed... URL: From joel.neely at gmail.com Mon Feb 29 00:46:14 2016 From: joel.neely at gmail.com (Joel Neely) Date: Sun, 28 Feb 2016 18:46:14 -0600 Subject: [Haskell-beginners] general observation about programming In-Reply-To: References: <56CF2929.10600@runforyourlife.org> <56D0210A.30301@physics.org> <56D06F3F.9090002@runforyourlife.org> Message-ID: 2? from a Haskell newbie, who would be delighted to be instructed or corrected: I have experienced some of the same issues mentioned earlier in this thread when trying to read code written by a real expert (e.g. from "How do I verbalize that, to think out loud or discuss it with someone else?" to "Why that particular abstraction at this point?"). I tend to think that Haskell has no exclusive claim on this consideration. Witness, for example, the experience of a newcomer looking at a compact Java source file that makes heavy use of generics and framework-specific annotations. However, as one of the most directly mathematically-influenced programming languages, I can also believe that it may happen to a greater degree in Haskell than most others. Mathematics, Haskell, and certain approaches to programming tend to share the practice of building up an elegant pyramid of abstraction which allows one to say more and more with fewer and fewer marks. (Witness the description of Maxwell's laws at https://en.wikipedia.org/wiki/Maxwell%27s_equations .) I suspect that a beginner to any of the above, on first examining an artifact from an expert practitioner, will struggle to find the keyhole (or even the doorknob). As a part time instructor, I also struggle with the degree to which some "explanations" risk either dumbing-down important concepts or covering them in so much metaphorical baggage that they actually exacerbate the problem faced by the student. Just as agile practitioners use spikes to explore the skeleton of a problem, knowing full well that they have simplified it for the purpose of addressing one concern, I'm starting to experiment with "spike explanations" that draw a simplified connection from the apex of the pyramid to ground level. For example: *For present purposes, think of a monoid as a general scheme for accumulating a result over a specific data type, such as the sum of integers or the concatentation of strings. We'll talk later about some specific expectations that must be satisfied.* An expert is going to say (or write) high-economy utterances that other experts will instantly grasp and that newcomers will find opaque. I suspect that the editing process that the original poster described is the crucial part of developing an understanding. One "spike explanation" technique with which I have had some success involves starting with a verbose, concrete artifact (e.g. bit of source code), then progressively editing re-factoring it into the final nicely-abstracted, economical form. Accessible examples that come to mind include http://blog.sigfpe.com/2006/08/you-could-have-invented-monads-and.html and http://codon.com/refactoring-ruby-with-monads . I'd be very interested to know whether there examples of this technique for more advanced Haskell code. Thanks, Joel On Sat, Feb 27, 2016 at 9:24 PM, Rustom Mody wrote: > > > On Sun, Feb 28, 2016 at 2:26 AM, Jeffrey Brown > wrote: > >> It is, I agree, not appropriate everywhere, but point-free code can in >> the right place be much more readable. Maps are a good example. Compare: >> >> map (f . g . h) xs >> >> to >> >> map (\x -> f $ g $ h x) xs >> > > Not quite a fair comparison > How about? > [ f (g (h x)) | x <- xs ] > > > > _______________________________________________ > Beginners mailing list > Beginners at haskell.org > http://mail.haskell.org/cgi-bin/mailman/listinfo/beginners > > -- Beauty of style and harmony and grace and good rhythm depend on simplicity. - Plato -------------- next part -------------- An HTML attachment was scrubbed... URL: From jeffbrown.the at gmail.com Mon Feb 29 00:51:48 2016 From: jeffbrown.the at gmail.com (Jeffrey Brown) Date: Sun, 28 Feb 2016 16:51:48 -0800 Subject: [Haskell-beginners] general observation about programming In-Reply-To: References: <56CF2929.10600@runforyourlife.org> <56D0210A.30301@physics.org> <56D06F3F.9090002@runforyourlife.org> Message-ID: That will work in the special case of lists, but there are all sorts of other things you might want to map across. On Sat, Feb 27, 2016 at 7:24 PM, Rustom Mody wrote: > > > On Sun, Feb 28, 2016 at 2:26 AM, Jeffrey Brown > wrote: > >> It is, I agree, not appropriate everywhere, but point-free code can in >> the right place be much more readable. Maps are a good example. Compare: >> >> map (f . g . h) xs >> >> to >> >> map (\x -> f $ g $ h x) xs >> > > Not quite a fair comparison > How about? > [ f (g (h x)) | x <- xs ] > > > > _______________________________________________ > Beginners mailing list > Beginners at haskell.org > http://mail.haskell.org/cgi-bin/mailman/listinfo/beginners > > -- Jeffrey Benjamin Brown -------------- next part -------------- An HTML attachment was scrubbed... URL: