Prelude :t [[1,2],3]
you have a list with 2 elements:
- [1,2]
- 3
the type of [1,2] is [Integer]
the type of 3 is Integer
But all elements in a list must have the same type.
2012/12/27 Rustom Mody rustompm...@gmail.com:
On Thu, Dec 27, 2012 at 1:48 AM, Roman Cheplyaka r...@ro-che.info
Hi David, it looks like Rustom's aware that haskell's not lisp. What he
really wants methinks is a way to suppress type classes altogether! That or
a NoOverloadedNumerals extension.
-- Kim-Ee
On Thu, Dec 27, 2012 at 4:03 PM, David Virebayre dav.vire+hask...@gmail.com
wrote:
Prelude :t
On Thu, Dec 27, 2012 at 8:26 PM, Kim-Ee Yeoh k...@atamo.com wrote:
Hi David, it looks like Rustom's aware that haskell's not lisp. What he
really wants methinks is a way to suppress type classes altogether! That or
a NoOverloadedNumerals extension.
-- Kim-Ee
I'm not really sure about
I don't know about the RebindableSyntax extension. But
Prelude :t [[1,2],3]
[[1,2],3] :: (Num [t], Num t) = [[t]]
The above only says that is is possible to have a list like [[1,2],3] if
you have for a Num t, [t] is also an instance of Num. But it doesn't
guarantee the existence of such an
* Rustom Mody rustompm...@gmail.com [2012-12-27 22:18:15+0530]
But now we are in for new surprises: Try out
f x y = x / y
Prelude :l f
[1 of 1] Compiling Main ( f.hs, interpreted )
f.hs:1:11: Not in scope: `/'
Failed, modules loaded: none.
Prelude (/)
It's because
Forgot to say: if you go the first route, you'll also need to define your
fromInteger in every module — the one from .ghci won't be in scope.
You can define
module MyPrelude (module Prelude, fromInteger) where
import Prelude hiding (fromInteger)
fromInteger = id
and import it instead.
On Thu, Dec 27, 2012 at 11:48 PM, Rustom Mody rustompm...@gmail.com wrote:
On Thu, Dec 27, 2012 at 8:26 PM, Kim-Ee Yeoh k...@atamo.com wrote:
What he really wants methinks is a way to suppress type classes
altogether! That or a NoOverloadedNumerals extension.
I'm not really sure about that...
You should note that GHCi uses extended defaulting rules as explained in
[1].
This means that a literal like 5 will only be of type Num a = a in GHCi
while in a normal Haskell program it will default to some concrete type
(Integer if there are no other constraints). Also, if you define x = 5
in a
Sorry, forgot the link:
http://www.haskell.org/ghc/docs/7.0.4/html/users_guide/interactive-evaluation.html
Section 2.4.5 Type defaulting in GHCi
___
Haskell-Cafe mailing list
Haskell-Cafe@haskell.org
http://www.haskell.org/mailman/listinfo/haskell-cafe
* Rustom Mody rustompm...@gmail.com [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.
On Thu, Dec 27, 2012 at 1:48 AM, Roman Cheplyaka r...@ro-che.info wrote:
* Rustom Mody rustompm...@gmail.com [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:
11 matches
Mail list logo