packages feed

expressions 0.1.3 → 0.1.4

raw patch · 3 files changed

+10/−18 lines, 3 filesdep ~latticesdep ~transformersPVP: major bump suggested

API removals or changes: PVP suggests a major version bump

Dependency ranges changed: lattices, transformers

API changes (from Hackage documentation)

- Data.Expression.IfThenElse: instance (Data.Expression.Arithmetic.ArithmeticF Data.Expression.Utils.Indexed.Sum.:<: f, Data.Expression.IfThenElse.IfThenElseF Data.Expression.Utils.Indexed.Sum.:<: f) => GHC.Num.Num (Data.Expression.Utils.Indexed.Functor.IFix f 'Data.Expression.Sort.IntegralSort)

Files

ChangeLog.md view
@@ -1,5 +1,9 @@ # Change Log +## 0.1.4++* Bump dependencies+ ## 0.1.3  * Extracting variables occurring in expression
expressions.cabal view
@@ -1,5 +1,5 @@ name:                expressions-version:             0.1.3+version:             0.1.4 synopsis:            Expressions and Formulae a la carte description:   This package is aimed at providing means of fixing a first-order language and@@ -73,10 +73,10 @@   build-depends:       attoparsec >=0.13 && <0.14,                        base >=4.9 && <4.11,                        containers >=0.5.7 && <0.5.11,-                       lattices >=1.6 && <1.7,+                       lattices >=1.6 && <1.8,                        singletons >=2.2 && <2.4,                        text >=1.2 && <1.3,-                       transformers >=0.5.2 && <0.5.5+                       transformers >=0.5.2 && <0.6   hs-source-dirs:      src   default-language:    Haskell2010   ghc-options:         -Wall
src/Data/Expression/IfThenElse.hs view
@@ -1,5 +1,3 @@-{-# OPTIONS_GHC -fno-warn-orphans #-}- {-# LANGUAGE FlexibleContexts            , FlexibleInstances            , GADTs@@ -22,11 +20,11 @@ module Data.Expression.IfThenElse ( IfThenElseF(..)                                   , ite ) where +import Data.Functor.Const import Data.Monoid import Data.Singletons import Data.Singletons.Decide -import Data.Expression.Arithmetic import Data.Expression.Parser import Data.Expression.Sort import Data.Expression.Utils.Indexed.Eq@@ -36,8 +34,6 @@ import Data.Expression.Utils.Indexed.Sum import Data.Expression.Utils.Indexed.Traversable -import qualified Data.Functor.Const as F- -- | A functor representing a conditional value (if-then-else) data IfThenElseF a (s :: Sort) where     IfThenElse :: Sing s -> a 'BooleanSort -> a s -> a s -> IfThenElseF a s@@ -52,13 +48,13 @@     index (IfThenElse s _ _ _) = s  instance IFoldable IfThenElseF where-    ifold (IfThenElse _ i t e) = F.Const $ F.getConst i <> F.getConst t <> F.getConst e+    ifold (IfThenElse _ i t e) = Const $ getConst i <> getConst t <> getConst e  instance ITraversable IfThenElseF where     itraverse f (IfThenElse s i t e) = IfThenElse s <$> f i <*> f t <*> f e  instance IShow IfThenElseF where-    ishow (IfThenElse _ i t e) = F.Const $ "(ite " ++ F.getConst i ++ " " ++ F.getConst t ++ " " ++ F.getConst e ++ ")"+    ishow (IfThenElse _ i t e) = Const $ "(ite " ++ getConst i ++ " " ++ getConst t ++ " " ++ getConst e ++ ")"  instance IfThenElseF :<: f => Parseable IfThenElseF f where     parser _ r = do@@ -83,11 +79,3 @@ -- | A smart constructor for an if-then-else expression ite :: forall f s. ( IfThenElseF :<: f, SingI s ) => IFix f 'BooleanSort -> IFix f s -> IFix f s -> IFix f s ite i t e = inject (IfThenElse (sing :: Sing s) i t e)--instance ( ArithmeticF :<: f, IfThenElseF :<: f ) => Num (IFix f 'IntegralSort) where-    (+) = (.+.)-    (*) = (.*.)-    abs a = ite (a .<. 0) (negate a) a-    signum a = ite (a .<. 0) (-1) (ite (a .>. 0) 1 0)-    fromInteger = cnst . fromIntegral-    negate = (* cnst (-1))