Problem
hindent changes the meaning of the formatted code, which would make unattended formatting rather dangerous.
$ cat test.hs
{-# LANGUAGE CPP #-}
main = print (g && f1)
where
f1 = h
where
h = True
#ifdef C1
g = g1
where
g1 = g2
where
g2 = False
#else
g = True
#endif
#ifndef C1
g = False
#endif
$ runhaskell test.hs
True
$ hindent --version
hindent 5.2.7
$ hindent test.hs
$ runhaskell test.hs
False
Actual output haskell
{-# LANGUAGE CPP #-}
main = print (g && f1)
where
f1 = h
where
h = True
#ifdef C1
g = g1
where
g1 = g2
where
g2 = False
#else
g = True
#endif
#ifndef C1
g = False
#endif
Perhaps there should be a way to disable parsing of CPP directives to reject this program.
Problem
hindentchanges the meaning of the formatted code, which would make unattended formatting rather dangerous.Actual output haskell
{-# LANGUAGE CPP #-} main = print (g && f1) where f1 = h where h = True #ifdef C1 g = g1 where g1 = g2 where g2 = False #else g = True #endif #ifndef C1 g = False #endifPerhaps there should be a way to disable parsing of CPP directives to reject this program.