diff --git a/ats-format.cabal b/ats-format.cabal
--- a/ats-format.cabal
+++ b/ats-format.cabal
@@ -1,5 +1,5 @@
 name:                ats-format
-version:             0.1.0.21
+version:             0.1.0.22
 synopsis:            A source-code formatter for ATS
 description:         An opinionated source-code formatter for [ATS](http://www.ats-lang.org/).
 homepage:            https://hub.darcs.net/vmchale/ats-format#readme
diff --git a/man/atsfmt.1 b/man/atsfmt.1
--- a/man/atsfmt.1
+++ b/man/atsfmt.1
@@ -1,4 +1,4 @@
-.\" Automatically generated by Pandoc 2.0.6
+.\" Automatically generated by Pandoc 2.1
 .\"
 .TH "atsfmt (1)" "" "" "" ""
 .hy
diff --git a/src/Language/ATS/Lexer.x b/src/Language/ATS/Lexer.x
--- a/src/Language/ATS/Lexer.x
+++ b/src/Language/ATS/Lexer.x
@@ -15,6 +15,7 @@
                               , Addendum (..)
                               , lexATS
                               , token_posn
+                              , to_string
                               ) where
 
 import Data.Data (Typeable, Data)
@@ -436,6 +437,9 @@
     pretty DoubleBracesTok{} = "{}"
     pretty DoubleBracketTok{} = "<>"
     pretty SpecialBracket{} = "{"
+
+to_string (CommentLex _ s) = s
+to_string _ = mempty
 
 token_posn (Identifier p _) = p
 token_posn (IdentifierSpace p _) = p
diff --git a/src/Language/ATS/Parser.y b/src/Language/ATS/Parser.y
--- a/src/Language/ATS/Parser.y
+++ b/src/Language/ATS/Parser.y
@@ -15,6 +15,7 @@
                           , Keyword (..)
                           , Addendum (..)
                           , token_posn
+                          , to_string
                           )
 
 import Data.Char (toLower)
@@ -166,7 +167,7 @@
     openExistential { Operator $$ "#[" } -- Same as `[` in ATS2
     cblock { CBlockLex _ $$ }
     define { MacroBlock _ $$ }
-    lineComment { CommentLex _ $$ }
+    lineComment { $$@CommentLex{} }
     lspecial { SpecialBracket $$ }
     atbrace { Operator $$ "@{" }
     mod { Keyword $$ KwMod }
@@ -398,6 +399,7 @@
               | prfTransform {% Left $ Expected $1 "Expression" ">>" }
               | maybeProof {% Left $ Expected $1 "Expression" "?" }
               | let openParen {% Left $ Expected $1 "Expression" "let (" }
+              | let ATS in Expression lineComment {% Left $ Expected (token_posn $5) "end" (take 2 $ to_string $5) }
 
 -- | Parse a termetric
 Termetric : openTermetric StaticExpression closeTermetric { ($1, $2) }
@@ -596,7 +598,7 @@
             | define identifierSpace string { Define ($1 ++ $2 ++ $3) } -- FIXME better approach?
             | define identifierSpace int { Define ($1 ++ $2 ++ " " ++ show $3) }
             | cblock { CBlock $1 }
-            | lineComment { Comment $1 }
+            | lineComment { Comment (to_string $1) }
             | staload underscore eq string { Staload (Just "_") $4 }
             | staload string { Staload Nothing $2 }
             | staload IdentifierOr eq string { Staload (Just $2) $4 }
diff --git a/src/Language/ATS/PrettyPrint.hs b/src/Language/ATS/PrettyPrint.hs
--- a/src/Language/ATS/PrettyPrint.hs
+++ b/src/Language/ATS/PrettyPrint.hs
@@ -126,8 +126,12 @@
     pretty = cata a . rewriteATS where
         a (IfF e e' (Just e''))         = "if" <+> e <+> "then" <$> indent 2 e' <$> "else" <$> indent 2 e''
         a (IfF e e' Nothing)            = "if" <+> e <+> "then" <$> indent 2 e'
-        a (LetF _ e (Just e'))          = "let" <$> indent 2 (pretty ((\(ATS x) -> ATS $ reverse x) e)) <$> "in" <$> indent 2 e' <$> "end" -- TODO soft linebreak?
-        a (LetF _ e Nothing)            = "let" <$> indent 2 (pretty ((\(ATS x) -> ATS $ reverse x) e)) <$> "in end"
+        a (LetF _ e (Just e'))          = flatAlt
+            ("let" <$> indent 2 (pretty ((\(ATS x) -> ATS $ reverse x) e)) <$> "in" <$> indent 2 e' <$> "end")
+            ("let" <+> pretty ((\(ATS x) -> ATS $ reverse x) e) <$> "in" <+> e' <$> "end")
+        a (LetF _ e Nothing)            = flatAlt
+            ("let" <$> indent 2 (pretty ((\(ATS x) -> ATS $ reverse x) e)) <$> "in end")
+            ("let" <+> pretty ((\(ATS x) -> ATS $ reverse x) e) <$> "in end")
         a (BoolLitF True)               = "true"
         a (BoolLitF False)              = "false"
         a (TimeLitF s)                  = string s
@@ -170,7 +174,7 @@
         a (CharLitF c)                 = "'" <> char c <> "'"
         a (ProofExprF _ e e')          = "(" <> e <+> "|" <+> e' <> ")"
         a (TypeSignatureF e t)         = e <+> ":" <+> pretty t
-        a (WhereExpF e d)              = e <+> "where" <$> braces (" " <> nest 2 (pretty (ATS d)) <> " ")
+        a (WhereExpF e d)              = e <+> "where" <$> braces (" " <> nest 2 (pretty (ATS $ reverse d)) <> " ")
         a (TupleExF _ es)              = prettyArgs es -- parens (mconcat $ punctuate ", " (reverse es))
         a (WhileF _ e e')              = "while" <> parens e <> e'
         a (ActionsF as)                = "{" <$> indent 2 (pretty ((\(ATS x) -> ATS $ reverse x) as)) <$> "}"
