
21 Dec
2007
21 Dec
'07
2:55 p.m.
Chad Scherrer
A while back I was playing with Data.Map was getting irritated about lookups that fail having the type of values, but wrapped in an extra monad. I decided to work around this by putting a default in the data type itself, so we have a "functional map"
data FMap k a = FMap (k -> a) (Map k a)
... Sorry to respond to my own message, but I think I might have figured it out. This should be strict in the Map parameter, so this works better: data FMap k a = FMap (k -> a) !(Map k a) It still takes lots of memory for what I'm trying to do, but that's another problem. At least the stack seems happy. Chad