[Haskell-cafe] difference between type and newtype

Andrea Rossato mailing_list at istitutocolli.org
Fri Aug 25 21:11:10 EDT 2006


Il Sat, Aug 26, 2006 at 01:27:38AM +0200, Daniel Fischer ebbe a scrivere:
> unT1 :: T1 a -> T a
> unT1 (T1 f) = f
> 
> makeT1 a b = unT1 (mkT1 a) b
> 
> will work fine.

*Prelude> :t makeT1
makeT1 :: a -> Int -> (a, Int)
*Prelude> 

not that fine, though. Quite useless.

try chancing to:

> unT1 :: T1 a -> T1 a
                 ^^^^
> unT1 (T1 f) = f

All the best
andrea


More information about the Haskell-Cafe mailing list