[Haskell-cafe] MPTC and type classes issue (polymorphic '+')
Pepe Iborra
mnislaih at gmail.com
Sat Apr 7 09:01:11 EDT 2007
The main problem is that you cannot assume Integral for the values 20
and 40. Those have types (Num a=>a).
And without the Integral assumption, you cannot define your instance.
So what I would do is to create a thin wrapper:
>i = id :: Integer -> Integer
and write:
> input2 = [ InputDecs [ inp "emaLength" TyNumber ((i 20) + (i 40)) ] ]
Sometimes the simplest solution is the best one
Cheers
pepe
On 07/04/2007, at 14:35, Joel Reymont wrote:
> Pepe,
>
> On Apr 7, 2007, at 1:31 PM, Pepe Iborra wrote:
>
>> > input2 = [ InputDecs [ inp "emaLength" TyNumber ((20::Integer) +
>> (40::Integer)) ] ]
>
> Thank you for your suggestion! I'm trying to make my AST definition
> as succinct as possible, though, so I would really love to have 20
> + 40. The issue is confined to a single module used during testing.
>
> Thanks, Joel
>
> --
> http://wagerlabs.com/
>
>
>
>
>
More information about the Haskell-Cafe
mailing list