Hi David!
2008/11/12 David Fox [EMAIL PROTECTED]:
I want to use Data.Generics to write a function to turn all the Nothings in
a data structure into Just defaultValue, as shown below. I get the
following error because the compiler doesn't know enough about Maybe a for
mkT to create the
I want to use Data.Generics to write a function to turn all the Nothings in
a data structure into Just defaultValue, as shown below. I get the
following error because the compiler doesn't know enough about Maybe a for
mkT to create the generic function that everywhere requires, I guess.
Hello,
I can *almost* do it like this:
test = (id `ext1T` justDefault) (defaultValue :: A)
justDefault :: forall f. (Default f, Data f) = Maybe f - Maybe f
justDefault Nothing = defaultValue
justDefault (Just x) = Just x
Except it fails with:
Could not deduce (Default d1) from the