A possible bug with constraints being perceived as multiparameter type classes
This (empty) instance declaration |instance Num (a,b) =>Num (a,b,Int) where | produces the following error when compiled with jhc 0.8.2: |$ Temp/jhc-0.8.2/jhc Temp/jhc1.hs jhc Temp/jhc1.hs jhc 0.8.2 (mydniquipepo-32) Finding Dependencies... Using Ho Cache: '/home/yom/.jhc/cache' Temp/jhc1.hs:1 - Error: Invalid Class. multiparameter classes not yet supported: (Num,[HsTyTuple [HsTyVar {hsTypeName = a},HsTyVar {hsTypeName = b}]]) | Am I misunderstanding something, or is it a legitimate bug?
On Tue, Apr 21, 2015 at 9:26 AM, Artyom
$ Temp/jhc-0.8.2/jhc Temp/jhc1.hs
jhc Temp/jhc1.hs jhc 0.8.2 (mydniquipepo-32) Finding Dependencies... Using Ho Cache: '/home/yom/.jhc/cache'
Temp/jhc1.hs:1 - Error: Invalid Class. multiparameter classes not yet supported: (Num,[HsTyTuple [HsTyVar {hsTypeName = a},HsTyVar {hsTypeName = b}]])
Am I misunderstanding something, or is it a legitimate bug?
Looks multiparameter to me: instance ... => Num (T a b Int) where with T ~ (,,). Which is what the second line of the error message is telling you, more or less. -- brandon s allbery kf8nh sine nomine associates allbery.b@gmail.com ballbery@sinenomine.net unix, openafs, kerberos, infrastructure, xmonad http://sinenomine.net
On 21/04/15 16:38, Brandon Allbery wrote:
On Tue, Apr 21, 2015 at 9:26 AM, Artyom
mailto:yom@artyom.me> wrote: |$ Temp/jhc-0.8.2/jhc Temp/jhc1.hs
jhc Temp/jhc1.hs jhc 0.8.2 (mydniquipepo-32) Finding Dependencies... Using Ho Cache: '/home/yom/.jhc/cache'
Temp/jhc1.hs:1 - Error: Invalid Class. multiparameter classes not yet supported: (Num,[HsTyTuple [HsTyVar {hsTypeName = a},HsTyVar {hsTypeName = b}]]) |
Am I misunderstanding something, or is it a legitimate bug?
Looks multiparameter to me:
instance ... => Num (T a b Int) where
with T ~ (,,). Which is what the second line of the error message is telling you, more or less.
No, it's a multi-parameter type, but a single-parameter class. Multi-parameter would be Num a b Int. Roman
On 21/04/15 17:09, Roman Cheplyaka wrote:
On 21/04/15 16:38, Brandon Allbery wrote:
On Tue, Apr 21, 2015 at 9:26 AM, Artyom
mailto:yom@artyom.me> wrote: |$ Temp/jhc-0.8.2/jhc Temp/jhc1.hs
jhc Temp/jhc1.hs jhc 0.8.2 (mydniquipepo-32) Finding Dependencies... Using Ho Cache: '/home/yom/.jhc/cache'
Temp/jhc1.hs:1 - Error: Invalid Class. multiparameter classes not yet supported: (Num,[HsTyTuple [HsTyVar {hsTypeName = a},HsTyVar {hsTypeName = b}]]) |
Am I misunderstanding something, or is it a legitimate bug?
Looks multiparameter to me:
instance ... => Num (T a b Int) where
with T ~ (,,). Which is what the second line of the error message is telling you, more or less.
No, it's a multi-parameter type, but a single-parameter class.
Multi-parameter would be Num a b Int.
Roman
That said, it's not H98 either (ghc would require FlexibleInstances), so jhc may be right in rejecting in, just not explaining it properly. Roman
participants (3)
-
Artyom -
Brandon Allbery -
Roman Cheplyaka