layout question

0 views
Skip to first unread message

Geoffrey Irving

unread,
May 8, 2011, 5:54:08 PM5/8/11
to duck...@googlegroups.com
Currently the following definition of iter fails:

iter :: (a -> ()) -> List a -> ()
iter _ [] = ()
iter f (x:l) = f x; iter f l

The problem is that layout doesn't introduce a '{' after the '=', so
the ';' is treated as starting a new top level declaration. Is this
fixable without introducing other issues?

Geoffrey

Dylan Simon

unread,
May 8, 2011, 6:21:37 PM5/8/11
to duck...@googlegroups.com
From Geoffrey Irving <irv...@naml.us>, Sun, May 08, 2011 at 02:54:08PM -0700:

You would have to change the line in Layout.hs to:

leaderType TokEq = Just Mandatory

I'm not sure how much that would break, though. We also use '=' for PatAs,
which would probably be messed up by that (but could be worked around
probably).

I think the code to consider that would be affected is something like:

f x =
y = x ; y

Geoffrey Irving

unread,
May 8, 2011, 6:42:44 PM5/8/11
to duck...@googlegroups.com

Thanks. Your example seems more important than my iter definition, given that adding a newline fixes the latter, so I'll leave layout the way it is.

Geoffrey

Reply all
Reply to author
Forward
0 new messages