Data.Fixed.Fixed constructor

Ashley Yakeley ashley at semantic.org
Thu Jul 23 23:21:31 EDT 2009


David Menendez wrote:

> instance Data Double where
>   toConstr = mkFloatConstr floatType   -- that should probably be "doubleType"
>   gunfold _ z c = case constrRep c of
>                     (FloatConstr x) -> z x
>                     _ -> error "gunfold"
>   dataTypeOf _ = doubleType

I could do something like this for Fixed, but deriving Fixed 
automatically does essentially the same thing.

> Alternatively, you could make Fixed non-representable like Ptr,

Why? Fixed morally is data.

-- 
Ashley Yakeley


More information about the Libraries mailing list