[Haskell-cafe] "Inconsistency" in support for phantom types?

Miguel Mitrofanov miguelimo38 at yandex.ru
Thu Jan 8 15:34:39 EST 2009


On 8 Jan 2009, at 23:11, DavidA wrote:

> inv :: IntegerAsType n => Fp n -> Fp n
                        ^       ^       ^
this "n" --------------+-------+-------|

> inv 0 = error "Fp,inv 0"
> inv (Fp x) = let p = value (undefined :: n)
                                            ^
and this one ------------------------------|

are different beasts.

You can try something like this:

getN :: Fp n -> n
getN _ = undefined

inv a@(Fp x) = let p = value $ getN a
...



More information about the Haskell-Cafe mailing list