As for BlockArguments
in particular:
{-# LANGUAGE BlockArguments #-}
module BlockArgsBedlam where
f :: a -> b -> Char
f _ _ = '?'
mt :: IO ()
mt = putChar '~'
mu :: Maybe Bool
mu = Just True
test1 = f do mt
test2 = f do mu
test3 = f do mt do mu
test4 = f do mt $ do mu
…which GHCi rejects:
# ghci BlockArgsBedlam.hs GHCi, version 9.4.4: https://www.haskell.org/ghc/ :? for help [1 of 1] Compiling BlockArgsBedlam ( BlockArgsBedlam.hs, interpreted ) BlockArgsBedlam.hs:17:14: error: • Couldn't match expected type: Maybe Bool -> a0 with actual type: IO () • The function ‘mt’ is applied to one value argument, but its type ‘IO ()’ has none In a stmt of a 'do' block: mt do mu In the first argument of ‘f’, namely ‘do mt do mu’ | 17 | test3 = f do mt do mu | ^^^^^^^^ BlockArgsBedlam.hs:19:14: error: • Couldn't match expected type: Maybe Bool -> a1 with actual type: IO () • In the first argument of ‘($)’, namely ‘mt’ In a stmt of a 'do' block: mt $ do mu In the first argument of ‘f’, namely ‘do mt $ do mu’ | 19 | test4 = f do mt $ do mu | ^^ Failed, no modules loaded. ghci>
So BlockArguments
is just another syntactic “sugar rush” which doesn’t scale up for general use:
…less of it is usually better.