Skip to content

Instantly share code, notes, and snippets.

@jchia
Created April 22, 2020 13:32
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save jchia/6cc92e686dda4a422832dcb191a2c2b5 to your computer and use it in GitHub Desktop.
Save jchia/6cc92e686dda4a422832dcb191a2c2b5 to your computer and use it in GitHub Desktop.
GHC redundant constraint
newtype Sym = Sym { unSym :: ByteString }
deriving ( Eq, Generic, Hashable, Ord, IsString, MonoFoldable, Monoid, Semigroup, C.FromField, C.ToField )
type instance Element Sym = Word8
GHC 8.8 Warning:
================
• Redundant constraint: Eq (Element Sym)
• In an expression type signature:
Eq (Element Sym) => Element Sym -> Sym -> Bool
In the expression:
ghc-prim-0.5.3:GHC.Prim.coerce
@(Element ByteString -> ByteString -> Bool)
@(Element Sym -> Sym -> Bool)
(onotElem @ByteString) ::
Eq (Element Sym) => Element Sym -> Sym -> Bool
In an equation for ‘onotElem’:
onotElem
= ghc-prim-0.5.3:GHC.Prim.coerce
@(Element ByteString -> ByteString -> Bool)
@(Element Sym -> Sym -> Bool)
(onotElem @ByteString) ::
Eq (Element Sym) => Element Sym -> Sym -> Bool
When typechecking the code for ‘onotElem’
in a derived instance for ‘MonoFoldable Sym’:
To see the code I am typechecking, use -ddump-deriv
|
150 | deriving ( Eq, Generic, Hashable, Ord, IsString, MonoFoldable, Monoid, Semigroup, C.FromField, C.ToField )
| ^^^^^^^^^^^^
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment