Changes between Version 7 and Version 8 of NewtypeWrappers
- Jun 28, 2013 10:36:05 AM (2 years ago)
v7 v8 197 197 data NT a b -- abstract 198 198 coerce :: NT a b -> a -> b 199 refl :: NT a a 200 sym :: NT a b -> NT b a 201 trans :: NT a b -> NT b c -> NT a c 199 refl :: NT a a 200 sym :: NT a b -> NT b a 201 trans :: NT a b -> NT b c -> NT a c 202 202 }}} 203 203 and the intention that `NT a b` is a witness that `a` and `b` have the same representation and that `coerce n` has zero runtime cost. … … 212 212 213 213 This solves the abstraction problem for `Data.Map`: The library author only exports `NT a b -> NT (Map k a) (Map k b)`, but not NT a b -> NT (Map a v) (Map b v)`. 214 215 216 217 214 218 215 219 Of course with an `NT` data type, it is possible to define this type class, e.g.