Add list sugar
This commit is contained in:
19
tests/ListSugar.newt
Normal file
19
tests/ListSugar.newt
Normal file
@@ -0,0 +1,19 @@
|
||||
module ListSugar
|
||||
|
||||
import Prelude
|
||||
|
||||
|
||||
blah : List Int
|
||||
blah = [ 1, 2, 3]
|
||||
|
||||
bar : List Int → Int
|
||||
bar [ ] = 0
|
||||
bar [x] = 1
|
||||
bar _ = 42
|
||||
|
||||
main : IO Unit
|
||||
main = do
|
||||
printLn blah
|
||||
printLn $ bar []
|
||||
printLn $ bar [ 42 ]
|
||||
printLn $ bar blah
|
||||
4
tests/ListSugar.newt.golden
Normal file
4
tests/ListSugar.newt.golden
Normal file
@@ -0,0 +1,4 @@
|
||||
[1, 2, 3]
|
||||
0
|
||||
1
|
||||
42
|
||||
Reference in New Issue
Block a user