Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- {-# language ImplicitParams #-}
- module Gato where
- import Data.Text
- -- Implicit parameter
- type WithConnectionString = ?connectionString :: Text
- class DumbShowConnectionString a where
- dumb :: a -> Text
- instance DumbShowConnectionString Text where
- dumb = id @Text
- instance (?connectionString :: Text) => DumbShowConnectionString () where
- dumb () = ?connectionString
- -- Fails
- instance WithConnectionString => DumbShowConnectionString () where
- dumb () = ?connectionString
- {-
- [1 of 1] Compiling Gato ( gato.hs, interpreted )
- gato.hs:16:10: error: [GHC-75863]
- • Illegal implicit parameter ‘?connectionString::Text’
- • In the instance declaration for ‘DumbShowConnectionString ()’
- |
- 16 | instance WithConnectionString => DumbShowConnectionString () where
- | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
- Failed, no modules loaded.
- ghci> :r
- [1 of 1] Compiling Gato ( gato.hs, interpreted )
- gato.hs:16:10: error: [GHC-75863]
- • Illegal implicit parameter ‘?connectionString::Text’
- • In the instance declaration for ‘DumbShowConnectionString ()’
- |
- 16 | instance (?connectionString :: Text) => DumbShowConnectionString () where
- | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
- gato.hs:20:10: error: [GHC-75863]
- • Illegal implicit parameter ‘?connectionString::Text’
- • In the instance declaration for ‘DumbShowConnectionString ()’
- |
- 20 | instance WithConnectionString => DumbShowConnectionString () where
- | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
- Failed, no modules loaded.
- ghci>
- -}
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement