
On Thu, Dec 27, 2012 at 1:48 AM, Roman Cheplyaka
* Rustom Mody
[2012-12-26 20:12:17+0530] So is there any set of flags to make haskell literals less polymorphic?
Yes, there is!
% ghci -XRebindableSyntax GHCi, version 7.6.1: http://www.haskell.org/ghc/ :? for help Loading package ghc-prim ... linking ... done. Loading package integer-gmp ... linking ... done. Loading package base ... linking ... done.
import Prelude hiding (fromInteger) Prelude> let fromInteger = id Prelude> :t 3 3 :: Integer
Roman
Thanks Roman -- that helps. And yet the ghci error is much more obscure than the gofer error: --- contents of .ghci --- :set -XRebindableSyntax let fromInteger = id ------ ghci session ----- $ ghci GHCi, version 7.4.1: http://www.haskell.org/ghc/ :? for help Loading package ghc-prim ... linking ... done. Loading package integer-gmp ... linking ... done. Loading package base ... linking ... done. Prelude> :t 5 5 :: Integer Prelude> :t [[1,2],3] <interactive>:1:8: Couldn't match expected type `[Integer]' with actual type `Integer' Expected type: Integer -> [Integer] Actual type: Integer -> Integer In the expression: 3 In the expression: [[1, 2], 3] ----- The same in gofer ----- Gofer session for: pustd.pre ? :t [[1,2],3] ERROR: Type error in list *** expression : [[1,2],3] *** term : 3 *** type : Int *** does not match : [Int] -------------- So the error is occurring at the point of the fromInteger (= id) but the message does not indicate that -- http://www.the-magus.in http://blog.languager.org