-
Notifications
You must be signed in to change notification settings - Fork 65
Whitespace DSL Proposal
Cyrus Omar edited this page May 14, 2013
·
4 revisions
How about this?
-- single argument
f e
-- two-indent equivalent to: f e
f
e
-- multi-argument
f e1 e2 e3
-- arguments on own lines
f e1
e2
e3
-- what should this mean?
f
e1 e2
-- I think it should be f (e1 e2)
-- similar to Haskell's f $ e1 e2
-- and F#'s f <| e1 e2
-- explicitly-delimited DSL
f `d`
-- four-indent delimited DSL
f ~
d
-- multi-argument, trailing DSL
f e1 ~
d
-- multi-argument, DSL in middle
f e1
e2
~
d1
e3
-- DSL in argument function call
-- equiv to f e1 (e2 `d1`) e3
f e1
e2 ~
d1
e3
-- nested calls
-- equiv to f e1 (e2 e3 e4) e5
f e1
e2
e3
e4
e5
-- probably a syntax error
-- (wrong number of spaces after ~)
f e1
e2 ~
d1
e3
-- multi-argument, sequential multi-DSL
f ~
d1
~
d2