-- Hoogle documentation, generated by Haddock -- See Hoogle, http://www.haskell.org/hoogle/ -- | A simple imperative, provable programming language for embedded applications. -- -- TODO @package improve @version 0.0.0 module Language.ImProve -- | Core expressions. data E a -- | Variables. data V a -- | All types. class AllE a -- | Number types. class (AllE a) => NumE a type Name = String -- | True term. true :: E Bool -- | False term. false :: E Bool -- | Arbitrary constants. constant :: (AllE a) => a -> E a -- | References a variable. ref :: V a -> E a -- | Logical negation. not_ :: E Bool -> E Bool -- | Logical AND. (&&.) :: E Bool -> E Bool -> E Bool -- | Logical OR. (||.) :: E Bool -> E Bool -> E Bool -- | The conjunction of a E Bool list. and_ :: [E Bool] -> E Bool -- | The disjunction of a E Bool list. or_ :: [E Bool] -> E Bool -- | True iff the predicate is true for any element. any_ :: (a -> E Bool) -> [a] -> E Bool -- | True iff the predicate is true for all elements. all_ :: (a -> E Bool) -> [a] -> E Bool imply :: E Bool -> E Bool -> E Bool -- | Equal. (==.) :: (AllE a) => E a -> E a -> E Bool -- | Not equal. (/=.) :: (AllE a) => E a -> E a -> E Bool -- | Less than. (<.) :: (NumE a) => E a -> E a -> E Bool -- | Less than or equal. (<=.) :: (NumE a) => E a -> E a -> E Bool -- | Greater than. (>.) :: (NumE a) => E a -> E a -> E Bool -- | Greater than or equal. (>=.) :: (NumE a) => E a -> E a -> E Bool -- | Returns the minimum of two numbers. min_ :: (NumE a) => E a -> E a -> E a -- | Returns the minimum of a list of numbers. minimum_ :: (NumE a) => [E a] -> E a -- | Returns the maximum of two numbers. max_ :: (NumE a) => E a -> E a -> E a -- | Returns the maximum of a list of numbers. maximum_ :: (NumE a) => [E a] -> E a -- | Limits between min and max. limit :: (NumE a) => E a -> E a -> E a -> E a -- | Multiplication. (*.) :: (NumE a) => E a -> a -> E a -- | Division. (/.) :: (NumE a) => E a -> a -> E a -- | Modulo. mod_ :: E Int -> Int -> E Int -- | Conditional expression. -- --
-- mux test onTrue onFalse --mux :: E Bool -> E a -> E a -> E a -- | Linear interpolation and extrapolation between two points. linear :: (Float, Float) -> (Float, Float) -> E Float -> E Float -- | Creates a hierarchical scope. scope :: Name -> Stmt a -> Stmt a -- | Boolean variable declaration. bool :: Name -> Bool -> Stmt (V Bool) -- | Boolean variable declaration and immediate assignment. bool' :: Name -> E Bool -> Stmt (E Bool) -- | Int variable declaration. int :: Name -> Int -> Stmt (V Int) -- | Int variable declaration and immediate assignment. int' :: Name -> E Int -> Stmt (E Int) -- | Float variable declaration. float :: Name -> Float -> Stmt (V Float) -- | Float variable declaration and immediate assignment. float' :: Name -> E Float -> Stmt (E Float) -- | Input variable declaration. Input variables are initialized to 0. input :: (Name -> a -> Stmt (V a)) -> Name -> Stmt (E a) -- | The Stmt monad holds variable declarations and statements. data Stmt a (<==) :: (Assign a) => V a -> E a -> Stmt () -- | Conditional if-else. ifelse :: E Bool -> Stmt () -> Stmt () -> Stmt () -- | Conditional without the else. if_ :: E Bool -> Stmt () -> Stmt () -- | Increments an E Int. incr :: V Int -> Stmt () -- | Decrements an E Int. decr :: V Int -> Stmt () -- | Assert that a condition is true. assert :: Name -> E Bool -> Stmt () -- | Declare an assumption condition is true. assume :: Name -> E Bool -> Stmt () -- | Generate C code. compile :: Name -> Stmt () -> IO () instance Assign Float instance Assign Int instance Assign Bool instance Monad Stmt instance Fractional (E Float) instance (Num a, AllE a, NumE a) => Num (E a) instance Eq (E a) instance Show (E a) instance NumE Float instance NumE Int instance AllE Float instance AllE Int instance AllE Bool