21 Aug 2012 11:45
Problem with default signatures
Jeroen Weijers <jeroenweijers <at> gmail.com>
2012-08-21 09:45:06 GMT
2012-08-21 09:45:06 GMT
Hello,
I am trying to create some code involving type families and default signatures. I am getting a type error
that I do not understand (as far as I can see the error is wrong).
I removed all code that doesn't contribute to the error:
> {-# LANGUAGE DeriveGeneric, UndecidableInstances, DefaultSignatures, TypeOperators, GADTs,
FlexibleContexts, TypeFamilies, FlexibleInstances #-}
> module Database.DSH.Problem where
>
> import GHC.Generics
>
> data Exp a where
> UnitE :: Exp ()
> ListE :: [Exp a] -> Exp [Exp a]
>
> class GenericQA f where
> type GRep f
> type AltGRep f
> type AltGRep f = [Exp (GRep f)]
> gToExp :: f a -> Exp (GRep f)
> emptyAlt :: Exp (AltGRep f)
> default emptyAlt :: (AltGRep f ~ [Exp (GRep f)]) => Exp (AltGRep f)
> emptyAlt = ListE []
>
> instance GenericQA U1 where
> type GRep U1 = ()
> gToExp U1 = UnitE
(Continue reading)
RSS Feed