Skip to content

GitLab

  • Projects
  • Groups
  • Snippets
  • Help
    • Loading...
  • Help
    • Help
    • Support
    • Community forum
    • Submit feedback
  • Sign in / Register
GHC
GHC
  • Project overview
    • Project overview
    • Details
    • Activity
    • Releases
  • Repository
    • Repository
    • Files
    • Commits
    • Branches
    • Tags
    • Contributors
    • Graph
    • Compare
    • Locked Files
  • Issues 4,323
    • Issues 4,323
    • List
    • Boards
    • Labels
    • Service Desk
    • Milestones
    • Iterations
  • Merge Requests 385
    • Merge Requests 385
  • Requirements
    • Requirements
    • List
  • CI / CD
    • CI / CD
    • Pipelines
    • Jobs
    • Schedules
  • Security & Compliance
    • Security & Compliance
    • Dependency List
    • License Compliance
  • Operations
    • Operations
    • Incidents
    • Environments
  • Analytics
    • Analytics
    • CI / CD
    • Code Review
    • Insights
    • Issue
    • Repository
    • Value Stream
  • Wiki
    • Wiki
  • Snippets
    • Snippets
  • Members
    • Members
  • Collapse sidebar
  • Activity
  • Graph
  • Create a new issue
  • Jobs
  • Commits
  • Issue Boards
  • Glasgow Haskell Compiler
  • GHCGHC
  • Issues
  • #14004

Closed
Open
Opened Jul 21, 2017 by zaoqi@trac-zaoqi

G

{-# LANGUAGE MultiParamTypeClasses, FlexibleInstances #-}

class GEq a b where
    geq :: a -> b -> Bool

instance {-# OVERLAPPING #-} Eq a => GEq a a where
    geq = (==)

instance GEq a b where
    geq _ _ = False
GHCi, version 7.10.3: http://www.haskell.org/ghc/  :? for help
Prelude> :load GEq.hs 
[1 of 1] Compiling Main             ( GEq.hs, interpreted )
Ok, modules loaded: Main.
*Main> geq::a->b->Bool

<interactive>:3:1:
    Overlapping instances for GEq a1 b1 arising from a use of ‘geq’
    Matching instances:
      instance GEq a b -- Defined at GEq.hs:9:10
      instance [overlapping] Eq a => GEq a a -- Defined at GEq.hs:6:30
    (The choice depends on the instantiation of ‘a1, b1’
     To pick the first instance above, use IncoherentInstances
     when compiling the other instance declarations)
    In the expression: geq :: a -> b -> Bool
    In an equation for ‘it’: it = geq :: a -> b -> Bool
*Main> 

In order to

{-# LANGUAGE KindSignatures, GADTs #-}
data Dyn :: * where
    Dyn :: a -> Dyn

instance Eq Dyn where
    Dyn a == Dyn b = geq a b
Edited Mar 10, 2019 by zaoqi
Assignee
Assign to
None
Milestone
None
Assign milestone
Time tracking
None
Due date
None
Reference: ghc/ghc#14004