[Haskell-cafe] Haskell spec vs FlexibleInstances
Karl Voelker
karl at karlv.net
Fri Feb 28 01:32:07 UTC 2014
The spec doesn't allow multi-parameter type classes at all, so I don't see how you could run into this problem while writing extensionless Haskell.
I guess it's still a valid question whether the MultiParamTypeClasses extension should allow repeated type parameters.
-Karl
On Feb 18, 2014, at 12:53 PM, AntC <anthony_clayden at clear.net.nz> wrote:
>> Doug McIlroy <doug <at> cs.dartmouth.edu> writes:
>>
>> What potential evil motivates the prohibition of repeated type
>> parameters in an instance declaration?
>
> Hi Doug,
>
> I guess the first reason would be to catch accidental duplicate names of
> typevars.
>
> But as to "potential evils", the only point of such an instance:
>
> instance C a a where ...
>
> would be to have another instance:
>
> instance C a b where ...
>
> So we're into overlapping instances. (And discriminating on type equality -
> - which only works if the types are grounded. See the HList paper, section
> 9 'By chance or design?')
>
> Overlapping instances like that will probably need FunDeps. So the more
> recent (and probably more blessed) approach is to use the Closed type
> families/branched instances doo-hicky upcoming with GHC 7.8.
> http://www.haskell.org/haskellwiki/GHC/Indexed_types#Type_instance_declarat
> ions
>
> AntC
>
>
>
> _______________________________________________
> Haskell-Cafe mailing list
> Haskell-Cafe at haskell.org
> http://www.haskell.org/mailman/listinfo/haskell-cafe
More information about the Haskell-Cafe
mailing list