
15 Oct
2009
15 Oct
'09
12:08 a.m.
Martijn van Steenbergen wrote:
It doesn't work for this one:
newtype Split a = Split { runSplit :: [Either a (Char, Split a) ]}
But my handwritten instance remains identical.
The instance has the form [], not the form [Either _ (Char, Split _)]. Since they don't match exactly, it won't give you an instance automagically. It could have been the case that you intended some other instance besides []'s. All generalized newtype deriving does is derive instances for newtypes that wrap exactly what the instance is defined over. - Jake