From d27f21d295c4dee21b28e012b784cf78b970c845 Mon Sep 17 00:00:00 2001 From: Julien Moutinho <julm+symantic@autogeree.net> Date: Sat, 24 Jun 2017 23:16:26 +0200 Subject: [PATCH] Remove Proxy in Sym instances. --- symantic-lib/Language/Symantic/Lib/Alternative.hs | 2 +- symantic-lib/Language/Symantic/Lib/Applicative.hs | 2 +- symantic-lib/Language/Symantic/Lib/Bool.hs | 3 +-- symantic-lib/Language/Symantic/Lib/Bounded.hs | 2 +- symantic-lib/Language/Symantic/Lib/Char.hs | 2 +- symantic-lib/Language/Symantic/Lib/Either.hs | 2 +- symantic-lib/Language/Symantic/Lib/Enum.hs | 2 +- symantic-lib/Language/Symantic/Lib/Eq.hs | 2 +- symantic-lib/Language/Symantic/Lib/Foldable.hs | 2 +- symantic-lib/Language/Symantic/Lib/Function.hs | 2 +- symantic-lib/Language/Symantic/Lib/Functor.hs | 2 +- symantic-lib/Language/Symantic/Lib/IO.hs | 6 +++--- symantic-lib/Language/Symantic/Lib/If.hs | 2 +- symantic-lib/Language/Symantic/Lib/Int.hs | 2 +- symantic-lib/Language/Symantic/Lib/Integer.hs | 2 +- symantic-lib/Language/Symantic/Lib/Integral.hs | 2 +- symantic-lib/Language/Symantic/Lib/List.hs | 2 +- symantic-lib/Language/Symantic/Lib/Map.hs | 2 +- symantic-lib/Language/Symantic/Lib/Maybe.hs | 2 +- symantic-lib/Language/Symantic/Lib/Monad.hs | 2 +- symantic-lib/Language/Symantic/Lib/MonoFoldable.hs | 2 +- symantic-lib/Language/Symantic/Lib/MonoFunctor.hs | 2 +- symantic-lib/Language/Symantic/Lib/Monoid.hs | 2 +- symantic-lib/Language/Symantic/Lib/NonNull.hs | 2 +- symantic-lib/Language/Symantic/Lib/Num.hs | 2 +- symantic-lib/Language/Symantic/Lib/Num/Test.hs | 2 +- symantic-lib/Language/Symantic/Lib/Ord.hs | 4 ++-- symantic-lib/Language/Symantic/Lib/Ratio.hs | 2 +- symantic-lib/Language/Symantic/Lib/Real.hs | 2 +- symantic-lib/Language/Symantic/Lib/Semigroup.hs | 2 +- symantic-lib/Language/Symantic/Lib/Sequences.hs | 4 ++-- symantic-lib/Language/Symantic/Lib/Show.hs | 2 +- symantic-lib/Language/Symantic/Lib/Text.hs | 2 +- symantic-lib/Language/Symantic/Lib/Traversable.hs | 2 +- symantic-lib/Language/Symantic/Lib/Tuple2.hs | 2 +- symantic-lib/Language/Symantic/Lib/Unit.hs | 2 +- symantic-lib/symantic-lib.cabal | 2 +- symantic/Language/Symantic/Compiling/Term.hs | 12 ++++++------ symantic/symantic.cabal | 6 +++--- 39 files changed, 50 insertions(+), 51 deletions(-) diff --git a/symantic-lib/Language/Symantic/Lib/Alternative.hs b/symantic-lib/Language/Symantic/Lib/Alternative.hs index 29cb18f..42e3692 100644 --- a/symantic-lib/Language/Symantic/Lib/Alternative.hs +++ b/symantic-lib/Language/Symantic/Lib/Alternative.hs @@ -12,7 +12,7 @@ import Language.Symantic.Lib.Functor (Sym_Functor(..), f1) import Language.Symantic.Lib.Function (a0) -- * Class 'Sym_Alternative' -type instance Sym (Proxy Alternative) = Sym_Alternative +type instance Sym Alternative = Sym_Alternative class Sym_Functor term => Sym_Alternative term where empty :: Alternative f => term (f a) (<|>) :: Alternative f => term (f a) -> term (f a) -> term (f a) diff --git a/symantic-lib/Language/Symantic/Lib/Applicative.hs b/symantic-lib/Language/Symantic/Lib/Applicative.hs index 625516b..9e6227d 100644 --- a/symantic-lib/Language/Symantic/Lib/Applicative.hs +++ b/symantic-lib/Language/Symantic/Lib/Applicative.hs @@ -13,7 +13,7 @@ import Language.Symantic.Lib.Function (a0, b1) import Language.Symantic.Lib.Functor (Sym_Functor(..), (<$>), f1, f2) -- * Class 'Sym_Applicative' -type instance Sym (Proxy Applicative) = Sym_Applicative +type instance Sym Applicative = Sym_Applicative class Sym_Functor term => Sym_Applicative term where pure :: Applicative f => term a -> term (f a) (<*>) :: Applicative f => term (f (a -> b)) -> term (f a) -> term (f b); infixl 4 <*> diff --git a/symantic-lib/Language/Symantic/Lib/Bool.hs b/symantic-lib/Language/Symantic/Lib/Bool.hs index 15a0f0b..34820fc 100644 --- a/symantic-lib/Language/Symantic/Lib/Bool.hs +++ b/symantic-lib/Language/Symantic/Lib/Bool.hs @@ -4,7 +4,6 @@ module Language.Symantic.Lib.Bool where import Control.Monad -import Data.Proxy import Prelude hiding ((&&), not, (||)) import qualified Data.Bool as Bool import qualified Data.Text as Text @@ -13,7 +12,7 @@ import Language.Symantic import Language.Symantic.Lib.Function () -- * Class 'Sym_Bool' -type instance Sym (Proxy Bool) = Sym_Bool +type instance Sym Bool = Sym_Bool class Sym_Bool term where bool :: Bool -> term Bool not :: term Bool -> term Bool diff --git a/symantic-lib/Language/Symantic/Lib/Bounded.hs b/symantic-lib/Language/Symantic/Lib/Bounded.hs index 95240eb..c269548 100644 --- a/symantic-lib/Language/Symantic/Lib/Bounded.hs +++ b/symantic-lib/Language/Symantic/Lib/Bounded.hs @@ -11,7 +11,7 @@ import Language.Symantic import Language.Symantic.Lib.Function (a0) -- * Class 'Sym_Bounded' -type instance Sym (Proxy Bounded) = Sym_Bounded +type instance Sym Bounded = Sym_Bounded class Sym_Bounded term where minBound :: Bounded a => term a maxBound :: Bounded a => term a diff --git a/symantic-lib/Language/Symantic/Lib/Char.hs b/symantic-lib/Language/Symantic/Lib/Char.hs index 7562261..83e8b0e 100644 --- a/symantic-lib/Language/Symantic/Lib/Char.hs +++ b/symantic-lib/Language/Symantic/Lib/Char.hs @@ -12,7 +12,7 @@ import Language.Symantic import Language.Symantic.Lib.List (tyList) -- * Class 'Sym_Char' -type instance Sym (Proxy Char) = Sym_Char +type instance Sym Char = Sym_Char class Sym_Char term where char :: Char -> term Char char_toUpper :: term Char -> term Char diff --git a/symantic-lib/Language/Symantic/Lib/Either.hs b/symantic-lib/Language/Symantic/Lib/Either.hs index 4e0712c..134be19 100644 --- a/symantic-lib/Language/Symantic/Lib/Either.hs +++ b/symantic-lib/Language/Symantic/Lib/Either.hs @@ -12,7 +12,7 @@ import Language.Symantic.Lib.MonoFunctor (Element) import Language.Symantic.Lib.Function (a0, b1, c2) -- * Class 'Sym_Either' -type instance Sym (Proxy Either) = Sym_Either +type instance Sym Either = Sym_Either class Sym_Either term where _Left :: term l -> term (Either l r) _Right :: term r -> term (Either l r) diff --git a/symantic-lib/Language/Symantic/Lib/Enum.hs b/symantic-lib/Language/Symantic/Lib/Enum.hs index 8daa197..966afc4 100644 --- a/symantic-lib/Language/Symantic/Lib/Enum.hs +++ b/symantic-lib/Language/Symantic/Lib/Enum.hs @@ -12,7 +12,7 @@ import Language.Symantic.Lib.Function (a0) import Language.Symantic.Lib.Int (tyInt) -- * Class 'Sym_Enum' -type instance Sym (Proxy Enum) = Sym_Enum +type instance Sym Enum = Sym_Enum class Sym_Enum term where toEnum :: Enum a => term Int -> term a fromEnum :: Enum a => term a -> term Int diff --git a/symantic-lib/Language/Symantic/Lib/Eq.hs b/symantic-lib/Language/Symantic/Lib/Eq.hs index b37c81c..c898864 100644 --- a/symantic-lib/Language/Symantic/Lib/Eq.hs +++ b/symantic-lib/Language/Symantic/Lib/Eq.hs @@ -11,7 +11,7 @@ import Language.Symantic.Lib.Bool (tyBool) import Language.Symantic.Lib.Function (a0) -- * Class 'Sym_Eq' -type instance Sym (Proxy Eq) = Sym_Eq +type instance Sym Eq = Sym_Eq class Sym_Eq term where (==) :: Eq a => term a -> term a -> term Bool; infix 4 == (/=) :: Eq a => term a -> term a -> term Bool; infix 4 /= diff --git a/symantic-lib/Language/Symantic/Lib/Foldable.hs b/symantic-lib/Language/Symantic/Lib/Foldable.hs index c64d0af..bd3dc31 100644 --- a/symantic-lib/Language/Symantic/Lib/Foldable.hs +++ b/symantic-lib/Language/Symantic/Lib/Foldable.hs @@ -25,7 +25,7 @@ import Language.Symantic.Lib.Num (tyNum) import Language.Symantic.Lib.Ord (tyOrd) -- * Class 'Sym_Foldable' -type instance Sym (Proxy Foldable) = Sym_Foldable +type instance Sym Foldable = Sym_Foldable class Sym_Foldable term where foldMap :: Foldable f => Monoid m => term (a -> m) -> term (f a) -> term m foldr :: Foldable f => term (a -> b -> b) -> term b -> term (f a) -> term b diff --git a/symantic-lib/Language/Symantic/Lib/Function.hs b/symantic-lib/Language/Symantic/Lib/Function.hs index 0f77afb..48e08e2 100644 --- a/symantic-lib/Language/Symantic/Lib/Function.hs +++ b/symantic-lib/Language/Symantic/Lib/Function.hs @@ -10,7 +10,7 @@ import qualified Data.MonoTraversable as MT import Language.Symantic -- * Class 'Sym_Function' -type instance Sym (Proxy (->)) = Sym_Function +type instance Sym (->) = Sym_Function class Sym_Function term where comp :: term (b -> c) -> term (a -> b) -> term (a -> c); infixr 9 `comp` const :: term a -> term b -> term a diff --git a/symantic-lib/Language/Symantic/Lib/Functor.hs b/symantic-lib/Language/Symantic/Lib/Functor.hs index ab19246..e4ad6cc 100644 --- a/symantic-lib/Language/Symantic/Lib/Functor.hs +++ b/symantic-lib/Language/Symantic/Lib/Functor.hs @@ -13,7 +13,7 @@ import Language.Symantic import Language.Symantic.Lib.Function (a0, b1) -- * Class 'Sym_Functor' -type instance Sym (Proxy Functor) = Sym_Functor +type instance Sym Functor = Sym_Functor class Sym_Functor term where fmap :: Functor f => term (a -> b) -> term (f a) -> term (f b) default fmap :: Sym_Functor (UnT term) => Trans term => Functor f => term (a -> b) -> term (f a) -> term (f b) diff --git a/symantic-lib/Language/Symantic/Lib/IO.hs b/symantic-lib/Language/Symantic/Lib/IO.hs index f999402..a67010b 100644 --- a/symantic-lib/Language/Symantic/Lib/IO.hs +++ b/symantic-lib/Language/Symantic/Lib/IO.hs @@ -12,9 +12,9 @@ import Language.Symantic.Lib.MonoFunctor (Element) import Language.Symantic.Lib.Unit (tyUnit) -- * Class 'Sym_IO' -type instance Sym (Proxy IO) = Sym_IO -type instance Sym (Proxy IO.Handle) = Sym_IO_Handle -type instance Sym (Proxy IO.IOMode) = Sym_IO_Mode +type instance Sym IO = Sym_IO +type instance Sym IO.Handle = Sym_IO_Handle +type instance Sym IO.IOMode = Sym_IO_Mode class Sym_IO (term:: * -> *) class Sym_IO_Handle (term:: * -> *) where io_hClose :: term IO.Handle -> term (IO ()) diff --git a/symantic-lib/Language/Symantic/Lib/If.hs b/symantic-lib/Language/Symantic/Lib/If.hs index aebbb85..e23d044 100644 --- a/symantic-lib/Language/Symantic/Lib/If.hs +++ b/symantic-lib/Language/Symantic/Lib/If.hs @@ -13,7 +13,7 @@ import Language.Symantic.Lib.Function (a0) data If -- * Class 'Sym_If' -type instance Sym (Proxy If) = Sym_If +type instance Sym If = Sym_If class Sym_If term where if_ :: term Bool -> term a -> term a -> term a default if_ :: Sym_If (UnT term) => Trans term => term Bool -> term a -> term a -> term a diff --git a/symantic-lib/Language/Symantic/Lib/Int.hs b/symantic-lib/Language/Symantic/Lib/Int.hs index b442ee7..2ab4332 100644 --- a/symantic-lib/Language/Symantic/Lib/Int.hs +++ b/symantic-lib/Language/Symantic/Lib/Int.hs @@ -8,7 +8,7 @@ import qualified Data.Text as Text import Language.Symantic -- * Class 'Sym_Int' -type instance Sym (Proxy Int) = Sym_Int +type instance Sym Int = Sym_Int class Sym_Int term where int :: Int -> term Int default int :: Sym_Int (UnT term) => Trans term => Int -> term Int diff --git a/symantic-lib/Language/Symantic/Lib/Integer.hs b/symantic-lib/Language/Symantic/Lib/Integer.hs index db1fc18..e53a499 100644 --- a/symantic-lib/Language/Symantic/Lib/Integer.hs +++ b/symantic-lib/Language/Symantic/Lib/Integer.hs @@ -9,7 +9,7 @@ import Language.Symantic import Language.Symantic.Grammar -- * Class 'Sym_Integer' -type instance Sym (Proxy Integer) = Sym_Integer +type instance Sym Integer = Sym_Integer class Sym_Integer term where integer :: Integer -> term Integer default integer :: Sym_Integer (UnT term) => Trans term => Integer -> term Integer diff --git a/symantic-lib/Language/Symantic/Lib/Integral.hs b/symantic-lib/Language/Symantic/Lib/Integral.hs index 6de58fa..b139f50 100644 --- a/symantic-lib/Language/Symantic/Lib/Integral.hs +++ b/symantic-lib/Language/Symantic/Lib/Integral.hs @@ -13,7 +13,7 @@ import Language.Symantic.Lib.Integer (tyInteger) import Language.Symantic.Lib.Tuple2 (tyTuple2) -- * Class 'Sym_Integral' -type instance Sym (Proxy Integral) = Sym_Integral +type instance Sym Integral = Sym_Integral class Sym_Integral term where quot :: Integral i => term i -> term i -> term i; infixl 7 `quot` rem :: Integral i => term i -> term i -> term i; infixl 7 `rem` diff --git a/symantic-lib/Language/Symantic/Lib/List.hs b/symantic-lib/Language/Symantic/Lib/List.hs index 063b53a..25a6de7 100644 --- a/symantic-lib/Language/Symantic/Lib/List.hs +++ b/symantic-lib/Language/Symantic/Lib/List.hs @@ -18,7 +18,7 @@ import Language.Symantic.Lib.Function (a0, b1, c2) import Language.Symantic.Lib.MonoFunctor (Element) -- * Class 'Sym_List' -type instance Sym (Proxy []) = Sym_List +type instance Sym [] = Sym_List class Sym_List term where list_empty :: term [a] list_cons :: term a -> term [a] -> term [a]; infixr 5 `list_cons` diff --git a/symantic-lib/Language/Symantic/Lib/Map.hs b/symantic-lib/Language/Symantic/Lib/Map.hs index bf3f73b..495f2b9 100644 --- a/symantic-lib/Language/Symantic/Lib/Map.hs +++ b/symantic-lib/Language/Symantic/Lib/Map.hs @@ -17,7 +17,7 @@ import Language.Symantic.Lib.Ord (tyOrd) import Language.Symantic.Lib.Tuple2 (tyTuple2) -- * Class 'Sym_Map' -type instance Sym (Proxy Map) = Sym_Map +type instance Sym Map = Sym_Map class Sym_Map term where map_fromList :: Ord k => term [(k, a)] -> term (Map k a) map_mapWithKey :: term (k -> a -> b) -> term (Map k a) -> term (Map k b) diff --git a/symantic-lib/Language/Symantic/Lib/Maybe.hs b/symantic-lib/Language/Symantic/Lib/Maybe.hs index af3369e..8b562eb 100644 --- a/symantic-lib/Language/Symantic/Lib/Maybe.hs +++ b/symantic-lib/Language/Symantic/Lib/Maybe.hs @@ -13,7 +13,7 @@ import Language.Symantic.Lib.Function (a0, b1) import Language.Symantic.Lib.MonoFunctor (Element) -- * Class 'Sym_Maybe' -type instance Sym (Proxy Maybe) = Sym_Maybe +type instance Sym Maybe = Sym_Maybe class Sym_Maybe term where _Nothing :: term (Maybe a) _Just :: term a -> term (Maybe a) diff --git a/symantic-lib/Language/Symantic/Lib/Monad.hs b/symantic-lib/Language/Symantic/Lib/Monad.hs index a8a761a..61fa628 100644 --- a/symantic-lib/Language/Symantic/Lib/Monad.hs +++ b/symantic-lib/Language/Symantic/Lib/Monad.hs @@ -14,7 +14,7 @@ import Language.Symantic.Lib.Unit (tyUnit) import Language.Symantic.Lib.Bool (tyBool) -- * Class 'Sym_Monad' -type instance Sym (Proxy Monad) = Sym_Monad +type instance Sym Monad = Sym_Monad class Sym_Monad term where return :: Monad m => term a -> term (m a) (>>=) :: Monad m => term (m a) -> term (a -> m b) -> term (m b); infixl 1 >>= diff --git a/symantic-lib/Language/Symantic/Lib/MonoFoldable.hs b/symantic-lib/Language/Symantic/Lib/MonoFoldable.hs index a0988cd..462f929 100644 --- a/symantic-lib/Language/Symantic/Lib/MonoFoldable.hs +++ b/symantic-lib/Language/Symantic/Lib/MonoFoldable.hs @@ -15,7 +15,7 @@ import Language.Symantic.Lib.MonoFunctor (famElement, o0, e1) import Language.Symantic.Lib.Monoid (tyMonoid) -- * Class 'Sym_MonoFoldable' -type instance Sym (Proxy MonoFoldable) = Sym_MonoFoldable +type instance Sym MonoFoldable = Sym_MonoFoldable class Sym_MonoFoldable term where ofoldMap :: (MonoFoldable o, Monoid m) => term (MT.Element o -> m) -> term o -> term m ofoldr :: MonoFoldable o => term (MT.Element o -> b -> b) -> term b -> term o -> term b diff --git a/symantic-lib/Language/Symantic/Lib/MonoFunctor.hs b/symantic-lib/Language/Symantic/Lib/MonoFunctor.hs index e4ae2dc..c3f48a8 100644 --- a/symantic-lib/Language/Symantic/Lib/MonoFunctor.hs +++ b/symantic-lib/Language/Symantic/Lib/MonoFunctor.hs @@ -25,7 +25,7 @@ famElement :: Source src => Type src vs t -> Type src vs (MT.Element t) famElement o = TyFam noSource (lenVars o) (inj_Const @Element) (o `TypesS` TypesZ) -- * Class 'Sym_MonoFunctor' -type instance Sym (Proxy MonoFunctor) = Sym_MonoFunctor +type instance Sym MonoFunctor = Sym_MonoFunctor class Sym_MonoFunctor term where omap :: MonoFunctor o => term (MT.Element o -> MT.Element o) -> term o -> term o default omap diff --git a/symantic-lib/Language/Symantic/Lib/Monoid.hs b/symantic-lib/Language/Symantic/Lib/Monoid.hs index beda28c..1924e04 100644 --- a/symantic-lib/Language/Symantic/Lib/Monoid.hs +++ b/symantic-lib/Language/Symantic/Lib/Monoid.hs @@ -11,7 +11,7 @@ import Language.Symantic import Language.Symantic.Lib.Function (a0) -- * Class 'Sym_Monoid' -type instance Sym (Proxy Monoid) = Sym_Monoid +type instance Sym Monoid = Sym_Monoid class Sym_Monoid term where mempty :: Monoid a => term a mappend :: Monoid a => term a -> term a -> term a diff --git a/symantic-lib/Language/Symantic/Lib/NonNull.hs b/symantic-lib/Language/Symantic/Lib/NonNull.hs index 607eba7..aae6737 100644 --- a/symantic-lib/Language/Symantic/Lib/NonNull.hs +++ b/symantic-lib/Language/Symantic/Lib/NonNull.hs @@ -19,7 +19,7 @@ import Language.Symantic.Lib.Sequences (tySemiSequence, tyIsSequence, s0) import Language.Symantic.Lib.Tuple2 (tyTuple2) -- * Class 'Sym_NonNull' -type instance Sym (Proxy NonNull) = Sym_NonNull +type instance Sym NonNull = Sym_NonNull class Sym_NonNull term where fromNullable :: MonoFoldable o => term o -> term (Maybe (NonNull o)) toNullable :: MonoFoldable o => term (NonNull o) -> term o diff --git a/symantic-lib/Language/Symantic/Lib/Num.hs b/symantic-lib/Language/Symantic/Lib/Num.hs index d99b697..5d4566d 100644 --- a/symantic-lib/Language/Symantic/Lib/Num.hs +++ b/symantic-lib/Language/Symantic/Lib/Num.hs @@ -12,7 +12,7 @@ import Language.Symantic.Lib.Function (a0) import Language.Symantic.Lib.Integer (tyInteger) -- * Class 'Sym_Num' -type instance Sym (Proxy Num) = Sym_Num +type instance Sym Num = Sym_Num class Sym_Num term where abs :: Num n => term n -> term n negate :: Num n => term n -> term n diff --git a/symantic-lib/Language/Symantic/Lib/Num/Test.hs b/symantic-lib/Language/Symantic/Lib/Num/Test.hs index 9e69f91..e65ee30 100644 --- a/symantic-lib/Language/Symantic/Lib/Num/Test.hs +++ b/symantic-lib/Language/Symantic/Lib/Num/Test.hs @@ -76,7 +76,7 @@ tests = testGroup "Num" -- | A newtype to test prefix and postfix. newtype Num2 a = Num2 a -type instance Sym (Proxy Num2) = Sym_Num2 +type instance Sym Num2 = Sym_Num2 class Sym_Num2 (term:: * -> *) where instance Sym_Num2 Eval where diff --git a/symantic-lib/Language/Symantic/Lib/Ord.hs b/symantic-lib/Language/Symantic/Lib/Ord.hs index fc9d961..d539ee7 100644 --- a/symantic-lib/Language/Symantic/Lib/Ord.hs +++ b/symantic-lib/Language/Symantic/Lib/Ord.hs @@ -14,7 +14,7 @@ import Language.Symantic.Lib.Function (a0) import Language.Symantic.Lib.Eq (Sym_Eq) -- * Class 'Sym_Ordering' -type instance Sym (Proxy Ordering) = Sym_Ordering +type instance Sym Ordering = Sym_Ordering class Sym_Eq term => Sym_Ordering term where ordering :: Ordering -> term Ordering default ordering :: Sym_Ordering (UnT term) => Trans term => Ordering -> term Ordering @@ -54,7 +54,7 @@ teOrdering :: Source src => Inj_Sym ss Ordering => Ordering -> Term src ss ts '[ teOrdering o = Term noConstraint tyOrdering $ teSym @Ordering $ ordering o -- * Class 'Sym_Ord' -type instance Sym (Proxy Ord) = Sym_Ord +type instance Sym Ord = Sym_Ord class Sym_Eq term => Sym_Ord term where compare :: Ord a => term a -> term a -> term Ordering (<) :: Ord a => term a -> term a -> term Bool; infix 4 < diff --git a/symantic-lib/Language/Symantic/Lib/Ratio.hs b/symantic-lib/Language/Symantic/Lib/Ratio.hs index 46ed41b..77a8b5e 100644 --- a/symantic-lib/Language/Symantic/Lib/Ratio.hs +++ b/symantic-lib/Language/Symantic/Lib/Ratio.hs @@ -11,7 +11,7 @@ import Language.Symantic.Lib.Function (a0) import Language.Symantic.Lib.Integral (tyIntegral) -- * Class 'Sym_Ratio' -type instance Sym (Proxy Ratio) = Sym_Ratio +type instance Sym Ratio = Sym_Ratio class Sym_Ratio term where ratio :: Integral a => term a -> term a -> term (Ratio a) numerator :: term (Ratio a) -> term a diff --git a/symantic-lib/Language/Symantic/Lib/Real.hs b/symantic-lib/Language/Symantic/Lib/Real.hs index aa81010..9a03bc4 100644 --- a/symantic-lib/Language/Symantic/Lib/Real.hs +++ b/symantic-lib/Language/Symantic/Lib/Real.hs @@ -13,7 +13,7 @@ import Language.Symantic.Lib.Integer (tyInteger) import Language.Symantic.Lib.Ratio (tyRatio) -- * Class 'Sym_Real' -type instance Sym (Proxy Real) = Sym_Real +type instance Sym Real = Sym_Real class Sym_Real term where toRational :: Real a => term a -> term Rational default toRational :: Sym_Real (UnT term) => Trans term => Real a => term a -> term Rational diff --git a/symantic-lib/Language/Symantic/Lib/Semigroup.hs b/symantic-lib/Language/Symantic/Lib/Semigroup.hs index ac0b8ee..0cf5d37 100644 --- a/symantic-lib/Language/Symantic/Lib/Semigroup.hs +++ b/symantic-lib/Language/Symantic/Lib/Semigroup.hs @@ -11,7 +11,7 @@ import Language.Symantic.Lib.Function (a0, b1) import Language.Symantic.Lib.Integral (tyIntegral) -- * Class 'Sym_Semigroup' -type instance Sym (Proxy Semigroup) = Sym_Semigroup +type instance Sym Semigroup = Sym_Semigroup class Sym_Semigroup term where (<>) :: Semigroup a => term a -> term a -> term a stimes :: (Semigroup a, Integral b) => term b -> term a -> term a diff --git a/symantic-lib/Language/Symantic/Lib/Sequences.hs b/symantic-lib/Language/Symantic/Lib/Sequences.hs index fd2bcba..2d38cae 100644 --- a/symantic-lib/Language/Symantic/Lib/Sequences.hs +++ b/symantic-lib/Language/Symantic/Lib/Sequences.hs @@ -14,7 +14,7 @@ import Language.Symantic.Lib.Bool (tyBool) import Language.Symantic.Lib.MonoFunctor (e1, famElement) -- * Class 'Sym_SemiSequence' -type instance Sym (Proxy SemiSequence) = Sym_SemiSequence +type instance Sym SemiSequence = Sym_SemiSequence class Sym_SemiSequence term where intersperse :: SemiSequence s => term (MT.Element s) -> term s -> term s cons :: SemiSequence s => term (MT.Element s) -> term s -> term s @@ -84,7 +84,7 @@ teSemiSequence_snoc :: TermDef SemiSequence '[Proxy s, Proxy e] (SemiSequence s teSemiSequence_snoc = Term (tySemiSequence s0 # e1 #~ famElement s0) (s0 ~> e1 ~> s0) $ teSym @SemiSequence $ lam2 snoc -- * Class 'Sym_IsSequence' -type instance Sym (Proxy IsSequence) = Sym_IsSequence +type instance Sym IsSequence = Sym_IsSequence class Sym_IsSequence term where filter :: IsSequence s => term (MT.Element s -> Bool) -> term s -> term s default filter :: Sym_IsSequence (UnT term) => Trans term => IsSequence s => term (MT.Element s -> Bool) -> term s -> term s diff --git a/symantic-lib/Language/Symantic/Lib/Show.hs b/symantic-lib/Language/Symantic/Lib/Show.hs index c6bb540..5ccda7b 100644 --- a/symantic-lib/Language/Symantic/Lib/Show.hs +++ b/symantic-lib/Language/Symantic/Lib/Show.hs @@ -14,7 +14,7 @@ import Language.Symantic.Lib.Int (tyInt) import Language.Symantic.Lib.List (tyList) -- * Class 'Sym_Show' -type instance Sym (Proxy Show) = Sym_Show +type instance Sym Show = Sym_Show class Sym_Show term where showsPrec :: Show a => term Int -> term a -> term ShowS show :: Show a => term a -> term String diff --git a/symantic-lib/Language/Symantic/Lib/Text.hs b/symantic-lib/Language/Symantic/Lib/Text.hs index a29962c..7db31cb 100644 --- a/symantic-lib/Language/Symantic/Lib/Text.hs +++ b/symantic-lib/Language/Symantic/Lib/Text.hs @@ -14,7 +14,7 @@ import Language.Symantic.Lib.Char () import Language.Symantic.Lib.MonoFunctor (Element) -- * Class 'Sym_Text' -type instance Sym (Proxy Text) = Sym_Text +type instance Sym Text = Sym_Text class Sym_Text term where text :: Text -> term Text default text :: Sym_Text (UnT term) => Trans term => Text -> term Text diff --git a/symantic-lib/Language/Symantic/Lib/Traversable.hs b/symantic-lib/Language/Symantic/Lib/Traversable.hs index 1e9980e..de55162 100644 --- a/symantic-lib/Language/Symantic/Lib/Traversable.hs +++ b/symantic-lib/Language/Symantic/Lib/Traversable.hs @@ -13,7 +13,7 @@ import Language.Symantic.Lib.Function (a0, b1) import Language.Symantic.Lib.Functor (f2) -- * Class 'Sym_Traversable' -type instance Sym (Proxy Traversable) = Sym_Traversable +type instance Sym Traversable = Sym_Traversable class Sym_Traversable term where traverse :: Traversable t => Applicative f => term (a -> f b) -> term (t a) -> term (f (t b)) default traverse :: Sym_Traversable (UnT term) => Trans term => Traversable t => Applicative f => term (a -> f b) -> term (t a) -> term (f (t b)) diff --git a/symantic-lib/Language/Symantic/Lib/Tuple2.hs b/symantic-lib/Language/Symantic/Lib/Tuple2.hs index 95c4a93..ed62a9d 100644 --- a/symantic-lib/Language/Symantic/Lib/Tuple2.hs +++ b/symantic-lib/Language/Symantic/Lib/Tuple2.hs @@ -15,7 +15,7 @@ import Language.Symantic.Lib.MonoFunctor (Element) import Language.Symantic.Lib.Monoid (tyMonoid) -- * Class 'Sym_Tuple2' -type instance Sym (Proxy (,)) = Sym_Tuple2 +type instance Sym (,) = Sym_Tuple2 class Sym_Tuple2 term where tuple2 :: term a -> term b -> term (a, b) fst :: term (a, b) -> term a diff --git a/symantic-lib/Language/Symantic/Lib/Unit.hs b/symantic-lib/Language/Symantic/Lib/Unit.hs index 33eec86..3b07c40 100644 --- a/symantic-lib/Language/Symantic/Lib/Unit.hs +++ b/symantic-lib/Language/Symantic/Lib/Unit.hs @@ -9,7 +9,7 @@ import Language.Symantic import Language.Symantic.Grammar -- * Class 'Sym_Unit' -type instance Sym (Proxy ()) = Sym_Unit +type instance Sym () = Sym_Unit class Sym_Unit term where unit :: term () default unit :: Sym_Unit (UnT term) => Trans term => term () diff --git a/symantic-lib/symantic-lib.cabal b/symantic-lib/symantic-lib.cabal index 6867a82..e963cd1 100644 --- a/symantic-lib/symantic-lib.cabal +++ b/symantic-lib/symantic-lib.cabal @@ -19,7 +19,7 @@ tested-with: GHC==8.0.2 -- PVP: +-+------- breaking API changes -- | | +----- non-breaking API additions -- | | | +--- code changes with no API change -version: 0.0.2.20170623 +version: 0.0.2.20170624 Source-Repository head location: git://git.autogeree.net/symantic diff --git a/symantic/Language/Symantic/Compiling/Term.hs b/symantic/Language/Symantic/Compiling/Term.hs index 9b682d5..19c62d5 100644 --- a/symantic/Language/Symantic/Compiling/Term.hs +++ b/symantic/Language/Symantic/Compiling/Term.hs @@ -111,11 +111,11 @@ newtype TeSym ss ts (t::K.Type) ) -- | Like 'TeSym', but 'CtxTe'-free --- and using 'inj_Sym' to be able to use 'Sym'@ (@'Proxy'@ s)@ inside. +-- and using 'inj_Sym' to be able to use 'Sym'@ s@ inside. teSym :: forall s ss ts t. Inj_Sym ss s => - (forall term. Sym (Proxy s) term => Sym_Lambda term => QualOf t => term (UnQualOf t)) -> + (forall term. Sym s term => Sym_Lambda term => QualOf t => term (UnQualOf t)) -> TeSym ss ts t teSym t = inj_Sym @s (TeSym $ const t) @@ -169,12 +169,12 @@ infixr 5 `CtxTeS` type TermDef s vs t = forall src ss ts. Source src => Inj_Sym ss s => Term src ss ts vs t -- ** Type family 'Sym' -type family Sym (s::K.Type) :: {-term-}(K.Type -> K.Type) -> Constraint +type family Sym (s::k) :: {-term-}(K.Type -> K.Type) -> Constraint -- ** Type family 'Syms' -type family Syms (ss::[K.Type]) (term:: K.Type -> K.Type) :: Constraint where +type family Syms (ss::[K.Type]) (term::K.Type -> K.Type) :: Constraint where Syms '[] term = () - Syms (s ': ss) term = (Sym s term, Syms ss term) + Syms (Proxy s ': ss) term = (Sym s term, Syms ss term) -- ** Type 'Inj_Sym' -- | Convenient type synonym wrapping 'Inj_SymP' @@ -196,7 +196,7 @@ class Inj_SymP p ss s where inj_SymP :: TeSym '[Proxy s] ts t -> TeSym ss ts t instance Inj_SymP Zero (Proxy s ': ss) (s::k) where inj_SymP (TeSym te) = TeSym te -instance Inj_SymP p ss s => Inj_SymP (Succ p) (not_s ': ss) s where +instance Inj_SymP p ss s => Inj_SymP (Succ p) (Proxy not_s ': ss) s where inj_SymP (te::TeSym '[Proxy s] ts t) = case inj_SymP @p te :: TeSym ss ts t of TeSym te' -> TeSym te' diff --git a/symantic/symantic.cabal b/symantic/symantic.cabal index 439c119..658ea1b 100644 --- a/symantic/symantic.cabal +++ b/symantic/symantic.cabal @@ -101,7 +101,7 @@ description: in the host language ('Bool' in Haskell here), or @(Sym_Bool View)@ interprets a term as a textual rendition, etc.). - DSL are then composed/extended by selecting those symantic /classes/ + DSL are then composed\/extended by selecting those symantic /classes/ (and in an embedded DSL those could even be automatically inferred, when @NoMonomorphismRestriction@ is on). Otherwise, when using symantics for a non-embedded DSL @@ -187,7 +187,7 @@ description: Which makes the /type application/ ('TyApp') give us an /arrow kind/ for the Haskell /type constructor/ it applies an Haskell type to, releaving me from tricky workarounds. - * @UndecidableInstances@ for type-level programming that may never terminate. + * @UndecidableInstances@ to relax the checks that the type-level programming does terminate. . __Bugs__ . @@ -226,7 +226,7 @@ tested-with: GHC==8.0.2 -- PVP: +-+------- breaking API changes -- | | +----- non-breaking API additions -- | | | +--- code changes with no API change -version: 6.0.0.20170623 +version: 6.1.0.20170624 Source-Repository head location: git://git.autogeree.net/symantic -- 2.47.2