Pregunta

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
¿Fue útil?

Solución

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

{-# LANGUAGE ImplicitParams #-}

pragma.

Licenciado bajo: CC-BY-SA con atribución
No afiliado a StackOverflow
scroll top