On Jun 27, 2009, at 20:37 , Geoffrey Irving wrote:
   "The last statement in a 'do' construct must be an expression"


Right, the "where" terminates the entire expression, you can't use it in the middle like that. I'm pretty sure that's mandatory per the standard, and nobody really wants to open the can of worms involved with allowing its nested use as an extension. (Layout is hard enough to parse already; IIRC, strictly speaking, the behavior specified in the standard is impossible to implement, and even "almost right" is extremely difficult.) Use a subsidiary "let" instead:

           caseType (c,vl,e')
             | Just tl <-
                let a = length tl
                in List.lookup c cases =
                 if length vl == a then
expr prog global (foldl (\e (v,t) -> Map.insert v t e) env (zip vl (map (subst tenv) tl))) e'
                 else
typeError ("arity mismatch in pattern: "++show (pretty c)++"expected"++show a++" argument"++(if a == 1 then "" else "s") ++" but got ["++concat (intersperse ", " (map (show . pretty) vl))++"]")


--
brandon s. allbery [solaris,freebsd,perl,pugs,haskell] [email protected]
system administrator [openafs,heimdal,too many hats] [email protected]
electrical and computer engineering, carnegie mellon university    KF8NH


Attachment: PGP.sig
Description: This is a digitally signed message part

_______________________________________________
Haskell-Cafe mailing list
[email protected]
http://www.haskell.org/mailman/listinfo/haskell-cafe

Reply via email to