Skip to content

Instantly share code, notes, and snippets.

@nixorn
Last active March 9, 2019 12:14
Show Gist options
  • Save nixorn/a7b18badb8375e5d506a1542e7dd1937 to your computer and use it in GitHub Desktop.
Save nixorn/a7b18badb8375e5d506a1542e7dd1937 to your computer and use it in GitHub Desktop.
Test programm to check parser for https://github.com/google/codeworld/issues/798
program = drawingOf(codeWorldLogo)
testIndent i = t1 i
where t1 i = 2 + t2 i
where t2 i = (t3 i) ** 2
where t3 i = i - 3
testIndent 0 = 5
pic1,pic2 :: Picture
pic1 = codeWorldLogo
pic2 = codeWorldLogo
f(x) = sqrt(x + 1) -- should make docs like f :: ? -> ?
short :: Number -- should delete excess whitespaces
reallyReallyVeryVeryLong :: Number
(short, reallyReallyVeryVeryLong) = (5, 6)
-- The first line will match and add a hint for {-, thinking that it's being defined. Oops.
{- ==================
Some block comment
================== -}
-- This is actually a definition of the *&* operator, but will be misparsed as a definition for the symbol a*&*b.
a*&*b = a + 2 * b
-- missed because parsing only looks at one line at a time.
f1(x, y)
= x + y
-- Another improvement that's needed is to add locally declared data constructors to the auto-complete list.
data Test = Test
-- GADT syntax
data Foo where
Constructor1 :: Foo
Constructor2 :: T -> Foo
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment