From yom at artyom.me Tue Apr 21 13:26:41 2015 From: yom at artyom.me (Artyom) Date: Tue, 21 Apr 2015 16:26:41 +0300 Subject: [jhc] A possible bug with constraints being perceived as multiparameter type classes Message-ID: <55365011.8070508@artyom.me> 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? ? -------------- next part -------------- An HTML attachment was scrubbed... URL: From allbery.b at gmail.com Tue Apr 21 13:38:26 2015 From: allbery.b at gmail.com (Brandon Allbery) Date: Tue, 21 Apr 2015 09:38:26 -0400 Subject: [jhc] A possible bug with constraints being perceived as multiparameter type classes In-Reply-To: <55365011.8070508@artyom.me> References: <55365011.8070508@artyom.me> Message-ID: On Tue, Apr 21, 2015 at 9:26 AM, Artyom 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. -- brandon s allbery kf8nh sine nomine associates allbery.b at gmail.com ballbery at sinenomine.net unix, openafs, kerberos, infrastructure, xmonad http://sinenomine.net -------------- next part -------------- An HTML attachment was scrubbed... URL: From yom at artyom.me Tue Apr 21 13:45:44 2015 From: yom at artyom.me (Artyom) Date: Tue, 21 Apr 2015 16:45:44 +0300 Subject: [jhc] Is there a working example of type families usage? Message-ID: <55365488.2000805@artyom.me> I tried this: |{-# LANGUAGE TypeFamilies #-} class C xwhere type A x | It fails with this error: |Temp/jhc1.hs:4 - Error: parse error at "}" | Standalone type families don?t work either: |{-# LANGUAGE TypeFamilies #-} type family A x | |Temp/jhc1.hs:3 - Error: parse error at "family" | Is there an example somewhere that I missed while googling? ? -------------- next part -------------- An HTML attachment was scrubbed... URL: From roma at ro-che.info Tue Apr 21 14:09:57 2015 From: roma at ro-che.info (Roman Cheplyaka) Date: Tue, 21 Apr 2015 17:09:57 +0300 Subject: [jhc] A possible bug with constraints being perceived as multiparameter type classes In-Reply-To: References: <55365011.8070508@artyom.me> Message-ID: <55365A35.9040208@ro-che.info> On 21/04/15 16:38, Brandon Allbery wrote: > On Tue, Apr 21, 2015 at 9:26 AM, Artyom > 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 From roma at ro-che.info Tue Apr 21 14:12:05 2015 From: roma at ro-che.info (Roman Cheplyaka) Date: Tue, 21 Apr 2015 17:12:05 +0300 Subject: [jhc] A possible bug with constraints being perceived as multiparameter type classes In-Reply-To: <55365A35.9040208@ro-che.info> References: <55365011.8070508@artyom.me> <55365A35.9040208@ro-che.info> Message-ID: <55365AB5.1040203@ro-che.info> 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 > > 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 From jhc at henning-thielemann.de Tue Apr 21 19:02:28 2015 From: jhc at henning-thielemann.de (Henning Thielemann) Date: Tue, 21 Apr 2015 21:02:28 +0200 (CEST) Subject: [jhc] Is there a working example of type families usage? In-Reply-To: <55365488.2000805@artyom.me> References: <55365488.2000805@artyom.me> Message-ID: On Tue, 21 Apr 2015, Artyom wrote: > I tried this: > > {-# LANGUAGE TypeFamilies #-} > > class C x where > type A x > > It fails with this error: > > Temp/jhc1.hs:4 - Error: parse error at "}" Does JHC already support type families?