
18 May
2007
18 May
'07
12:34 a.m.
ndmitchell:
Hi
* new relies on the Integral type having sensible semantics, if you pass Int or Integer its fine (machine checked), but if you create a crazy type, make it an instance of Integral then [0..n-1] may generate no elements, and your (h:t) match will fail.
Tricky.
You can fix this with:
where (h:ts) = Workspace 0 Empty : [ Workspace i Empty | i <- [1 ..n-1]]
Yep. I was referring more to the fact that funny instances can lead to funny enumFromTos. instances can be evil! -- Don