
23 Oct
2002
23 Oct
'02
12:09 a.m.
G'day all. On Thu, Oct 17, 2002 at 11:08:57AM -0400, haskell-cafe-admin@haskell.org wrote:
For an interpreter I'm writing, I found myself writing a function "constructVarExpr :: String -> Expr" just to make it easier.
As an alternative opinion, I don't think there's anything wrong with this. A constructor is just a function, and if you need to do more work than just construct one constructor, there's no reason not to use a real function. In OO design pattern terminology they call this a "factory function", though in Haskell the term "smart constructor" might also apply if the function does real work. Were the wiki working, I would point you to the relevant page there, but it isn't, so I won't. Cheers, Andrew Bromage