Here is the list of twenty questions I had about Haskell lexical and syntax
structure which I presented to the East Anglia Workshop in September. I didn't
get a great deal of consensus then, and talking to Ian Holyer (who had a
similar
list) today, I'm reminded to submit them to further scrutiny.

Most of them revolve around the transition into and out of various different
lexically determined parts of the language; in particular free-form and 
layout (although I also use comment and string tokenization quite a bit).

So which of the following twenty programs are syntactically legal 1.2 (or 1.3)
Haskell programs, and why?

Answers next week,

---
David Lester, Dept CS, Manchester University, Manchester M13 9PL UK.


-- begin  1 --

--   end  1 --
-- begin  2 --
{}
--   end  2 --
-- begin  3 --
main = print "\'"
--   end  3 --
-- begin  4 --
main = print '\"'
--   end  4 --
-- begin  5 --
        main = print "5\
\\n"
--   end  5 --
-- begin  6 --
        s = "6\
\\n"
        main = print s
--   end  6 --
-- begin  7 --
main = print ("#" ++ "7\n")
--   end  7 --
-- begin  8 --
main = print s where {s = case () of _ -> "8\n"}
--   end  8 --
-- begin  9 --
main = print s where {s = case () of _ -> "9\n"
}
--   end  9 --
-- begin 10 --
        main = let {s=t where
t = "10\n"} in print s
--   end 10 --
-- begin 11 --
                        main = let {s=t where
t = "11\n"} in print s
--   end 11 --
-- begin 12 --
                        main = let {s=t where
t = "12\n"}
            in print s
--   end 12 --
-- begin 13 --
                        main = let {s=t where
t = "12\n"} {-
 -}         in print s
--   end 13 --
-- begin 14 --
main = print s
s = if True then case () of "14\n" else "error\n"
--   end 14 --
-- begin 15 --
main = case "" of (x:xs) -> "error\n"
                  []     -> case () of
  _ -> print "15\n"
--   end 15 --
-- begin 16 --
main = case "" of (x:xs) -> "error\n"
                  []     -> case () of
                  _ -> print "16\n"
--   end 16 --
-- begin 17 --
main = case "" of  []     -> case () of
 _ -> print "17\n" (x:xs) -> "error\n"
--   end 17 --
-- begin 18 --
main = case "" of  (x:xs) -> "error\n" {-
 -}                []     -> "18\n"
--   end 18 --
-- begin 19 --
main = print "19\n"
module A where
loop = loop
--   end 19 --
-- begin 20 --
           module Main where
main = print "20\n"
            module A where
                loop = loop
--   end 20 --



Reply via email to