{-# LANGUAGE NoImplicitPrelude #-}

{-# LANGUAGE TypeFamilies, FlexibleInstances #-}
{-# LANGUAGE EmptyDataDeriving #-}
{-# LANGUAGE StandaloneDeriving #-}
{-# LANGUAGE MultiParamTypeClasses #-}
{-# LANGUAGE ConstraintKinds #-}

-- |

-- Module      : OAlg.Entity.Definition

-- Description : definition of entities

-- Copyright   : (c) Erich Gut

-- License     : BSD3

-- Maintainer  : zerich.gut@gmail.com

-- 

-- definition of entities. All algebraic structures defined here are based on them.

-- They are __[showable]("OAlg.Data.Show")__, __[distinguishable]("OAlg.Data.Equal")__,

-- __[validable]("OAlg.Data.Validable")__

-- and __[typeable]("Data.Typeable")__.

module OAlg.Entity.Definition
  (
    -- * Entity

    Entity, Object
  , Ent, EntOrd

    -- * Entity1

  , Entity1
  
    -- * Entity2

  , Entity2

    -- * Basic Entities

    -- ** Empty

  , EntEmpty(), fromEmpty, EntEmpty2(), fromEmpty2

  )
  where

import Prelude (Ord(..),undefined)

import Data.Typeable

import OAlg.Category.Definition

import OAlg.Data.Show
import OAlg.Data.Equal
import OAlg.Data.EqualExtensional
import OAlg.Data.Validable

import OAlg.Structure.Definition

--------------------------------------------------------------------------------

-- Object -


-- | object.

type Object x = (Show x, Validable x)

--------------------------------------------------------------------------------

-- Entity -


-- | entity.

type Entity a = (Object a, Eq a, Typeable a)

--------------------------------------------------------------------------------

-- Ent -

-- | indexing 'Entity's.

data Ent

type instance Structure Ent x = Entity x

--------------------------------------------------------------------------------

-- EntOrd -


-- | indexing orderd entities.

data EntOrd

type instance Structure EntOrd x = (Entity x, Ord x)

instance TransformableG [] EntOrd EntOrd where tauG :: forall x. Struct EntOrd x -> Struct EntOrd [x]
tauG Struct EntOrd x
Struct = Struct EntOrd [x]
forall s x. Structure s x => Struct s x
Struct

--------------------------------------------------------------------------------

-- Entity1 -


-- | entity for parameterized types.

type Entity1 a =  (Show1 a, Eq1 a, Validable1 a, Typeable a)

--------------------------------------------------------------------------------

-- Entity2 - 


-- | entity for two parameterized types.

type Entity2 h = (Show2 h, Eq2 h, Validable2 h, Typeable h)

--------------------------------------------------------------------------------

-- EntEmpty -


-- | the empty entity.

data EntEmpty deriving (EntEmpty -> EntEmpty -> Bool
(EntEmpty -> EntEmpty -> Bool)
-> (EntEmpty -> EntEmpty -> Bool) -> Eq EntEmpty
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
$c== :: EntEmpty -> EntEmpty -> Bool
== :: EntEmpty -> EntEmpty -> Bool
$c/= :: EntEmpty -> EntEmpty -> Bool
/= :: EntEmpty -> EntEmpty -> Bool
Eq, Eq EntEmpty
Eq EntEmpty =>
(EntEmpty -> EntEmpty -> Ordering)
-> (EntEmpty -> EntEmpty -> Bool)
-> (EntEmpty -> EntEmpty -> Bool)
-> (EntEmpty -> EntEmpty -> Bool)
-> (EntEmpty -> EntEmpty -> Bool)
-> (EntEmpty -> EntEmpty -> EntEmpty)
-> (EntEmpty -> EntEmpty -> EntEmpty)
-> Ord EntEmpty
EntEmpty -> EntEmpty -> Bool
EntEmpty -> EntEmpty -> Ordering
EntEmpty -> EntEmpty -> EntEmpty
forall a.
Eq a =>
(a -> a -> Ordering)
-> (a -> a -> Bool)
-> (a -> a -> Bool)
-> (a -> a -> Bool)
-> (a -> a -> Bool)
-> (a -> a -> a)
-> (a -> a -> a)
-> Ord a
$ccompare :: EntEmpty -> EntEmpty -> Ordering
compare :: EntEmpty -> EntEmpty -> Ordering
$c< :: EntEmpty -> EntEmpty -> Bool
< :: EntEmpty -> EntEmpty -> Bool
$c<= :: EntEmpty -> EntEmpty -> Bool
<= :: EntEmpty -> EntEmpty -> Bool
$c> :: EntEmpty -> EntEmpty -> Bool
> :: EntEmpty -> EntEmpty -> Bool
$c>= :: EntEmpty -> EntEmpty -> Bool
>= :: EntEmpty -> EntEmpty -> Bool
$cmax :: EntEmpty -> EntEmpty -> EntEmpty
max :: EntEmpty -> EntEmpty -> EntEmpty
$cmin :: EntEmpty -> EntEmpty -> EntEmpty
min :: EntEmpty -> EntEmpty -> EntEmpty
Ord, Int -> EntEmpty -> ShowS
[EntEmpty] -> ShowS
EntEmpty -> String
(Int -> EntEmpty -> ShowS)
-> (EntEmpty -> String) -> ([EntEmpty] -> ShowS) -> Show EntEmpty
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
$cshowsPrec :: Int -> EntEmpty -> ShowS
showsPrec :: Int -> EntEmpty -> ShowS
$cshow :: EntEmpty -> String
show :: EntEmpty -> String
$cshowList :: [EntEmpty] -> ShowS
showList :: [EntEmpty] -> ShowS
Show)

-- | the empty function.

fromEmpty :: EntEmpty -> x
fromEmpty :: forall x. EntEmpty -> x
fromEmpty = x -> EntEmpty -> x
forall b a. b -> a -> b
const x
forall a. HasCallStack => a
undefined

instance Validable EntEmpty where
  valid :: EntEmpty -> Statement
valid = EntEmpty -> Statement
forall x. EntEmpty -> x
fromEmpty

--------------------------------------------------------------------------------

-- EntEmpty2 -


-- | the empty entity2.

data EntEmpty2 a b deriving (EntEmpty2 a b -> EntEmpty2 a b -> Bool
(EntEmpty2 a b -> EntEmpty2 a b -> Bool)
-> (EntEmpty2 a b -> EntEmpty2 a b -> Bool) -> Eq (EntEmpty2 a b)
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
forall a b. EntEmpty2 a b -> EntEmpty2 a b -> Bool
$c== :: forall a b. EntEmpty2 a b -> EntEmpty2 a b -> Bool
== :: EntEmpty2 a b -> EntEmpty2 a b -> Bool
$c/= :: forall a b. EntEmpty2 a b -> EntEmpty2 a b -> Bool
/= :: EntEmpty2 a b -> EntEmpty2 a b -> Bool
Eq, Int -> EntEmpty2 a b -> ShowS
[EntEmpty2 a b] -> ShowS
EntEmpty2 a b -> String
(Int -> EntEmpty2 a b -> ShowS)
-> (EntEmpty2 a b -> String)
-> ([EntEmpty2 a b] -> ShowS)
-> Show (EntEmpty2 a b)
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
forall a b. Int -> EntEmpty2 a b -> ShowS
forall a b. [EntEmpty2 a b] -> ShowS
forall a b. EntEmpty2 a b -> String
$cshowsPrec :: forall a b. Int -> EntEmpty2 a b -> ShowS
showsPrec :: Int -> EntEmpty2 a b -> ShowS
$cshow :: forall a b. EntEmpty2 a b -> String
show :: EntEmpty2 a b -> String
$cshowList :: forall a b. [EntEmpty2 a b] -> ShowS
showList :: [EntEmpty2 a b] -> ShowS
Show)

-- | the empty function.

fromEmpty2 :: EntEmpty2 a b -> x
fromEmpty2 :: forall a b x. EntEmpty2 a b -> x
fromEmpty2 = x -> EntEmpty2 a b -> x
forall b a. b -> a -> b
const x
forall a. HasCallStack => a
undefined

instance Validable (EntEmpty2 x y) where
  valid :: EntEmpty2 x y -> Statement
valid = EntEmpty2 x y -> Statement
forall a b x. EntEmpty2 a b -> x
fromEmpty2

instance Show2 EntEmpty2
instance Eq2 EntEmpty2
instance EqExt EntEmpty2
instance Validable2 EntEmpty2
instance ApplicativeG t EntEmpty2 b where amapG :: forall x y. EntEmpty2 x y -> b (t x) (t y)
amapG = EntEmpty2 x y -> b (t x) (t y)
forall a b x. EntEmpty2 a b -> x
fromEmpty2