module Algebra.Graph.Relation.Reflexive (
ReflexiveRelation, fromRelation, toRelation
) where
import Algebra.Graph.Relation
import Control.DeepSeq
import Data.String
import qualified Algebra.Graph.Class as C
newtype ReflexiveRelation a = ReflexiveRelation { forall a. ReflexiveRelation a -> Relation a
fromReflexive :: Relation a }
deriving (String -> ReflexiveRelation a
forall a. IsString a => String -> ReflexiveRelation a
forall a. (String -> a) -> IsString a
fromString :: String -> ReflexiveRelation a
$cfromString :: forall a. IsString a => String -> ReflexiveRelation a
IsString, ReflexiveRelation a -> ()
forall a. NFData a => ReflexiveRelation a -> ()
forall a. (a -> ()) -> NFData a
rnf :: ReflexiveRelation a -> ()
$crnf :: forall a. NFData a => ReflexiveRelation a -> ()
NFData, Integer -> ReflexiveRelation a
ReflexiveRelation a -> ReflexiveRelation a
ReflexiveRelation a -> ReflexiveRelation a -> ReflexiveRelation a
forall a. (Ord a, Num a) => Integer -> ReflexiveRelation a
forall a.
(Ord a, Num a) =>
ReflexiveRelation a -> ReflexiveRelation a
forall a.
(Ord a, Num a) =>
ReflexiveRelation a -> ReflexiveRelation a -> ReflexiveRelation a
forall a.
(a -> a -> a)
-> (a -> a -> a)
-> (a -> a -> a)
-> (a -> a)
-> (a -> a)
-> (a -> a)
-> (Integer -> a)
-> Num a
fromInteger :: Integer -> ReflexiveRelation a
$cfromInteger :: forall a. (Ord a, Num a) => Integer -> ReflexiveRelation a
signum :: ReflexiveRelation a -> ReflexiveRelation a
$csignum :: forall a.
(Ord a, Num a) =>
ReflexiveRelation a -> ReflexiveRelation a
abs :: ReflexiveRelation a -> ReflexiveRelation a
$cabs :: forall a.
(Ord a, Num a) =>
ReflexiveRelation a -> ReflexiveRelation a
negate :: ReflexiveRelation a -> ReflexiveRelation a
$cnegate :: forall a.
(Ord a, Num a) =>
ReflexiveRelation a -> ReflexiveRelation a
* :: ReflexiveRelation a -> ReflexiveRelation a -> ReflexiveRelation a
$c* :: forall a.
(Ord a, Num a) =>
ReflexiveRelation a -> ReflexiveRelation a -> ReflexiveRelation a
- :: ReflexiveRelation a -> ReflexiveRelation a -> ReflexiveRelation a
$c- :: forall a.
(Ord a, Num a) =>
ReflexiveRelation a -> ReflexiveRelation a -> ReflexiveRelation a
+ :: ReflexiveRelation a -> ReflexiveRelation a -> ReflexiveRelation a
$c+ :: forall a.
(Ord a, Num a) =>
ReflexiveRelation a -> ReflexiveRelation a -> ReflexiveRelation a
Num)
instance Ord a => Eq (ReflexiveRelation a) where
ReflexiveRelation a
x == :: ReflexiveRelation a -> ReflexiveRelation a -> Bool
== ReflexiveRelation a
y = forall a. Ord a => ReflexiveRelation a -> Relation a
toRelation ReflexiveRelation a
x forall a. Eq a => a -> a -> Bool
== forall a. Ord a => ReflexiveRelation a -> Relation a
toRelation ReflexiveRelation a
y
instance Ord a => Ord (ReflexiveRelation a) where
compare :: ReflexiveRelation a -> ReflexiveRelation a -> Ordering
compare ReflexiveRelation a
x ReflexiveRelation a
y = forall a. Ord a => a -> a -> Ordering
compare (forall a. Ord a => ReflexiveRelation a -> Relation a
toRelation ReflexiveRelation a
x) (forall a. Ord a => ReflexiveRelation a -> Relation a
toRelation ReflexiveRelation a
y)
instance (Ord a, Show a) => Show (ReflexiveRelation a) where
show :: ReflexiveRelation a -> String
show = forall a. Show a => a -> String
show forall b c a. (b -> c) -> (a -> b) -> a -> c
. forall a. Ord a => ReflexiveRelation a -> Relation a
toRelation
instance Ord a => C.Graph (ReflexiveRelation a) where
type Vertex (ReflexiveRelation a) = a
empty :: ReflexiveRelation a
empty = forall a. Relation a -> ReflexiveRelation a
ReflexiveRelation forall a. Relation a
empty
vertex :: Vertex (ReflexiveRelation a) -> ReflexiveRelation a
vertex = forall a. Relation a -> ReflexiveRelation a
ReflexiveRelation forall b c a. (b -> c) -> (a -> b) -> a -> c
. forall a. a -> Relation a
vertex
overlay :: ReflexiveRelation a -> ReflexiveRelation a -> ReflexiveRelation a
overlay ReflexiveRelation a
x ReflexiveRelation a
y = forall a. Relation a -> ReflexiveRelation a
ReflexiveRelation forall a b. (a -> b) -> a -> b
$ forall a. ReflexiveRelation a -> Relation a
fromReflexive ReflexiveRelation a
x forall a. Ord a => Relation a -> Relation a -> Relation a
`overlay` forall a. ReflexiveRelation a -> Relation a
fromReflexive ReflexiveRelation a
y
connect :: ReflexiveRelation a -> ReflexiveRelation a -> ReflexiveRelation a
connect ReflexiveRelation a
x ReflexiveRelation a
y = forall a. Relation a -> ReflexiveRelation a
ReflexiveRelation forall a b. (a -> b) -> a -> b
$ forall a. ReflexiveRelation a -> Relation a
fromReflexive ReflexiveRelation a
x forall a. Ord a => Relation a -> Relation a -> Relation a
`connect` forall a. ReflexiveRelation a -> Relation a
fromReflexive ReflexiveRelation a
y
instance Ord a => C.Reflexive (ReflexiveRelation a)
fromRelation :: Relation a -> ReflexiveRelation a
fromRelation :: forall a. Relation a -> ReflexiveRelation a
fromRelation = forall a. Relation a -> ReflexiveRelation a
ReflexiveRelation
toRelation :: Ord a => ReflexiveRelation a -> Relation a
toRelation :: forall a. Ord a => ReflexiveRelation a -> Relation a
toRelation = forall a. Ord a => Relation a -> Relation a
reflexiveClosure forall b c a. (b -> c) -> (a -> b) -> a -> c
. forall a. ReflexiveRelation a -> Relation a
fromReflexive