[Haskell-cafe] Re: Functional dependencies and Peano numbers (and hoogle-bug?)

Oscar Finnsson oscar.finnsson at gmail.com
Thu Jul 15 15:42:29 EDT 2010

Thanks for the great feedback. The bijective example was especially interesting.

While reading "Fun with Type Functions" I notices GNum as an
interesting alternative to the Num type class but I couldn't find any
such package on hackagedb. Do anyone know if there is anything like
GNum on hackagedb?

On an unrelated note:

I hoogled "to" (i.e. http://haskell.org/hoogle/?hoogle=to) and just
got a blank page. Nothing. Nil (not even <html>...</html>). Is this a
bug or a "feature"? :) The reason I hoogled it was because I'm
searching for something like explicit casting found in many other
languages, something similar to

> class To f t where
>   to :: f -> t
> instance To a a where
>   to x = x
> instance (Real a, Fractional b) => To a b where
>   to = realToFrac
> instance (Read a) => To String (Maybe a) where
>   to = maybeRead  -- not from cgi :)

so I can write something like

> ("23.2" `to`) :: Maybe Double


> ((42 :: Integer) `to`) :: Float

Anyone made a module/package that solves this problem already? I
cannot be the first that needs generic type safe conversion... .

-- Oscar

More information about the Haskell-Cafe mailing list