import Control.Monad
import qualified Data.Bool as Bool
import Data.Monoid
+import Data.Proxy
import qualified Data.Text as Text
import Prelude hiding ((&&), not, (||))
(||) = repr_text_infix "||" (Precedence 5)
xor = repr_text_infix "`xor`" (Precedence 5)
instance (Sym_Bool r1, Sym_Bool r2) => Sym_Bool (Repr_Dup r1 r2) where
- bool x = bool x `Repr_Dup` bool x
- not (x1 `Repr_Dup` x2) = not x1 `Repr_Dup` not x2
- (&&) (x1 `Repr_Dup` x2) (y1 `Repr_Dup` y2) = (&&) x1 y1 `Repr_Dup` (&&) x2 y2
- (||) (x1 `Repr_Dup` x2) (y1 `Repr_Dup` y2) = (||) x1 y1 `Repr_Dup` (||) x2 y2
- xor (x1 `Repr_Dup` x2) (y1 `Repr_Dup` y2) = xor x1 y1 `Repr_Dup` xor x2 y2
+ bool x = bool x `Repr_Dup` bool x
+ not = repr_dup1 sym_Bool not
+ (&&) = repr_dup2 sym_Bool (&&)
+ (||) = repr_dup2 sym_Bool (||)
+ xor = repr_dup2 sym_Bool xor
+
+sym_Bool :: Proxy Sym_Bool
+sym_Bool = Proxy
-- * Type 'Expr_Bool'
-- | Expression.
import Control.Monad
import qualified Data.Char as Char
+import Data.Proxy
import qualified Data.Text as Text
import Language.Symantic.Type
char a = Repr_Text $ \_p _v ->
Text.pack (show a)
char_toUpper = repr_text_app1 "char_toUpper"
-instance
- ( Sym_Char r1
- , Sym_Char r2
- ) => Sym_Char (Repr_Dup r1 r2) where
- char x = char x `Repr_Dup` char x
- char_toUpper (c1 `Repr_Dup` c2) =
- char_toUpper c1 `Repr_Dup` char_toUpper c2
+instance (Sym_Char r1, Sym_Char r2) => Sym_Char (Repr_Dup r1 r2) where
+ char x = char x `Repr_Dup` char x
+ char_toUpper = repr_dup1 sym_Char char_toUpper
+
+sym_Char :: Proxy Sym_Char
+sym_Char = Proxy
-- * Type 'Expr_Char'
-- | Expression.
right = repr_text_app1 "right"
left = repr_text_app1 "left"
instance (Sym_Either r1, Sym_Either r2) => Sym_Either (Repr_Dup r1 r2) where
- left (l1 `Repr_Dup` l2) = left l1 `Repr_Dup` left l2
- right (r1 `Repr_Dup` r2) = right r1 `Repr_Dup` right r2
+ left = repr_dup1 sym_Either left
+ right = repr_dup1 sym_Either right
+
+sym_Either :: Proxy Sym_Either
+sym_Either = Proxy
-- * Type 'Expr_Either'
-- | Expression.
(==) = repr_text_infix "==" (Precedence 4)
(/=) = repr_text_infix "/=" (Precedence 4)
instance (Sym_Eq r1, Sym_Eq r2) => Sym_Eq (Repr_Dup r1 r2) where
- (==) (x1 `Repr_Dup` x2) (y1 `Repr_Dup` y2) = (==) x1 y1 `Repr_Dup` (==) x2 y2
- (/=) (x1 `Repr_Dup` x2) (y1 `Repr_Dup` y2) = (/=) x1 y1 `Repr_Dup` (/=) x2 y2
+ (==) = repr_dup2 sym_Eq (==)
+ (/=) = repr_dup2 sym_Eq (/=)
+
+sym_Eq :: Proxy Sym_Eq
+sym_Eq = Proxy
-- * Type 'Expr_Eq'
-- | Expression.
-- | Expression for 'Foldable'.
module Language.Symantic.Expr.Foldable where
-import Control.Monad
+import Control.Monad (liftM, liftM2, liftM3)
import Data.Monoid
import Data.Foldable (Foldable)
import qualified Data.Foldable as Foldable
import Data.Proxy (Proxy(..))
import Data.Type.Equality ((:~:)(Refl))
-import Prelude hiding ((<$>), Foldable(..))
+import Prelude hiding ((<$>), Foldable(..)
+ , all, and, any, concat, concatMap, mapM_
+ , notElem, or, sequence_)
import Language.Symantic.Type
import Language.Symantic.Repr
-- * Class 'Sym_Foldable'
-- | Symantic.
class Sym_Foldable repr where
- foldMap :: (Foldable f, Monoid m) => repr (a -> m) -> repr (f a) -> repr m
- foldr :: Foldable f => repr (a -> b -> b) -> repr b -> repr (f a) -> repr b
- foldr' :: Foldable f => repr (a -> b -> b) -> repr b -> repr (f a) -> repr b
- foldl :: Foldable f => repr (b -> a -> b) -> repr b -> repr (f a) -> repr b
- foldl' :: Foldable f => repr (b -> a -> b) -> repr b -> repr (f a) -> repr b
- length :: Foldable f => repr (f a) -> repr Int
- null :: Foldable f => repr (f a) -> repr Bool
- minimum :: (Foldable f, Ord a) => repr (f a) -> repr a
- maximum :: (Foldable f, Ord a) => repr (f a) -> repr a
- elem :: (Foldable f, Eq a) => repr a -> repr (f a) -> repr Bool
- sum :: (Foldable f, Num a) => repr (f a) -> repr a
- product :: (Foldable f, Num a) => repr (f a) -> repr a
- toList :: Foldable f => repr (f a) -> repr [a]
- default foldMap :: (Trans t repr, Foldable f, Monoid m) => t repr (a -> m) -> t repr (f a) -> t repr m
- default foldr :: (Trans t repr, Foldable f) => t repr (a -> b -> b) -> t repr b -> t repr (f a) -> t repr b
- default foldr' :: (Trans t repr, Foldable f) => t repr (a -> b -> b) -> t repr b -> t repr (f a) -> t repr b
- default foldl :: (Trans t repr, Foldable f) => t repr (b -> a -> b) -> t repr b -> t repr (f a) -> t repr b
- default foldl' :: (Trans t repr, Foldable f) => t repr (b -> a -> b) -> t repr b -> t repr (f a) -> t repr b
- default length :: (Trans t repr, Foldable f) => t repr (f a) -> t repr Int
- default null :: (Trans t repr, Foldable f) => t repr (f a) -> t repr Bool
- default minimum :: (Trans t repr, Foldable f, Ord a) => t repr (f a) -> t repr a
- default maximum :: (Trans t repr, Foldable f, Ord a) => t repr (f a) -> t repr a
- default elem :: (Trans t repr, Foldable f, Eq a) => t repr a -> t repr (f a) -> t repr Bool
- default sum :: (Trans t repr, Foldable f, Num a) => t repr (f a) -> t repr a
- default product :: (Trans t repr, Foldable f, Num a) => t repr (f a) -> t repr a
- default toList :: (Trans t repr, Foldable f) => t repr (f a) -> t repr [a]
- foldMap = trans_map2 foldMap
- foldr = trans_map3 foldr
- foldr' = trans_map3 foldr'
- foldl = trans_map3 foldl
- foldl' = trans_map3 foldl'
- length = trans_map1 length
- null = trans_map1 null
- minimum = trans_map1 minimum
- maximum = trans_map1 maximum
- elem = trans_map2 elem
- sum = trans_map1 sum
- product = trans_map1 product
- toList = trans_map1 toList
+ foldMap :: (Foldable f, Monoid m) => repr (a -> m) -> repr (f a) -> repr m
+ foldr :: Foldable f => repr (a -> b -> b) -> repr b -> repr (f a) -> repr b
+ foldr' :: Foldable f => repr (a -> b -> b) -> repr b -> repr (f a) -> repr b
+ foldl :: Foldable f => repr (b -> a -> b) -> repr b -> repr (f a) -> repr b
+ foldl' :: Foldable f => repr (b -> a -> b) -> repr b -> repr (f a) -> repr b
+ length :: Foldable f => repr (f a) -> repr Int
+ null :: Foldable f => repr (f a) -> repr Bool
+ minimum :: (Foldable f, Ord a) => repr (f a) -> repr a
+ maximum :: (Foldable f, Ord a) => repr (f a) -> repr a
+ elem :: (Foldable f, Eq a) => repr a -> repr (f a) -> repr Bool
+ sum :: (Foldable f, Num a) => repr (f a) -> repr a
+ product :: (Foldable f, Num a) => repr (f a) -> repr a
+ toList :: Foldable f => repr (f a) -> repr [a]
+ all :: Foldable f => repr (a -> Bool) -> repr (f a) -> repr Bool
+ and :: Foldable f => repr (f Bool) -> repr Bool
+ any :: Foldable f => repr (a -> Bool) -> repr (f a) -> repr Bool
+ concat :: Foldable f => repr (f [a]) -> repr [a]
+ concatMap :: Foldable f => repr (a -> [b]) -> repr (f a) -> repr [b]
+ find :: Foldable f => repr (a -> Bool) -> repr (f a) -> repr (Maybe a)
+ foldlM :: (Foldable f, Monad m) => repr (b -> a -> m b) -> repr b -> repr (f a) -> repr (m b)
+ foldrM :: (Foldable f, Monad m) => repr (a -> b -> m b) -> repr b -> repr (f a) -> repr (m b)
+ forM_ :: (Foldable f, Monad m) => repr (f a) -> repr (a -> m b) -> repr (m ())
+ for_ :: (Foldable f, Applicative p) => repr (f a) -> repr (a -> p b) -> repr (p ())
+ mapM_ :: (Foldable f, Monad m) => repr (a -> m b) -> repr (f a) -> repr (m ())
+ maximumBy :: Foldable f => repr (a -> a -> Ordering) -> repr (f a) -> repr a
+ minimumBy :: Foldable f => repr (a -> a -> Ordering) -> repr (f a) -> repr a
+ notElem :: (Foldable f, Eq a) => repr a -> repr (f a) -> repr Bool
+ or :: Foldable f => repr (f Bool) -> repr Bool
+ sequenceA_ :: (Foldable f, Applicative p) => repr (f (p a)) -> repr (p ())
+ sequence_ :: (Foldable f, Monad m) => repr (f (m a)) -> repr (m ())
+ traverse_ :: (Foldable f, Applicative p) => repr (a -> p b) -> repr (f a) -> repr (p ())
+ -- asum :: (Foldable t, GHC.Base.Alternative f) => t (f a) -> f a
+ -- msum :: (Foldable t, GHC.Base.MonadPlus m) => t (m a) -> m a
+
+ default foldMap :: (Trans t repr, Foldable f, Monoid m) => t repr (a -> m) -> t repr (f a) -> t repr m
+ default foldr :: (Trans t repr, Foldable f) => t repr (a -> b -> b) -> t repr b -> t repr (f a) -> t repr b
+ default foldr' :: (Trans t repr, Foldable f) => t repr (a -> b -> b) -> t repr b -> t repr (f a) -> t repr b
+ default foldl :: (Trans t repr, Foldable f) => t repr (b -> a -> b) -> t repr b -> t repr (f a) -> t repr b
+ default foldl' :: (Trans t repr, Foldable f) => t repr (b -> a -> b) -> t repr b -> t repr (f a) -> t repr b
+ default length :: (Trans t repr, Foldable f) => t repr (f a) -> t repr Int
+ default null :: (Trans t repr, Foldable f) => t repr (f a) -> t repr Bool
+ default minimum :: (Trans t repr, Foldable f, Ord a) => t repr (f a) -> t repr a
+ default maximum :: (Trans t repr, Foldable f, Ord a) => t repr (f a) -> t repr a
+ default elem :: (Trans t repr, Foldable f, Eq a) => t repr a -> t repr (f a) -> t repr Bool
+ default sum :: (Trans t repr, Foldable f, Num a) => t repr (f a) -> t repr a
+ default product :: (Trans t repr, Foldable f, Num a) => t repr (f a) -> t repr a
+ default toList :: (Trans t repr, Foldable f) => t repr (f a) -> t repr [a]
+ default all :: (Trans t repr, Foldable f) => t repr (a -> Bool) -> t repr (f a) -> t repr Bool
+ default and :: (Trans t repr, Foldable f) => t repr (f Bool) -> t repr Bool
+ default any :: (Trans t repr, Foldable f) => t repr (a -> Bool) -> t repr (f a) -> t repr Bool
+ default concat :: (Trans t repr, Foldable f) => t repr (f [a]) -> t repr [a]
+ default concatMap :: (Trans t repr, Foldable f) => t repr (a -> [b]) -> t repr (f a) -> t repr [b]
+ default find :: (Trans t repr, Foldable f) => t repr (a -> Bool) -> t repr (f a) -> t repr (Maybe a)
+ default foldlM :: (Trans t repr, Foldable f, Monad m) => t repr (b -> a -> m b) -> t repr b -> t repr (f a) -> t repr (m b)
+ default foldrM :: (Trans t repr, Foldable f, Monad m) => t repr (a -> b -> m b) -> t repr b -> t repr (f a) -> t repr (m b)
+ default forM_ :: (Trans t repr, Foldable f, Monad m) => t repr (f a) -> t repr (a -> m b) -> t repr (m ())
+ default for_ :: (Trans t repr, Foldable f, Applicative p) => t repr (f a) -> t repr (a -> p b) -> t repr (p ())
+ default mapM_ :: (Trans t repr, Foldable f, Monad m) => t repr (a -> m b) -> t repr (f a) -> t repr (m ())
+ default maximumBy :: (Trans t repr, Foldable f) => t repr (a -> a -> Ordering) -> t repr (f a) -> t repr a
+ default minimumBy :: (Trans t repr, Foldable f) => t repr (a -> a -> Ordering) -> t repr (f a) -> t repr a
+ default notElem :: (Trans t repr, Foldable f, Eq a) => t repr a -> t repr (f a) -> t repr Bool
+ default or :: (Trans t repr, Foldable f) => t repr (f Bool) -> t repr Bool
+ default sequenceA_ :: (Trans t repr, Foldable f, Applicative p) => t repr (f (p a)) -> t repr (p ())
+ default sequence_ :: (Trans t repr, Foldable f, Monad m) => t repr (f (m a)) -> t repr (m ())
+ default traverse_ :: (Trans t repr, Foldable f, Applicative p) => t repr (a -> p b) -> t repr (f a) -> t repr (p ())
+
+ foldMap = trans_map2 foldMap
+ foldr = trans_map3 foldr
+ foldr' = trans_map3 foldr'
+ foldl = trans_map3 foldl
+ foldl' = trans_map3 foldl'
+ length = trans_map1 length
+ null = trans_map1 null
+ minimum = trans_map1 minimum
+ maximum = trans_map1 maximum
+ elem = trans_map2 elem
+ sum = trans_map1 sum
+ product = trans_map1 product
+ toList = trans_map1 toList
+ all = trans_map2 all
+ and = trans_map1 and
+ any = trans_map2 any
+ concat = trans_map1 concat
+ concatMap = trans_map2 concatMap
+ find = trans_map2 find
+ foldlM = trans_map3 foldlM
+ foldrM = trans_map3 foldrM
+ forM_ = trans_map2 forM_
+ for_ = trans_map2 for_
+ mapM_ = trans_map2 mapM_
+ maximumBy = trans_map2 maximumBy
+ minimumBy = trans_map2 minimumBy
+ notElem = trans_map2 notElem
+ or = trans_map1 or
+ sequenceA_ = trans_map1 sequenceA_
+ sequence_ = trans_map1 sequence_
+ traverse_ = trans_map2 traverse_
instance Sym_Foldable Repr_Host where
- foldMap = liftM2 Foldable.foldMap
- foldr = liftM3 Foldable.foldr
- foldr' = liftM3 Foldable.foldr'
- foldl = liftM3 Foldable.foldl
- foldl' = liftM3 Foldable.foldl'
- null = liftM Foldable.null
- length = liftM Foldable.length
- minimum = liftM Foldable.minimum
- maximum = liftM Foldable.maximum
- elem = liftM2 Foldable.elem
- sum = liftM Foldable.sum
- product = liftM Foldable.product
- toList = liftM Foldable.toList
+ foldMap = liftM2 Foldable.foldMap
+ foldr = liftM3 Foldable.foldr
+ foldr' = liftM3 Foldable.foldr'
+ foldl = liftM3 Foldable.foldl
+ foldl' = liftM3 Foldable.foldl'
+ null = liftM Foldable.null
+ length = liftM Foldable.length
+ minimum = liftM Foldable.minimum
+ maximum = liftM Foldable.maximum
+ elem = liftM2 Foldable.elem
+ sum = liftM Foldable.sum
+ product = liftM Foldable.product
+ toList = liftM Foldable.toList
+ all = liftM2 Foldable.all
+ and = liftM Foldable.and
+ any = liftM2 Foldable.any
+ concat = liftM Foldable.concat
+ concatMap = liftM2 Foldable.concatMap
+ find = liftM2 Foldable.find
+ foldlM = liftM3 Foldable.foldlM
+ foldrM = liftM3 Foldable.foldrM
+ forM_ = liftM2 Foldable.forM_
+ for_ = liftM2 Foldable.for_
+ mapM_ = liftM2 Foldable.mapM_
+ maximumBy = liftM2 Foldable.maximumBy
+ minimumBy = liftM2 Foldable.minimumBy
+ notElem = liftM2 Foldable.notElem
+ or = liftM Foldable.or
+ sequenceA_ = liftM Foldable.sequenceA_
+ sequence_ = liftM Foldable.sequence_
+ traverse_ = liftM2 Foldable.traverse_
instance Sym_Foldable Repr_Text where
- foldMap = repr_text_app2 "foldMap"
- foldr = repr_text_app3 "foldr"
- foldr' = repr_text_app3 "foldr'"
- foldl = repr_text_app3 "foldl"
- foldl' = repr_text_app3 "foldl'"
- null = repr_text_app1 "null"
- length = repr_text_app1 "length"
- minimum = repr_text_app1 "minimum"
- maximum = repr_text_app1 "maximum"
- elem = repr_text_app2 "elem"
- sum = repr_text_app1 "sum"
- product = repr_text_app1 "product"
- toList = repr_text_app1 "toList"
+ foldMap = repr_text_app2 "foldMap"
+ foldr = repr_text_app3 "foldr"
+ foldr' = repr_text_app3 "foldr'"
+ foldl = repr_text_app3 "foldl"
+ foldl' = repr_text_app3 "foldl'"
+ null = repr_text_app1 "null"
+ length = repr_text_app1 "length"
+ minimum = repr_text_app1 "minimum"
+ maximum = repr_text_app1 "maximum"
+ elem = repr_text_app2 "elem"
+ sum = repr_text_app1 "sum"
+ product = repr_text_app1 "product"
+ toList = repr_text_app1 "toList"
+ all = repr_text_app2 "all"
+ and = repr_text_app1 "and"
+ any = repr_text_app2 "any"
+ concat = repr_text_app1 "concat"
+ concatMap = repr_text_app2 "concatMap"
+ find = repr_text_app2 "find"
+ foldlM = repr_text_app3 "foldlM"
+ foldrM = repr_text_app3 "foldrM"
+ forM_ = repr_text_app2 "forM_"
+ for_ = repr_text_app2 "for_"
+ mapM_ = repr_text_app2 "mapM_"
+ maximumBy = repr_text_app2 "maximumBy"
+ minimumBy = repr_text_app2 "minimumBy"
+ notElem = repr_text_app2 "notElem"
+ or = repr_text_app1 "or"
+ sequenceA_ = repr_text_app1 "sequenceA_"
+ sequence_ = repr_text_app1 "sequence_"
+ traverse_ = repr_text_app2 "traverse_"
instance (Sym_Foldable r1, Sym_Foldable r2) => Sym_Foldable (Repr_Dup r1 r2) where
- foldMap (f1 `Repr_Dup` f2) (m1 `Repr_Dup` m2) =
- foldMap f1 m1 `Repr_Dup` foldMap f2 m2
- foldr (f1 `Repr_Dup` f2) (a1 `Repr_Dup` a2) (m1 `Repr_Dup` m2) =
- foldr f1 a1 m1 `Repr_Dup` foldr f2 a2 m2
- foldr' (f1 `Repr_Dup` f2) (a1 `Repr_Dup` a2) (m1 `Repr_Dup` m2) =
- foldr' f1 a1 m1 `Repr_Dup` foldr' f2 a2 m2
- foldl (f1 `Repr_Dup` f2) (a1 `Repr_Dup` a2) (m1 `Repr_Dup` m2) =
- foldl f1 a1 m1 `Repr_Dup` foldl f2 a2 m2
- foldl' (f1 `Repr_Dup` f2) (a1 `Repr_Dup` a2) (m1 `Repr_Dup` m2) =
- foldl' f1 a1 m1 `Repr_Dup` foldl' f2 a2 m2
- length (f1 `Repr_Dup` f2) = length f1 `Repr_Dup` length f2
- null (f1 `Repr_Dup` f2) = null f1 `Repr_Dup` null f2
- minimum (f1 `Repr_Dup` f2) = minimum f1 `Repr_Dup` minimum f2
- maximum (f1 `Repr_Dup` f2) = maximum f1 `Repr_Dup` maximum f2
- elem (a1 `Repr_Dup` a2) (f1 `Repr_Dup` f2) = elem a1 f1 `Repr_Dup` elem a2 f2
- sum (f1 `Repr_Dup` f2) = sum f1 `Repr_Dup` sum f2
- product (f1 `Repr_Dup` f2) = product f1 `Repr_Dup` product f2
- toList (f1 `Repr_Dup` f2) = toList f1 `Repr_Dup` toList f2
+ foldMap = repr_dup2 sym_Foldable foldMap
+ foldr = repr_dup3 sym_Foldable foldr
+ foldr' = repr_dup3 sym_Foldable foldr'
+ foldl = repr_dup3 sym_Foldable foldl
+ foldl' = repr_dup3 sym_Foldable foldl'
+ null = repr_dup1 sym_Foldable null
+ length = repr_dup1 sym_Foldable length
+ minimum = repr_dup1 sym_Foldable minimum
+ maximum = repr_dup1 sym_Foldable maximum
+ elem = repr_dup2 sym_Foldable elem
+ sum = repr_dup1 sym_Foldable sum
+ product = repr_dup1 sym_Foldable product
+ toList = repr_dup1 sym_Foldable toList
+ all = repr_dup2 sym_Foldable all
+ and = repr_dup1 sym_Foldable and
+ any = repr_dup2 sym_Foldable any
+ concat = repr_dup1 sym_Foldable concat
+ concatMap = repr_dup2 sym_Foldable concatMap
+ find = repr_dup2 sym_Foldable find
+ foldlM = repr_dup3 sym_Foldable foldlM
+ foldrM = repr_dup3 sym_Foldable foldrM
+ forM_ = repr_dup2 sym_Foldable forM_
+ for_ = repr_dup2 sym_Foldable for_
+ mapM_ = repr_dup2 sym_Foldable mapM_
+ maximumBy = repr_dup2 sym_Foldable maximumBy
+ minimumBy = repr_dup2 sym_Foldable minimumBy
+ notElem = repr_dup2 sym_Foldable notElem
+ or = repr_dup1 sym_Foldable or
+ sequenceA_ = repr_dup1 sym_Foldable sequenceA_
+ sequence_ = repr_dup1 sym_Foldable sequence_
+ traverse_ = repr_dup2 sym_Foldable traverse_
+
+sym_Foldable :: Proxy Sym_Foldable
+sym_Foldable = Proxy
-- * Type 'Expr_Foldable'
-- | Expression.
import Control.Monad (liftM2)
import Data.Proxy (Proxy(..))
import Data.Type.Equality ((:~:)(Refl))
-import Prelude hiding (fmap)
+import Prelude hiding (fmap, (<$))
import qualified Data.Function as Fun
import qualified Data.Functor as Functor
instance Sym_Functor Repr_Host where
fmap = liftM2 Functor.fmap
+ (<$) = liftM2 (Functor.<$)
instance Sym_Functor Repr_Text where
fmap = repr_text_app2 "fmap"
(<$) = repr_text_infix "<$" (Precedence 4)
instance (Sym_Functor r1, Sym_Functor r2) => Sym_Functor (Repr_Dup r1 r2) where
- fmap (f1 `Repr_Dup` f2) (m1 `Repr_Dup` m2) =
- fmap f1 m1 `Repr_Dup` fmap f2 m2
+ fmap = repr_dup2 sym_Functor fmap
+ (<$) = repr_dup2 sym_Functor (<$)
+
+sym_Functor :: Proxy Sym_Functor
+sym_Functor = Proxy
-- | 'fmap' alias.
(<$>) :: (Sym_Functor repr, Functor f)
) => ast -> ast
-> ExprFrom ast (Expr_Functor root) hs ret
fmap_from ast_g ast_fa ex ast ctx k =
- -- NOTE: fmap :: Functor f => (a -> b) -> f a -> f b
+ -- fmap :: Functor f => (a -> b) -> f a -> f b
expr_from (Proxy::Proxy root) ast_g ctx $
\(ty_g::ty h_g) (Forall_Repr_with_Context g) ->
expr_from (Proxy::Proxy root) ast_fa ctx $
io_hClose = repr_text_app1 "io_hClose"
io_openFile = repr_text_app2 "io_openFile"
instance (Sym_IO r1, Sym_IO r2) => Sym_IO (Repr_Dup r1 r2) where
- io_hClose (h1 `Repr_Dup` h2) =
- io_hClose h1 `Repr_Dup` io_hClose h2
- io_openFile (f1 `Repr_Dup` f2) (m1 `Repr_Dup` m2) =
- io_openFile f1 m1 `Repr_Dup` io_openFile f2 m2
+ io_hClose = repr_dup1 sym_IO io_hClose
+ io_openFile = repr_dup2 sym_IO io_openFile
+
+sym_IO :: Proxy Sym_IO
+sym_IO = Proxy
-- * Type 'Expr_IO'
-- | Expression.
" else " <> ko p' v
instance (Sym_If r1, Sym_If r2) => Sym_If (Repr_Dup r1 r2) where
- if_ (c1 `Repr_Dup` c2) (ok1 `Repr_Dup` ok2) (ko1 `Repr_Dup` ko2) =
- if_ c1 ok1 ko1 `Repr_Dup` if_ c2 ok2 ko2
+ if_ = repr_dup3 sym_If if_
+
+sym_If :: Proxy Sym_If
+sym_If = Proxy
-- * Class 'Sym_When'
-- | Symantic.
"when " <> cond p' v <>
" " <> ok p' v
instance (Sym_When r1, Sym_When r2) => Sym_When (Repr_Dup r1 r2) where
- when (c1 `Repr_Dup` c2) (ok1 `Repr_Dup` ok2) =
- when c1 ok1 `Repr_Dup` when c2 ok2
+ when = repr_dup2 sym_When when
+
+sym_When :: Proxy Sym_When
+sym_When = Proxy
-- * Type 'Expr_If'
-- | Expression.
-- | Expression for 'Int'.
module Language.Symantic.Expr.Int where
+import Data.Proxy
import qualified Data.Text as Text
import Language.Symantic.Type
instance (Sym_Int r1, Sym_Int r2) => Sym_Int (Repr_Dup r1 r2) where
int x = int x `Repr_Dup` int x
+sym_Int :: Proxy Sym_Int
+sym_Int = Proxy
+
-- * Type 'Expr_Int'
-- | Expression.
data Expr_Int (root:: *)
-- | Expression for 'Integer'.
module Language.Symantic.Expr.Integer where
+import Data.Proxy
import qualified Data.Text as Text
import Language.Symantic.Type
instance Sym_Integer Repr_Text where
integer a = Repr_Text $ \_p _v ->
Text.pack (show a)
-instance
- ( Sym_Integer r1
- , Sym_Integer r2
- ) => Sym_Integer (Repr_Dup r1 r2) where
+instance (Sym_Integer r1, Sym_Integer r2) => Sym_Integer (Repr_Dup r1 r2) where
integer x = integer x `Repr_Dup` integer x
+sym_Integer :: Proxy Sym_Integer
+sym_Integer = Proxy
+
-- * Type 'Expr_Integer'
-- | Expression.
data Expr_Integer (root:: *)
quotRem = repr_text_app2 "quotRem"
divMod = repr_text_app2 "divMod"
toInteger = repr_text_app1 "toInteger"
-instance
- ( Sym_Integral r1
- , Sym_Integral r2
- ) => Sym_Integral (Repr_Dup r1 r2) where
- quot (x1 `Repr_Dup` x2) (y1 `Repr_Dup` y2) = quot x1 y1 `Repr_Dup` quot x2 y2
- div (x1 `Repr_Dup` x2) (y1 `Repr_Dup` y2) = div x1 y1 `Repr_Dup` div x2 y2
- rem (x1 `Repr_Dup` x2) (y1 `Repr_Dup` y2) = rem x1 y1 `Repr_Dup` rem x2 y2
- mod (x1 `Repr_Dup` x2) (y1 `Repr_Dup` y2) = mod x1 y1 `Repr_Dup` mod x2 y2
- quotRem (x1 `Repr_Dup` x2) (y1 `Repr_Dup` y2) = quotRem x1 y1 `Repr_Dup` quotRem x2 y2
- divMod (x1 `Repr_Dup` x2) (y1 `Repr_Dup` y2) = divMod x1 y1 `Repr_Dup` divMod x2 y2
- toInteger (x1 `Repr_Dup` x2) = toInteger x1 `Repr_Dup` toInteger x2
+instance (Sym_Integral r1, Sym_Integral r2) => Sym_Integral (Repr_Dup r1 r2) where
+ quot = repr_dup2 sym_Integral quot
+ rem = repr_dup2 sym_Integral rem
+ div = repr_dup2 sym_Integral div
+ mod = repr_dup2 sym_Integral mod
+ quotRem = repr_dup2 sym_Integral quotRem
+ divMod = repr_dup2 sym_Integral divMod
+ toInteger = repr_dup1 sym_Integral toInteger
-precedence_Integral :: Precedence
-precedence_Integral = Precedence 7
+sym_Integral :: Proxy Sym_Integral
+sym_Integral = Proxy
-- * Type 'Expr_Integral'
-- | Expression.
const = repr_text_app2 "const"
flip = repr_text_app1 "flip"
instance (Sym_Lambda r1, Sym_Lambda r2) => Sym_Lambda (Repr_Dup r1 r2) where
- ($$) (f1 `Repr_Dup` f2) (x1 `Repr_Dup` x2) = ($$) f1 x1 `Repr_Dup` ($$) f2 x2
+ ($$) = repr_dup2 sym_Lambda ($$)
+
+sym_Lambda :: Proxy Sym_Lambda
+sym_Lambda = Proxy
-- * Type 'Expr_Lambda'
-- | Expression.
list_zipWith = repr_text_app3 "list_zipWith"
list_reverse = repr_text_app1 "list_reverse"
instance (Sym_List r1, Sym_List r2) => Sym_List (Repr_Dup r1 r2) where
- list_empty = list_empty `Repr_Dup` list_empty
- list_cons (a1 `Repr_Dup` a2) (l1 `Repr_Dup` l2) = list_cons a1 l1 `Repr_Dup` list_cons a2 l2
+ list_empty = repr_dup0 sym_List list_empty
+ list_cons = repr_dup2 sym_List list_cons
list l =
let (l1, l2) =
foldr (\(x1 `Repr_Dup` x2) (xs1, xs2) ->
(x1:xs1, x2:xs2)) ([], []) l in
list l1 `Repr_Dup` list l2
- list_filter (f1 `Repr_Dup` f2) (l1 `Repr_Dup` l2) =
- list_filter f1 l1 `Repr_Dup` list_filter f2 l2
- list_zipWith (f1 `Repr_Dup` f2) (la1 `Repr_Dup` la2) (lb1 `Repr_Dup` lb2) =
- list_zipWith f1 la1 lb1 `Repr_Dup` list_zipWith f2 la2 lb2
- list_reverse (l1 `Repr_Dup` l2) =
- list_reverse l1 `Repr_Dup` list_reverse l2
+ list_filter = repr_dup2 sym_List list_filter
+ list_zipWith = repr_dup3 sym_List list_zipWith
+ list_reverse = repr_dup1 sym_List list_reverse
+
+sym_List :: Proxy Sym_List
+sym_List = Proxy
-- * Type 'Expr_List'
-- | Expression.
map_difference = repr_text_app2 "map_difference"
map_foldrWithKey = repr_text_app3 "map_foldrWithKey"
instance (Sym_Map r1, Sym_Map r2) => Sym_Map (Repr_Dup r1 r2) where
- map_from_list (l1 `Repr_Dup` l2) =
- map_from_list l1 `Repr_Dup` map_from_list l2
- mapWithKey (f1 `Repr_Dup` f2) (m1 `Repr_Dup` m2) =
- mapWithKey f1 m1 `Repr_Dup` mapWithKey f2 m2
- map_lookup (k1 `Repr_Dup` k2) (m1 `Repr_Dup` m2) =
- map_lookup k1 m1 `Repr_Dup` map_lookup k2 m2
- map_keys (m1 `Repr_Dup` m2) =
- map_keys m1 `Repr_Dup` map_keys m2
- map_member (k1 `Repr_Dup` k2) (m1 `Repr_Dup` m2) =
- map_member k1 m1 `Repr_Dup` map_member k2 m2
- map_insert (k1 `Repr_Dup` k2) (a1 `Repr_Dup` a2) (m1 `Repr_Dup` m2) =
- map_insert k1 a1 m1 `Repr_Dup` map_insert k2 a2 m2
- map_delete (k1 `Repr_Dup` k2) (m1 `Repr_Dup` m2) =
- map_delete k1 m1 `Repr_Dup` map_delete k2 m2
- map_difference (ma1 `Repr_Dup` ma2) (mb1 `Repr_Dup` mb2) =
- map_difference ma1 mb1 `Repr_Dup` map_difference ma2 mb2
- map_foldrWithKey (f1 `Repr_Dup` f2) (b1 `Repr_Dup` b2) (m1 `Repr_Dup` m2) =
- map_foldrWithKey f1 b1 m1 `Repr_Dup` map_foldrWithKey f2 b2 m2
+ map_from_list = repr_dup1 sym_Map map_from_list
+ mapWithKey = repr_dup2 sym_Map mapWithKey
+ map_lookup = repr_dup2 sym_Map map_lookup
+ map_keys = repr_dup1 sym_Map map_keys
+ map_member = repr_dup2 sym_Map map_member
+ map_insert = repr_dup3 sym_Map map_insert
+ map_delete = repr_dup2 sym_Map map_delete
+ map_difference = repr_dup2 sym_Map map_difference
+ map_foldrWithKey = repr_dup3 sym_Map map_foldrWithKey
+
+sym_Map :: Proxy Sym_Map
+sym_Map = Proxy
-- | Parsing utility to check that the given type is a 'Type_List'
-- or raise 'Error_Expr_Type_mismatch'.
class Sym_Maybe repr where
nothing :: repr (Maybe a)
just :: repr a -> repr (Maybe a)
- maybe :: repr b -> repr ((->) a b) -> repr (Maybe a) -> repr b
+ maybe :: repr b -> repr ((->) a b) -> repr (Maybe a) -> repr b
default nothing :: Trans t repr => t repr (Maybe a)
default just :: Trans t repr => t repr a -> t repr (Maybe a)
just = liftM Just
maybe = liftM3 Maybe.maybe
instance Sym_Maybe Repr_Text where
- nothing =
- Repr_Text $ \_p _v ->
- "nothing"
- just = repr_text_app1 "just"
- maybe = repr_text_app3 "maybe"
+ nothing = repr_text_app0 "nothing"
+ just = repr_text_app1 "just"
+ maybe = repr_text_app3 "maybe"
instance (Sym_Maybe r1, Sym_Maybe r2) => Sym_Maybe (Repr_Dup r1 r2) where
- nothing = nothing `Repr_Dup` nothing
- just (a1 `Repr_Dup` a2) = just a1 `Repr_Dup` just a2
- maybe (m1 `Repr_Dup` m2) (n1 `Repr_Dup` n2) (j1 `Repr_Dup` j2) =
- maybe m1 n1 j1 `Repr_Dup` maybe m2 n2 j2
+ nothing = repr_dup0 sym_Maybe nothing
+ just = repr_dup1 sym_Maybe just
+ maybe = repr_dup3 sym_Maybe maybe
+
+sym_Maybe :: Proxy Sym_Maybe
+sym_Maybe = Proxy
-- * Type 'Expr_Maybe'
-- | Expression.
instance Sym_Monad Repr_Text where
return = repr_text_app1 "return"
(>>=) = repr_text_infix ">>=" (Precedence 1)
+instance (Sym_Monad r1, Sym_Monad r2) => Sym_Monad (Repr_Dup r1 r2) where
+ return = repr_dup1 sym_Monad return
+ (>>=) = repr_dup2 sym_Monad (>>=)
-instance
- ( Sym_Monad r1
- , Sym_Monad r2
- ) => Sym_Monad (Repr_Dup r1 r2) where
- return (a1 `Repr_Dup` a2) =
- return a1 `Repr_Dup` return a2
- (>>=) (m1 `Repr_Dup` m2) (f1 `Repr_Dup` f2) =
- (>>=) m1 f1 `Repr_Dup` (>>=) m2 f2
+sym_Monad :: Proxy Sym_Monad
+sym_Monad = Proxy
-- * Type 'Expr_Monad'
-- | Expression.
-- * Class 'Sym_MonoFunctor'
-- | Symantic.
class Sym_Lambda repr => Sym_MonoFunctor repr where
- omap :: MonoFunctor m => repr (MT.Element m -> MT.Element m) -> repr m -> repr m
- default omap :: (Trans t repr, MonoFunctor m)
- => t repr (MT.Element m -> MT.Element m) -> t repr m -> t repr m
+ omap :: MonoFunctor o => repr (MT.Element o -> MT.Element o) -> repr o -> repr o
+ default omap :: (Trans t repr, MonoFunctor o)
+ => t repr (MT.Element o -> MT.Element o) -> t repr o -> t repr o
omap = trans_map2 omap
instance Sym_MonoFunctor Repr_Host where
omap = liftM2 MT.omap
instance Sym_MonoFunctor Repr_Text where
omap = repr_text_app2 "omap"
-instance
- ( Sym_MonoFunctor r1
- , Sym_MonoFunctor r2
- ) => Sym_MonoFunctor (Repr_Dup r1 r2) where
- omap (f1 `Repr_Dup` f2) (m1 `Repr_Dup` m2) =
- omap f1 m1 `Repr_Dup` omap f2 m2
+instance (Sym_MonoFunctor r1, Sym_MonoFunctor r2) => Sym_MonoFunctor (Repr_Dup r1 r2) where
+ omap = repr_dup2 sym_MonoFunctor omap
+
+sym_MonoFunctor :: Proxy Sym_MonoFunctor
+sym_MonoFunctor = Proxy
-- * Type 'Expr_MonoFunctor'
-- | Expression.
) => ast -> ast
-> ExprFrom ast (Expr_MonoFunctor root) hs ret
omap_from ast_f ast_m ex ast ctx k =
- -- NOTE: omap :: (Element mono -> Element mono) -> mono -> mono
+ -- omap :: (Element mono -> Element mono) -> mono -> mono
expr_from (Proxy::Proxy root) ast_f ctx $
\(ty_f::ty h_f) (Forall_Repr_with_Context f) ->
expr_from (Proxy::Proxy root) ast_m ctx $
mempty = Repr_Host Monoid.mempty
mappend = liftM2 Monoid.mappend
instance Sym_Monoid Repr_Text where
- mempty = Repr_Text $ \_p _v -> "mempty"
+ mempty = repr_text_app0 "mempty"
mappend = repr_text_app2 "mappend"
+instance (Sym_Monoid r1, Sym_Monoid r2) => Sym_Monoid (Repr_Dup r1 r2) where
+ mempty = repr_dup0 sym_Monoid mempty
+ mappend = repr_dup2 sym_Monoid mappend
+
+sym_Monoid :: Proxy Sym_Monoid
+sym_Monoid = Proxy
-- | 'mappend' alias.
(<>) ::
(*) = repr_text_infix "-" (Precedence 7)
fromInteger = repr_text_app1 "fromInteger"
instance (Sym_Num r1, Sym_Num r2) => Sym_Num (Repr_Dup r1 r2) where
- abs (x1 `Repr_Dup` x2) = abs x1 `Repr_Dup` abs x2
- negate (x1 `Repr_Dup` x2) = negate x1 `Repr_Dup` negate x2
- signum (x1 `Repr_Dup` x2) = signum x1 `Repr_Dup` signum x2
- (+) (x1 `Repr_Dup` x2) (y1 `Repr_Dup` y2) = (+) x1 y1 `Repr_Dup` (+) x2 y2
- (-) (x1 `Repr_Dup` x2) (y1 `Repr_Dup` y2) = (-) x1 y1 `Repr_Dup` (-) x2 y2
- (*) (x1 `Repr_Dup` x2) (y1 `Repr_Dup` y2) = (*) x1 y1 `Repr_Dup` (*) x2 y2
- fromInteger (x1 `Repr_Dup` x2) = fromInteger x1 `Repr_Dup` fromInteger x2
+ abs = repr_dup1 sym_Num abs
+ negate = repr_dup1 sym_Num negate
+ signum = repr_dup1 sym_Num signum
+ (+) = repr_dup2 sym_Num (+)
+ (-) = repr_dup2 sym_Num (-)
+ (*) = repr_dup2 sym_Num (*)
+ fromInteger = repr_dup1 sym_Num fromInteger
+
+sym_Num :: Proxy Sym_Num
+sym_Num = Proxy
-- * Type 'Expr_Num'
-- | Expression.
min = liftM2 Ord.min
max = liftM2 Ord.max
instance Sym_Ord Repr_Text where
- compare = repr_text_app2 "compare"
+ compare = repr_text_app2 "compare"
(<) = repr_text_infix "<" (Precedence 4)
(<=) = repr_text_infix "<=" (Precedence 4)
(>) = repr_text_infix ">" (Precedence 4)
(>=) = repr_text_infix ">=" (Precedence 4)
- min = repr_text_app2 "min"
- max = repr_text_app2 "max"
-instance
- ( Sym_Ord r1
- , Sym_Ord r2
- ) => Sym_Ord (Repr_Dup r1 r2) where
- compare (x1 `Repr_Dup` x2) (y1 `Repr_Dup` y2) =
- compare x1 y1 `Repr_Dup` compare x2 y2
- (<) (x1 `Repr_Dup` x2) (y1 `Repr_Dup` y2) =
- (<) x1 y1 `Repr_Dup` (<) x2 y2
- (<=) (x1 `Repr_Dup` x2) (y1 `Repr_Dup` y2) =
- (<=) x1 y1 `Repr_Dup` (<=) x2 y2
- (>) (x1 `Repr_Dup` x2) (y1 `Repr_Dup` y2) =
- (>) x1 y1 `Repr_Dup` (>) x2 y2
- (>=) (x1 `Repr_Dup` x2) (y1 `Repr_Dup` y2) =
- (>=) x1 y1 `Repr_Dup` (>=) x2 y2
- min (x1 `Repr_Dup` x2) (y1 `Repr_Dup` y2) =
- min x1 y1 `Repr_Dup` min x2 y2
- max (x1 `Repr_Dup` x2) (y1 `Repr_Dup` y2) =
- max x1 y1 `Repr_Dup` max x2 y2
+ min = repr_text_app2 "min"
+ max = repr_text_app2 "max"
+instance (Sym_Ord r1, Sym_Ord r2) => Sym_Ord (Repr_Dup r1 r2) where
+ compare = repr_dup2 sym_Ord compare
+ (<) = repr_dup2 sym_Ord (<)
+ (<=) = repr_dup2 sym_Ord (<=)
+ (>) = repr_dup2 sym_Ord (>)
+ (>=) = repr_dup2 sym_Ord (>=)
+ min = repr_dup2 sym_Ord min
+ max = repr_dup2 sym_Ord max
+
+sym_Ord :: Proxy Sym_Ord
+sym_Ord = Proxy
-- * Type 'Expr_Ord'
-- | Expression.
-- | Expression for 'Text'.
module Language.Symantic.Expr.Text where
+import Data.Proxy
import Data.Text (Text)
import qualified Data.Text as Text
text = Repr_Host
instance Sym_Text Repr_Text where
text a = Repr_Text $ \_p _v -> Text.pack (show a)
-instance
- ( Sym_Text r1
- , Sym_Text r2
- ) => Sym_Text (Repr_Dup r1 r2) where
+instance (Sym_Text r1, Sym_Text r2) => Sym_Text (Repr_Dup r1 r2) where
text x = text x `Repr_Dup` text x
+sym_Text :: Proxy Sym_Text
+sym_Text = Proxy
+
-- * Type 'Expr_Text'
-- | Expression.
data Expr_Text (root:: *)
traverse = liftM2 Traversable.traverse
instance Sym_Traversable Repr_Text where
traverse = repr_text_app2 "traverse"
-instance
- ( Sym_Traversable r1
- , Sym_Traversable r2
- ) => Sym_Traversable (Repr_Dup r1 r2) where
- traverse (f1 `Repr_Dup` f2) (m1 `Repr_Dup` m2) =
- traverse f1 m1 `Repr_Dup` traverse f2 m2
+instance (Sym_Traversable r1, Sym_Traversable r2) => Sym_Traversable (Repr_Dup r1 r2) where
+ traverse = repr_dup2 sym_Traversable traverse
+
+sym_Traversable :: Proxy Sym_Traversable
+sym_Traversable = Proxy
-- * Type 'Expr_Traversable'
-- | Expression.
"(" <> a p' v <> ", " <> b p' v <> ")"
fst = repr_text_app1 "fst"
snd = repr_text_app1 "snd"
-instance
- ( Sym_Tuple2 r1
- , Sym_Tuple2 r2
- ) => Sym_Tuple2 (Repr_Dup r1 r2) where
- tuple2 (a1 `Repr_Dup` a2) (b1 `Repr_Dup` b2) =
- tuple2 a1 b1 `Repr_Dup` tuple2 a2 b2
- fst (t1 `Repr_Dup` t2) = fst t1 `Repr_Dup` fst t2
- snd (t1 `Repr_Dup` t2) = snd t1 `Repr_Dup` snd t2
+instance (Sym_Tuple2 r1, Sym_Tuple2 r2) => Sym_Tuple2 (Repr_Dup r1 r2) where
+ tuple2 = repr_dup2 sym_Tuple2 tuple2
+ fst = repr_dup1 sym_Tuple2 fst
+ snd = repr_dup1 sym_Tuple2 snd
+
+sym_Tuple2 :: Proxy Sym_Tuple2
+sym_Tuple2 = Proxy
-- * Type 'Expr_Tuple2'
-- | Expression.
+{-# LANGUAGE ConstraintKinds #-}
{-# LANGUAGE FlexibleContexts #-}
{-# LANGUAGE FlexibleInstances #-}
{-# LANGUAGE MultiParamTypeClasses #-}
{-# LANGUAGE NoImplicitPrelude #-}
+{-# LANGUAGE Rank2Types #-}
{-# LANGUAGE TypeFamilies #-}
{-# LANGUAGE UndecidableInstances #-}
-- | Interpreter to duplicate the representation of an expression
-- it is mainly here for the sake of curiosity.
module Language.Symantic.Repr.Dup where
+import Data.Proxy
+
-- | Interpreter's data.
data Repr_Dup repr1 repr2 a
= Repr_Dup
{ repr_dup_1 :: repr1 a
, repr_dup_2 :: repr2 a
}
+
+repr_dup0
+ :: (cl r, cl s)
+ => Proxy cl
+ -> (forall repr. cl repr => repr a)
+ -> Repr_Dup r s a
+repr_dup0 _cl f = f `Repr_Dup` f
+
+repr_dup1
+ :: (cl r, cl s)
+ => Proxy cl
+ -> (forall repr. cl repr => repr a -> repr b)
+ -> Repr_Dup r s a
+ -> Repr_Dup r s b
+repr_dup1 _cl f (a1 `Repr_Dup` a2) =
+ f a1 `Repr_Dup` f a2
+
+repr_dup2
+ :: (cl r, cl s)
+ => Proxy cl
+ -> (forall repr. cl repr => repr a -> repr b -> repr c)
+ -> Repr_Dup r s a
+ -> Repr_Dup r s b
+ -> Repr_Dup r s c
+repr_dup2 _cl f (a1 `Repr_Dup` a2) (b1 `Repr_Dup` b2) =
+ f a1 b1 `Repr_Dup` f a2 b2
+
+repr_dup3
+ :: (cl r, cl s)
+ => Proxy cl
+ -> (forall repr. cl repr => repr a -> repr b -> repr c -> repr d)
+ -> Repr_Dup r s a
+ -> Repr_Dup r s b
+ -> Repr_Dup r s c
+ -> Repr_Dup r s d
+repr_dup3 _cl f (a1 `Repr_Dup` a2) (b1 `Repr_Dup` b2) (c1 `Repr_Dup` c2) =
+ f a1 b1 c1 `Repr_Dup` f a2 b2 c2
-- * Helpers
-- ** Helpers for lambda applications
+repr_text_app0 :: Text -> Repr_Text h
+repr_text_app0 name = Repr_Text $ \_p _v -> name
repr_text_app1
:: Text
-> Repr_Text a1
instance Type0_Constraint Monoid (Type_Bool root)
instance Type0_Constraint Num (Type_Bool root)
instance Type0_Constraint Integral (Type_Bool root)
-instance Type0_Constraint MT.MonoFunctor (Type_Bool root)
instance Type0_Family Type_Family_MonoElement (Type_Bool root)
+instance Type0_Constraint MT.MonoFunctor (Type_Bool root)
instance String_from_Type (Type_Bool root) where
string_from_type _ = "Bool"
instance Type0_Constraint Monoid (Type_Char root)
instance Type0_Constraint Num (Type_Char root)
instance Type0_Constraint Integral (Type_Char root)
-instance Type0_Constraint MT.MonoFunctor (Type_Char root)
instance Type0_Family Type_Family_MonoElement (Type_Char root)
+instance Type0_Constraint MT.MonoFunctor (Type_Char root)
instance String_from_Type (Type_Char root) where
string_from_type _ = "Char"
type0_constraint _c _ = Nothing
instance Type0_Constraint Num (Type_Either root)
instance Type0_Constraint Integral (Type_Either root)
+instance Type0_Family Type_Family_MonoElement (Type_Either root) where
+ type0_family _at (Type2 _px _l r) = Just r
instance Type0_Constraint MT.MonoFunctor (Type_Either root) where
type0_constraint _c Type2{} = Just Dict
instance Type1_Constraint Functor (Type_Either root) where
type1_constraint _c Type2{} = Just Dict
instance Type1_Constraint Monad (Type_Either root) where
type1_constraint _c Type2{} = Just Dict
-instance Type0_Family Type_Family_MonoElement (Type_Either root) where
- type0_family _at (Type2 _px _l r) = Just r
instance -- Type0_Eq
Type0_Eq root =>
Type0_Eq (Type_Either root) where
type0_constraint _c _ = Nothing
instance Type0_Constraint Num (Type_Fun root)
instance Type0_Constraint Integral (Type_Fun root)
+instance Type0_Family Type_Family_MonoElement (Type_Fun root) where
+ type0_family _at (Type2 _px _r a) = Just a
instance Type0_Constraint MT.MonoFunctor (Type_Fun root) where
type0_constraint _c Type2{} = Just Dict
instance Type1_Constraint Functor (Type_Fun root) where
instance Type1_Constraint Traversable (Type_Fun root)
instance Type1_Constraint Monad (Type_Fun root) where
type1_constraint _c Type2{} = Just Dict
-instance Type0_Family Type_Family_MonoElement (Type_Fun root) where
- type0_family _at (Type2 _px _r a) = Just a
instance -- Type0_Eq
Type0_Eq root =>
instance Type0_Constraint Monoid (Type_IO root)
instance Type0_Constraint Num (Type_IO root)
instance Type0_Constraint Integral (Type_IO root)
+instance Type0_Family Type_Family_MonoElement (Type_IO root) where
+ type0_family _at (Type1 _px a) = Just a
instance Type0_Constraint MT.MonoFunctor (Type_IO root) where
type0_constraint _c Type1{} = Just Dict
instance Type1_Constraint Functor (Type_IO root) where
type1_constraint _c Type1{} = Just Dict
instance Type1_Constraint Monad (Type_IO root) where
type1_constraint _c Type1{} = Just Dict
-instance Type0_Family Type_Family_MonoElement (Type_IO root) where
- type0_family _at (Type1 _px a) = Just a
instance -- Type0_Eq
Type0_Eq root =>
Type0_Eq (Type_IO root) where
type0_constraint _c Type0{} = Just Dict
instance Type0_Constraint Integral (Type_Int root) where
type0_constraint _c Type0{} = Just Dict
-instance Type0_Constraint MT.MonoFunctor (Type_Int root)
instance Type0_Family Type_Family_MonoElement (Type_Int root)
+instance Type0_Constraint MT.MonoFunctor (Type_Int root)
instance String_from_Type (Type_Int root) where
string_from_type _ = "Int"
type0_constraint _c Type0{} = Just Dict
instance Type0_Constraint Integral (Type_Integer root) where
type0_constraint _c Type0{} = Just Dict
-instance Type0_Constraint MT.MonoFunctor (Type_Integer root)
instance Type0_Family Type_Family_MonoElement (Type_Integer root)
+instance Type0_Constraint MT.MonoFunctor (Type_Integer root)
instance String_from_Type (Type_Integer root) where
string_from_type _ = "Integer"
type0_constraint _c Type1{} = Just Dict
instance Type0_Constraint Num (Type_List root)
instance Type0_Constraint Integral (Type_List root)
+instance Type0_Family Type_Family_MonoElement (Type_List root) where
+ type0_family _at (Type1 _px a) = Just a
instance Type0_Constraint MT.MonoFunctor (Type_List root) where
type0_constraint _c Type1{} = Just Dict
instance Type1_Constraint Functor (Type_List root) where
type1_constraint _c Type1{} = Just Dict
instance Type1_Constraint Monad (Type_List root) where
type1_constraint _c Type1{} = Just Dict
-instance Type0_Family Type_Family_MonoElement (Type_List root) where
- type0_family _at (Type1 _px a) = Just a
instance -- Type0_Eq
Type0_Eq root =>
Type0_Eq (Type_List root) where
type0_constraint _c _ = Nothing
instance Type0_Constraint Num (Type_Maybe root)
instance Type0_Constraint Integral (Type_Maybe root)
+instance Type0_Family Type_Family_MonoElement (Type_Maybe root) where
+ type0_family _at (Type1 _px a) = Just a
instance Type0_Constraint MT.MonoFunctor (Type_Maybe root) where
type0_constraint _c Type1{} = Just Dict
instance Type1_Constraint Functor (Type_Maybe root) where
type1_constraint _c (Type1 _ _) = Just Dict
instance Type1_Constraint Monad (Type_Maybe root) where
type1_constraint _c Type1{} = Just Dict
-instance Type0_Family Type_Family_MonoElement (Type_Maybe root) where
- type0_family _at (Type1 _px a) = Just a
instance -- Type0_Eq
Type0_Eq root =>
Type0_Eq (Type_Maybe root) where
type0_constraint _c Type0{} = Just Dict
instance Type0_Constraint Num (Type_Text root)
instance Type0_Constraint Integral (Type_Text root)
-instance Type0_Constraint MT.MonoFunctor (Type_Text root) where
- type0_constraint _c Type0{} = Just Dict
instance Type_Root_Lift (Type0 (Proxy (MT.Element Text))) root =>
Type0_Family Type_Family_MonoElement (Type_Text root) where
type0_family _at Type0{} = Just type0
+instance Type0_Constraint MT.MonoFunctor (Type_Text root) where
+ type0_constraint _c Type0{} = Just Dict
instance -- String_from_Type
String_from_Type (Type_Text root) where
string_from_type _ = "Text"
type0_constraint _c _ = Nothing
instance Type0_Constraint Num (Type_Tuple2 root)
instance Type0_Constraint Integral (Type_Tuple2 root)
+instance Type0_Family Type_Family_MonoElement (Type_Tuple2 root) where
+ type0_family _at (Type2 _px _a b) = Just b
instance Type0_Constraint MT.MonoFunctor (Type_Tuple2 root) where
type0_constraint _c Type2{} = Just Dict
instance Type1_Constraint Functor (Type_Tuple2 root) where
type1_constraint _c Type2{} = Just Dict
instance Type1_Constraint Traversable (Type_Tuple2 root) where
type1_constraint _c Type2{} = Just Dict
-instance Type0_Family Type_Family_MonoElement (Type_Tuple2 root) where
- type0_family _at (Type2 _px _a b) = Just b
instance -- Type0_Eq
Type0_Eq root =>
Type0_Eq (Type_Tuple2 root) where
instance Type0_Constraint Monoid (Type_Unit root)
instance Type0_Constraint Num (Type_Unit root)
instance Type0_Constraint Integral (Type_Unit root)
-instance Type0_Constraint MT.MonoFunctor (Type_Unit root)
instance Type0_Family Type_Family_MonoElement (Type_Unit root)
+instance Type0_Constraint MT.MonoFunctor (Type_Unit root)
instance String_from_Type (Type_Unit root) where
string_from_type _ = "()"