Closed crockeea closed 9 years ago
I think you just need an extra class for forcing symbols:
class NFSym sym
where
rnfSym :: sym sig -> ()
instance NFSym sym => NFData (AST sym sig)
where
rnf (Sym s) = rnfSym s
rnf (s :$ a) = rnf s `seq` rnf a
What's the best way to force evaluation of an AST? I tried to define an
NFData
instance (from Control.Deepseq) forAST dom a
, but the existential types in the constructors cause problems. Is there any hope for anNFData
instance? What about other ways to ensure that the tree is fully evaluated?