[Haskell-cafe] MPTC and type classes issue (polymorphic '+')
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
> input2 = [ InputDecs [ inp "emaLength" TyNumber ((i 20) + (i 40)) ] ]
Sometimes the simplest solution is the best one
On 07/04/2007, at 14:35, Joel Reymont wrote:
> 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
More information about the Haskell-Cafe