Skip to content

Instantly share code, notes, and snippets.

@andrevdm
Last active August 29, 2015 14:26
Show Gist options
  • Save andrevdm/99856aa95db4353864d0 to your computer and use it in GitHub Desktop.
Save andrevdm/99856aa95db4353864d0 to your computer and use it in GitHub Desktop.
Tabs in haskell
main = do
let x = "123"
y = "456"
in putStrLn (x ++ y)
{-
Simple example in haskell.
This works (tabs=8)
main = do
let x = "123"
y = "456"
in putStrLn (x ++ y)
This wont (tabs=4, replaces with spaces to show result)
main = do
let x = "123"
y = "456"
in putStrLn (x ++ y)
This is how it would look with spaces for alignment
main = do
let x = "123"
y = "456"
in putStrLn (x ++ y)
---
Strictly speaking that's not 100% accurate, because the haskell compiler will assume tabs = 8.
But if you editor has tabs = 4 then you need to write what looks like syntactically invalid haskell
for it to be correct. Meaning that you would almost certainly write what appeared to be valid code but would
be syntactically invalid
-}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment