Adrian May wrote:
bleed :: Account -> Flow -> Bool
feed :: Account -> Flow -> Bool
bleed (SimpleA n sd sb) (SimpleF src dest rule) = (n == src)
feed (SimpleA n sd sb) (SimpleF src dest rule) = (n == dest)
bleed (CompoundA []) f = False
feed (CompoundA []) f = False
bleed (CompoundA (a:al)) f = (bleed a f) || (bleed (CompoundA al) f)
feed (CompoundA (a:al)) f = (feed a f) || (feed (CompoundA al) f)
pg 53 of the H98 report says
"Note that all clauses defining a function must be contiguous".
In the code above, you have feed and bleed defined together.
I admit this is a bit obscure, but you only need to learn
it once :-)
Try:
bleed :: Account -> Flow -> Bool
feed :: Account -> Flow -> Bool
feed (SimpleA n sd sb) (SimpleF src dest rule) = (n == dest)
feed (CompoundA []) f = False
feed (CompoundA (a:al)) f = (feed a f) || (feed (CompoundA al) f)
bleed (SimpleA n sd sb) (SimpleF src dest rule) = (n == src)
bleed (CompoundA []) f = False
bleed (CompoundA (a:al)) f = (bleed a f) || (bleed (CompoundA al) f)
This should work.
Andy Gill