Frage

Why does -XImplicitParams work from the command line but not the OPTIONS_GHC pragma?

I've found that ghc t.hs throws a parse error on input 'a' if t.hs contains the following code, while ghc -XImplicitParams t.hs works fine. Ditto ghci.

{- OPTIONS_GHC -XImplicitParams -}
f :: (?a :: Int) => Int -> Int
f b = ?a + b
g c = f $ c+1
War es hilfreich?

Lösung

That would need to be a pragma, with {-# ... #-} delimiters. Better than an OPTIONS_GHC pragma is a

{-# LANGUAGE ImplicitParams #-}

pragma.

Lizenziert unter: CC-BY-SA mit Zuschreibung
Nicht verbunden mit StackOverflow
scroll top