1
1
mirror of https://github.com/github/semantic.git synced 2024-12-24 23:42:31 +03:00

Derive a Semigroup instance for Term Monotype a.

This commit is contained in:
Rob Rix 2019-07-25 12:33:13 -04:00
parent 7d9100f816
commit cd950fd6ec
No known key found for this signature in database
GPG Key ID: F188A01508EA1CF7

View File

@ -1,4 +1,4 @@
{-# LANGUAGE DeriveGeneric, DeriveTraversable, FlexibleContexts, FlexibleInstances, LambdaCase, OverloadedStrings, QuantifiedConstraints, RecordWildCards, ScopedTypeVariables, StandaloneDeriving, TypeApplications, TypeOperators #-}
{-# LANGUAGE DeriveGeneric, DeriveTraversable, DerivingVia, FlexibleContexts, FlexibleInstances, LambdaCase, OverloadedStrings, QuantifiedConstraints, RecordWildCards, ScopedTypeVariables, StandaloneDeriving, TypeApplications, TypeOperators #-}
module Analysis.Typecheck
( Monotype (..)
, Meta
@ -30,6 +30,7 @@ import qualified Data.Map as Map
import Data.Maybe (fromJust, fromMaybe)
import Data.Name as Name
import Data.Scope
import Data.Semigroup (Last (..))
import qualified Data.Set as Set
import Data.Term
import Data.Void
@ -44,6 +45,9 @@ data Monotype f a
| Record (Map.Map User (f a))
deriving (Foldable, Functor, Generic1, Traversable)
-- FIXME: Union the effects/annotations on the operands.
deriving via (Last (Term Monotype a)) instance Semigroup (Term Monotype a)
deriving instance (Eq a, forall a . Eq a => Eq (f a), Monad f) => Eq (Monotype f a)
deriving instance (Ord a, forall a . Eq a => Eq (f a)
, forall a . Ord a => Ord (f a), Monad f) => Ord (Monotype f a)