Re: [Haskell-cafe] a code that cannot compile with or without NoMonomorphismRestriction

2012-03-30 Thread Denis Moskvin
f :: (Show a, Ord b) = (a - String, b - b - Bool) f = let commond_definitions = undefined in let f1 = id.show f2 x = ( x) in (f1, f2) From: Ting Lei tin...@hotmail.com To: haskell-cafe@haskell.org Cc: Date: Wed, 28 Mar 2012 23:42:30 -0700 Subject: [Haskell-cafe] a code

Re: [Haskell-cafe] a code that cannot compile with or without NoMonomorphismRestriction

2012-03-29 Thread Ketil Malde
Ting Lei tin...@hotmail.com writes: (f1, f2) = let commond_definitions = undefined in let f1 = id.show f2 x = ( x) in (f1, f2) I think the type signatures should be: f1 :: Show a = a - String and f2 :: Ord b = b - b - Bool When I define these

Re: [Haskell-cafe] a code that cannot compile with or without NoMonomorphismRestriction

2012-03-29 Thread Heinrich Apfelmus
Ketil Malde wrote: Ting Lei tin...@hotmail.com writes: (f1, f2) = let commond_definitions = undefined in let f1 = id.show f2 x = ( x) in (f1, f2) I think the type signatures should be: f1 :: Show a = a - String and f2 :: Ord b = b - b - Bool When I

Re: [Haskell-cafe] a code that cannot compile with or without NoMonomorphismRestriction

2012-03-29 Thread Haisheng Wu
I think the error message tell you how to fix: use -XNoMonomorphismRestriction One approach is add following line into top of your hs file and it works for me. {-# LANGUAGE NoMonomorphismRestriction #-} Regarding the deeper reason, I think you would be able to find via GHC user guide and

Re: [Haskell-cafe] a code that cannot compile with or without NoMonomorphismRestriction

2012-03-29 Thread Ting Lei
Ketil, Thanks for the response. It seems that defining them as a pair only postphones the error.GHC will give an error when you extract the components of the pair, no matter whether you addthe NoMonomorphismRestriction flag or not. --{-# LANGUAGE NoMonomorphismRestriction #-}p :: (Show a, Ord