
15 Jan
2002
15 Jan
'02
2:07 a.m.
At 2002-01-15 00:00, Ketil's local user wrote:
When recently reading the GHC docs, the chapter about profiling, I think, I came across something about this. From Chapter 6:
| Newtypes are better than datatypes: | | If your datatype has a single constructor with a single field, | use a newtype declaration instead of a data declaration. The newtype | will be optimised away in most cases
Does that help? data (,) a b = (,) a b; newtype Pair v w a = P (v a, w a); vs. data Pair v w a = P (v a) (w a); and data () = (); newtype Empty a = E (); vs. data Empty a = E; -- Ashley Yakeley, Seattle WA
8526
Age (days ago)
8526
Last active (days ago)
0 comments
1 participants
participants (1)
-
Ashley Yakeley