[Haskell-cafe] Haskell scripting system (please help me simplify
joelr1 at gmail.com
Thu Oct 27 12:16:18 EDT 2005
On Oct 27, 2005, at 4:59 PM, Robert Dockins wrote:
> You could consider creating a monad for the "unstuff" part of the
> operation that would hide dealing with the FastString, the tupling
> and the case analysis on Maybe.
Could you elaborate on this a bit please? How would I write and use
such a monad?
> If you end up doing a lot of instances like this, the monad could
> well be a win; it also gives you the opportunity to add error
> reporting during the parse if you want.
This is exactly the problem I'm facing now. Parsing is failing and I
need to take apart my pure code just for testing. How would you code
> As a side note, I see you are doing a bunch of operations on lists
> of properties. If performance is an issue, you might want to
> consider using Data.Map or similar. If your properties lists can
> get big, mergeprops looks like a potential problem ( O( n*(n+m) )
> each time it's called ).
What would I use as the key for each map entry? If I knew this then I
could use a map :-). As it stands, each property is a solid chunk and
I can't even extract the name of the attribute it was created with. I
don't think Map lets me index on Strings, does it?
Since I end up modifying properties a lot I think I sould use monads
but I need to read up to get a clear picture.
More information about the Haskell-Cafe