Skip to content

Instantly share code, notes, and snippets.

@jchia
Created September 3, 2020 09:21
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/e9bb569ec0d311268b60346fe135ebb8 to your computer and use it in GitHub Desktop.
Save jchia/e9bb569ec0d311268b60346fe135ebb8 to your computer and use it in GitHub Desktop.
Redundant constraint: Eq (Element Prod)
import ClassyPrelude
newtype Prod = Prod ByteString
deriving newtype (Eq, Hashable, Ord, IsString, MonoFoldable, Monoid, Semigroup)
type instance Element Prod = Word8
• Redundant constraint: Eq (Element Prod)
• In an expression type signature:
Eq (Element Prod) => Element Prod -> Prod -> Bool
In the expression:
coerce
@(Element ByteString -> ByteString -> Bool)
@(Element Prod -> Prod -> Bool) (oelem @ByteString) ::
Eq (Element Prod) => Element Prod -> Prod -> Bool
In an equation for ‘oelem’:
oelem
= coerce
@(Element ByteString -> ByteString -> Bool)
@(Element Prod -> Prod -> Bool) (oelem @ByteString) ::
Eq (Element Prod) => Element Prod -> Prod -> Bool
When typechecking the code for ‘oelem’
in a derived instance for ‘MonoFoldable Prod’:
To see the code I am typechecking, use -ddump-deriv
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment