Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

List type signatures

Tags:

haskell

This makes sense:

test :: [[Int]]
test = [[]]

main = print test

But why does this compile (and run)?

test :: [[Int]]
test = []

main = print test
like image 379
zoran119 Avatar asked Nov 21 '25 09:11

zoran119


1 Answers

[[Int]] is list of lists (of Int's) and

  • [[]] - list with one empty list inside
  • [] - empty list
like image 142
Alexander VoidEx Ruchkin Avatar answered Nov 23 '25 01:11

Alexander VoidEx Ruchkin



Donate For Us

If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!