the dreaded offside rule
lennart at augustsson.net
Thu Mar 9 08:09:36 EST 2006
If you can parse "do x == y == z" or "case 0 of x -> x == x == True"
you're probably ok. I can't tell from your example if this works
Doaitse Swierstra wrote:
> On 2006 mrt 09, at 1:54, Lennart Augustsson wrote:
>> I agree with it being complicated. I don't know of any compiler
>> that implements it correctly. Do you say your combinators do?
> At least we think so. The way to use it is e.g.:
> pExprPrefix = sem_Expr_Let <$ pKey "let" <*> pDecls <* pKey "in"
> pDecls = foldr sem_Decls_Cons sem_Decls_Nil
> <$> pBlock pOCurly pSemi
> pCCurly pDecl
> pDecl = sem_Decl_Val <$> pPatExprBase <* pKey
> "=" <*> pExpr
> <|> sem_Decl_TySig <$> pVar <* pKey
> "::" <*> pTyExpr
> in which the pBlock takes care of the offside rule, in cooperation with
> the scanner.
>> That said, I don't think it can be replaced easily without breaking
>> existing code, so I'm unwilling to change unless someone can show
>> an alternative that handles 99.9% of the existing code.
> There are solutions to this kind of transitions. Compilers could admit
> the old rule, and emit a warning when e.g. the
> --this-is-supposed-to-be-strictly-haskell-prime flag is passed. One
> might also equip a compiler to transform one's program into the new
More information about the Haskell-prime