Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Set different indent policy for preamble #349

Open
yutotakano opened this issue Jun 19, 2021 · 0 comments
Open

Set different indent policy for preamble #349

yutotakano opened this issue Jun 19, 2021 · 0 comments

Comments

@yutotakano
Copy link

I'd love it if it were possible to use IndentPolicyFree on the module preamble, but IndentPolicyLeft on the body code.

IndentPolicyFree

import           Control.Monad                  ( guard
                                                , unless
                                                , void
                                                )
import           Control.Monad.IO.Class         ( MonadIO )
import           Data.Maybe                     ( catMaybes )

item = Item
    { aField       = "mhm"
    , anotherField = \x ->
                         case
                                 complexFunction
                                     123
                                     (anotherComplexFunction x Nothing)
                             of
                                 Left  e -> Nothing
                                 Right y -> Just [y]
    }

IndentPolicyLeft & IndentPolicyMultiple

import Control.Monad (guard, unless, void)
import Control.Monad.IO.Class (MonadIO)
import Data.Maybe (catMaybes)

item = Item
    { aField       = "mhm"
    , anotherField = \x ->
        case complexFunction 123 (anotherComplexFunction x Nothing) of
            Left  e -> Nothing
            Right y -> Just [y]
    }

My goal is to achieve the import list of the former, with the body formatted as the latter. Specifically, I dislike how in the former result, complexFunction and the Left/Right are indented to (4n + 1) spaces! It looks like a hanging indent from \x, but this is quite ugly.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

2 participants