Re: [Haskell-cafe] guards in applicative style

2012-09-12 Thread Lorenzo Bolla
I'm no expert at all, but I would say no. guard type is: guard :: MonadPlus m = Bool - m () and MonadPlus is a monad plus (ehm...) mzero and mplus (http://en.wikibooks.org/wiki/Haskell/MonadPlus). On the other hand Applicative is less than a monad

Re: [Haskell-cafe] Platform Versioning Policy: upper bounds are not our friends

2012-08-15 Thread Lorenzo Bolla
Haskell-Cafe@haskell.org http://www.haskell.org/mailman/listinfo/haskell-cafe -- Lorenzo Bolla http://lbolla.info ___ Haskell-Cafe mailing list Haskell-Cafe@haskell.org http://www.haskell.org/mailman/listinfo/haskell-cafe

Re: [Haskell-cafe] StableNames and monadic functions

2012-06-26 Thread Lorenzo Bolla
of awkward. I know the details of StableNames are probably implementation-dependent, but I'm still wondering about how to detect / restrict this situation. Thanks 2012/6/26 Lorenzo Bolla lbo...@gmail.com From StableName docs: The reverse is not necessarily true: if two stable names are not equal

Re: [Haskell-cafe] StableNames and monadic functions

2012-06-26 Thread Lorenzo Bolla
, Ismael Figueroa Palet ifiguer...@gmail.com wrote: 2012/6/26 Lorenzo Bolla lbo...@gmail.com The point I was making is that StableName might be what you want. You are using it to check if two functions are the same by comparing their stablehash. But from StableName documentation

Re: [Haskell-cafe] StableNames and monadic functions

2012-06-26 Thread Lorenzo Bolla
. On Tue, Jun 26, 2012 at 3:42 PM, Lorenzo Bolla lbo...@gmail.com wrote: I think about StableName like the operator in C, that returns you the memory address of a variable. It's not the same for many reasons, but by analogy, if x == y then x == y, but x != y does not imply x != y. So, values

Re: [Haskell-cafe] StableNames and monadic functions

2012-06-26 Thread Lorenzo Bolla
. On Tue, Jun 26, 2012 at 4:50 PM, Ismael Figueroa Palet ifiguer...@gmail.com wrote: thanks again for your comments, any idea on how to implement Equivalence for functions? 2012/6/26 Lorenzo Bolla lbo...@gmail.com In other words there is a difference between Identity and Equivalence. What you

Re: [Haskell-cafe] not enough fusion?

2012-06-25 Thread Lorenzo Bolla
I wonder why this performs really badly, though (I would expect it to be the same as s2): s3 :: Int - Int s3 n = sum [gcd x y | x - [ 0 .. n-1 ], y - [ 0 .. n-1 ]] From the links posted by Dmitry, it might be that the code generated is made of 2 recursive calls: in fact, what I observe is a

Re: [Haskell-cafe] not enough fusion?

2012-06-25 Thread Lorenzo Bolla
test it works ~20% faster than s2 and ~20% slower than s1. Did you use -O2 flag? 2012/6/25 Lorenzo Bolla lbo...@gmail.com I wonder why this performs really badly, though (I would expect it to be the same as s2): s3 :: Int - Int s3 n = sum [gcd x y | x - [ 0 .. n-1 ], y - [ 0 .. n-1

Re: [Haskell-cafe] Confused by ghci output

2012-05-31 Thread Lorenzo Bolla
It looks like you are overflowing `Int` with 3^40. In your QuickCheck test, the function signature uses Int: prop_sanemodexp :: Int - Int - Int - Property Note: Prelude 3^40 12157665459056928801 Prelude 3^40 :: Int 689956897 Prelude 3^40 `mod` 3 0 Prelude (3^40 `mod` 3) :: Int 1 L. On

Re: [Haskell-cafe] Please critique my code (a simple lexer)

2012-05-23 Thread Lorenzo Bolla
On Tue, May 22, 2012 at 4:13 PM, John Simon zildjoh...@gmail.com wrote: data Lexer = Lexer String makeLexer :: String - Lexer makeLexer fn = Lexer fn `makeLexer` is redundant. You can simply use `Lexer`. L. ___ Haskell-Cafe mailing list

Re: [Haskell-cafe] desactivate my Show instance implementations temporarily

2012-04-22 Thread Lorenzo Bolla
some preprocessor's #if/#else/#endif pragmas. See here: http://stackoverflow.com/questions/6556778/using-if-else-endif-in-haskell L. -- Lorenzo Bolla http://lbolla.info pgppqbachV6j0.pgp Description: PGP signature ___ Haskell-Cafe mailing list Haskell