Commit 2bba8185 authored by Bastian Kauschke's avatar Bastian Kauschke
Browse files

add type alias for group values functor

parent e1ae6bbf
......@@ -4,13 +4,14 @@ module Copar.Functors (registeredFunctors) where
import Prelude hiding ( product )
import Data.Ratio
import Data.Float.Utils
import Copar.FunctorDescription
import Copar.Functors.Bag ( Bag )
import Copar.Functors.Distribution ( Distribution )
import Copar.Functors.GroupValued ( GroupValued, OrderedComplex )
import Copar.Functors.GroupValued ( IntValued
, RealValued
, ComplexValued
, RationalValued
)
import Copar.Functors.Polynomial ( Polynomial )
import Copar.Functors.Powerset ( Powerset )
import Copar.Functors.MonoidValued ( MaxIntValued
......@@ -30,10 +31,10 @@ registeredFunctors =
, dynFunctorDescription @BitAndValued
, dynFunctorDescription @BitOrValued
, dynFunctorDescription @(GroupValued Int)
, dynFunctorDescription @(GroupValued EqDouble)
, dynFunctorDescription @(GroupValued OrderedComplex)
, dynFunctorDescription @(GroupValued (Ratio Int))
, dynFunctorDescription @IntValued
, dynFunctorDescription @RealValued
, dynFunctorDescription @ComplexValued
, dynFunctorDescription @RationalValued
, dynFunctorDescription @Powerset
, dynFunctorDescription @Bag
......
......@@ -13,6 +13,10 @@ module Copar.Functors.GroupValued
( GroupValued(..)
, IsGroupF3(..)
, OrderedComplex(..)
, IntValued
, RealValued
, RationalValued
, ComplexValued
) where
import Control.Monad (when)
......@@ -72,6 +76,7 @@ instance Printable (GroupValued (Ratio Int)) where
printMe cfg (GroupValued x) = withName cfg "Rational-valued" <> "Q^" <> x
type IntValued = GroupValued Int
instance FunctorDescription (GroupValued Int) where
name = "Integer-valued"
syntaxExample = "Z^X | ℤ^X"
......@@ -90,6 +95,7 @@ intHelp =
<> Doc.annotate Doc.bold "Coalgebra syntax:"
<+> Doc.reflow "'{' X ':' int, ... '}'"
type RealValued = GroupValued EqDouble
instance FunctorDescription (GroupValued EqDouble) where
name = "Real-valued"
syntaxExample = "R^X | ℝ^X"
......@@ -108,6 +114,7 @@ realHelp =
<> Doc.annotate Doc.bold "Coalgebra syntax:"
<+> Doc.reflow "'{' X ':' real, ... '}'"
type RationalValued = GroupValued (Ratio Int)
instance FunctorDescription (GroupValued (Ratio Int)) where
name = "Rational-valued"
syntaxExample = "Q^X | ℚ^X"
......@@ -136,6 +143,7 @@ instance Ord OrderedComplex where
compare (OrderedComplex a) (OrderedComplex b) = case (a, b) of
(r1 :+ i1, r2 :+ i2) -> compare r1 r2 <> compare i1 i2
type ComplexValued = GroupValued OrderedComplex
instance FunctorDescription (GroupValued OrderedComplex) where
name = "Complex-valued"
syntaxExample = "C^X | ℂ^X"
......
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment