Der Blog

Type inference rocks

I just wrote the following snippet of code for my dissertation:

intNatI :: Int :~= Nat
intNatI = Iso {
            to   = fromInteger . toInteger,
            from = fromInteger . toInteger }

The components to and from have totally different types (to is Int -> Nat, from is Nat -> Int). Yay for type inference! :)

[ Entry posted at: Mon 28 May 2007 01:24:46 BST | 0 comment(s)... | Cat: Geeky ]

Add Comment

Validate : XHTML / CSS / RSS / ATOM