Last active
August 29, 2015 14:26
-
-
Save andrevdm/99856aa95db4353864d0 to your computer and use it in GitHub Desktop.
Tabs in haskell
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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