Skip to content

Instantly share code, notes, and snippets.

@guibou
Last active February 18, 2021 09:43
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save guibou/fde83fe0b10a34dbcd5ff794e0e8077d to your computer and use it in GitHub Desktop.
Save guibou/fde83fe0b10a34dbcd5ff794e0e8077d to your computer and use it in GitHub Desktop.
Work in progress on GHC context for the parser
{-# LANGUAGE TypeApplications #-}
-- Based on https://gitlab.haskell.org/ghc/ghc/-/issues/19097#note_321796
{-
action NewEventAction = do
now <- getCurrentTime
let event = newRecord @Event
|> set #createdAt now -- THIS LINE NEEDS MORE INDENTATION
render NewView { .. }
-}
foo x y z = bar [(x, y, z),
(y, x, z,
(x, x, y),
(y, y, y)
data Chicken = CotCotCot
zig = [1,2,3] ++ [4,5
bar a b c d = print ((a, b, c, d) + "hello"
fact n = product [1..n]
bar = let
a = 5
in
boz = let
a = 5
biz a = case a
buz = 1 + 1
blop = [1,2,3,3]
{-
blurk = let
a = 5
in {}
-}
buz = do
if
if True
if +2
if 2 ++ 2
if True then
if True then True
if True then True else
if True then True else True
ParseErrorTest.hs:16:1: error:
parse error (possibly incorrect indentation or mismatched brackets)
|
16 | data Chicken = CotCotCot
| ^
ParseErrorTest.hs:11:17: error: opening bracket is here
|
11 | foo x y z = bar [(x, y, z),
| ^
ParseErrorTest.hs:12:13: error: opening brace is here
|
12 | (y, x, z,
| ^
ParseErrorTest.hs:16:1: error: missing closing list bracket ']'
|
16 | data Chicken = CotCotCot
| ^
ParseErrorTest.hs:16:1: error: missing closing tuple brace ')'
|
16 | data Chicken = CotCotCot
| ^
ParseErrorTest.hs:18:18: error: opening bracket is here
|
18 | zig = [1,2,3] ++ [4,5
| ^
ParseErrorTest.hs:20:1: error: missing closing list bracket ']'
|
20 | bar a b c d = print ((a, b, c, d) + "hello"
| ^
ParseErrorTest.hs:20:21: error: opening brace is here
|
20 | bar a b c d = print ((a, b, c, d) + "hello"
| ^
ParseErrorTest.hs:22:1: error: missing closing brace ')'
|
22 | fact n = product [1..n]
| ^
ParseErrorTest.hs:26:3: error: 'in' is here
|
26 | in
| ^^
ParseErrorTest.hs:28:1: error: missing body in 'let/in' clause
|
28 | boz = let
| ^
ParseErrorTest.hs:28:7: error: 'let' is here
|
28 | boz = let
| ^^^
ParseErrorTest.hs:31:1: error: missing 'in' in 'let/in' clause
|
31 | biz a = case a
| ^
ParseErrorTest.hs:31:9: error: 'case' is here
|
31 | biz a = case a
| ^^^^
ParseErrorTest.hs:33:1: error: missing 'of' in 'case' clause
|
33 | buz = 1 + 1
| ^
ParseErrorTest.hs:43:5: error: 'if' is here
|
43 | if
| ^^
ParseErrorTest.hs:44:5: error: 'if' is here
|
44 | if True
| ^^
ParseErrorTest.hs:45:5: error: 'if' is here
|
45 | if +2
| ^^
ParseErrorTest.hs:45:7: error: missing 'then' clause
|
45 | if +2
| ^
ParseErrorTest.hs:45:9: error: parse error in 'if' condition
|
45 | if +2
| ^
ParseErrorTest.hs:46:5: error: 'if' is here
|
46 | if 2 ++ 2
| ^^
ParseErrorTest.hs:46:7: error: missing 'then' clause
|
46 | if 2 ++ 2
| ^
ParseErrorTest.hs:47:7: error: missing 'then' clause
|
47 | if True then
| ^
ParseErrorTest.hs:47:13: error: 'then' is here
|
47 | if True then
| ^^^^
ParseErrorTest.hs:48:5: error: parse error in 'then' clause
|
48 | if True then True
| ^
ParseErrorTest.hs:48:13: error: 'then' is here
|
48 | if True then True
| ^^^^
ParseErrorTest.hs:49:7: error: missing 'else' clause
|
49 | if True then True else
| ^
ParseErrorTest.hs:49:23: error: 'else' is here
|
49 | if True then True else
| ^^^^
ParseErrorTest.hs:50:5: error: parse error in 'else' clause
|
50 | if True then True else True
| ^
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment