data Foo = Foo
{ foo :: Int
, bar :: String
, baz :: Bool
, quux :: Maybe Int
, a :: Char
, b :: Bool
} deriving (Eq, Show)
handleFoo :: Foo -> IO ()
handleFoo foo = case foo of
Foo { foo = 42
, bar = "abcdefghijklmnopqrstuvwxyz"
, baz = True
, quux = Just 1 } -> putStrLn "bingo!"
_ -> return ()
buildFoo :: Foo
buildFoo = Foo
{ foo = 42
, bar = "abcdefghijklmnopqrstuvwxyz"
, baz = True
, quux = Just 1
, a = 'z'
, b = 'b'
}
produces:
data Foo = Foo
{ foo :: Int
, bar :: String
, baz :: Bool
, quux :: Maybe Int
, a :: Char
, b :: Bool
} deriving (Eq, Show)
handleFoo :: Foo -> IO ()
handleFoo foo = case foo of
Foo { foo = 42, bar = "abcdefghijklmnopqrstuvwxyz", baz = True, quux = Just 1 }
-> putStrLn "bingo!"
_ -> return ()
buildFoo :: Foo
buildFoo = Foo
{ foo = 42
, bar = "abcdefghijklmnopqrstuvwxyz"
, baz = True
, quux = Just 1
, a = 'z'
, b = 'b'
}
Notice the inconsistency in layout for pattern match versus record construction. Also, the layout it chose exceeds the maximum characters per line limit.
Running brittany on the following program:
produces:
Notice the inconsistency in layout for pattern match versus record construction. Also, the layout it chose exceeds the maximum characters per line limit.