-- Hoogle documentation, generated by Haddock -- See Hoogle, http://www.haskell.org/hoogle/ -- | CP in Haskell through MiniZinc -- -- This library aims to link Haskell with MiniZinc. It provides an -- abstract syntax tree for the MiniZinc language, with which one can -- define MiniZinc constraint models. One can directly get the -- solution(s) of the model or separately use the corresponding modules -- of the library to pretty-print the model or parse its solution(s). @package haskelzinc @version 0.1.0.0 -- | This module parses the solutions outputed by the specified FlatZinc -- solver. It supports multiple solutions. The parser might fail if there -- is a show item in the represented MiniZinc model which alters the -- default format of the solutions' output. -- -- This parser is built using the Text.Parsec module. module Interfaces.FZSolutionParser -- | Given the path of the file where the solution(s) have been printed, -- this function reads the file, parses the solution(s) and prints them. getSolution :: FilePath -> IO () instance GHC.Show.Show Interfaces.FZSolutionParser.MValue -- | This module provides an interface of the MiniZinc 2.0 language in -- Haskell through the definition of an abstract syntax tree of the -- MiniZinc language. With the use of this module, one can represent -- MiniZinc models in Haskell code. The abstract syntac tree is based on -- the MiniZinc 2.0 spesification. -- -- However, the module does not check semantical correctness of the -- represented model. For example, it does not detect typos in the use of -- previously declared identifiers. -- --
-- > --Gt :: Bop -- |
-- < --Lt :: Bop -- |
-- >= --Gte :: Bop -- |
-- <= --Lte :: Bop -- |
-- == --Eqq :: Bop -- |
-- = --Eq :: Bop -- |
-- != --Neq :: Bop -- |
-- + --BPlus :: Bop -- |
-- - --BMinus :: Bop -- |
-- * --Times :: Bop -- |
-- / --Div :: Bop -- |
-- div --IDiv :: Bop -- |
-- mod --Mod :: Bop -- |
-- <-> --LRarrow :: Bop -- |
-- -> --Rarrow :: Bop -- |
-- <- --Larrow :: Bop -- |
-- /\ --And :: Bop -- |
-- \/ --Or :: Bop -- |
-- in --In :: Bop -- |
-- subset --Sub :: Bop -- |
-- superset --Super :: Bop -- |
-- union --Union :: Bop -- |
-- intersect --Inters :: Bop -- |
-- ++ --Concat :: Bop -- |
-- diff --Diff :: Bop -- |
-- symdiff --SDiff :: Bop -- |
-- .. --RangeOp :: Bop AsFunc :: Bop -> Bop -- | Represents MiniZinc unary operators. Next to each constructor is -- indicated the operator it represents. data Uop -- |
-- not --Not :: Uop -- |
-- + --UPlus :: Uop -- |
-- - --UMinus :: Uop -- | User defined function, test or predicate in MiniZinc. The argument of -- this constructor is the name of the function. userD :: Ident -> Func -- | Prefix notation of a MiniZinc built-in binary operator. prefbop :: Bop -> Func mz_abs :: Func mz_sum :: Func mz_max :: Func mz_min :: Func mz_pow :: Func mz_sqrt :: Func mz_exp :: Func mz_ln :: Func mz_log :: Func mz_log10 :: Func mz_log2 :: Func mz_sin :: Func mz_cos :: Func mz_tan :: Func mz_sinh :: Func mz_cosh :: Func mz_tanh :: Func mz_asin :: Func mz_acos :: Func mz_atan :: Func mz_asinh :: Func mz_acosh :: Func mz_atanh :: Func mz_forall :: Func mz_xorall :: Func mz_show :: Func mz_show_int :: Func mz_show_float :: Func mz_concat :: Func mz_join :: Func mz_card :: Func mz_array_union :: Func mz_length :: Func mz_index_set :: Func mz_index_set_1of2 :: Func mz_index_set_2of2 :: Func mz_array1d :: Func mz_array2d :: Func mz_array3d :: Func mz_array4d :: Func mz_array5d :: Func mz_array6d :: Func mz_occurs :: Func mz_absent :: Func mz_deopt :: Func mz_ceil :: Func mz_floor :: Func mz_round :: Func mz_bool2int :: Func mz_int2float :: Func mz_set2array :: Func mz_lb :: Func mz_ub :: Func mz_lb_array :: Func mz_ub_array :: Func mz_dom :: Func mz_dom_array :: Func mz_dom_size :: Func mz_assert :: Func mz_abort :: Func mz_trace :: Func mz_fix :: Func mz_is_fixed :: Func -- | The type of a MiniZinc's function, test or predicate representation. data Func CName :: Ident -> Func PrefBop :: Bop -> Func -- | The type of a MiniZinc instantiation representation. data Inst -- | A par instantiation in MiniZinc. Par :: Inst -- | A var instantiation in MiniZinc. Dec :: Inst -- | The type for representing the three different kinds of solve items. data Solve Satisfy :: Solve Minimize :: Expr -> Solve Maximize :: Expr -> Solve type CompTail = ([Generator], Maybe Expr) type Generator = ([Ident], Expr) type TypeInst = (Inst, VarType) type Param = (Inst, VarType, Ident) type Ident = String type Filename = String instance GHC.Classes.Eq Interfaces.MZAST.Solve instance GHC.Classes.Eq Interfaces.MZAST.Expr instance GHC.Classes.Eq Interfaces.MZAST.VarType instance GHC.Classes.Eq Interfaces.MZAST.Item instance GHC.Classes.Eq Interfaces.MZAST.Func instance GHC.Classes.Eq Interfaces.MZAST.Inst instance GHC.Classes.Eq Interfaces.MZAST.Uop instance GHC.Classes.Eq Interfaces.MZAST.Bop -- | This module provides a pretty-printer of MiniZinc models represented -- through the MZAST module. This pretty-printer is based on the -- Text.PrettyPrint module. module Interfaces.MZPrinter -- | An abbreviation for the type of a represented MiniZinc model. type MZModel = [Item] -- | Prints the represented MiniZinc model. Essentially, this function -- applies printItem on each element of the specified model. printModel :: MZModel -> Doc -- | Prints an item of the represented model. Example: -- --
-- >>> printItem $ Pred "even" [(Dec, Int, "x")] (Just (Bi Eq (Bi Mod (Var "x") (IConst 2)) (IConst 0))) -- predicate even(var int: x) = -- x mod 2 = 0; --printItem :: Item -> Doc -- | Prints the represented MiniZinc expressions of a model. Examples: -- --
-- >>> printExpr $ SetComp (Bi Times (IConst 2) (Var "i")) ([(["i"], Interval (IConst 1) (IConst 5))], Nothing) -- {2 * i | i in 1..5} ---- --
-- >>> printExpr $ Let [Declare Dec Int "x" (Just (IConst 3)), Declare Dec Int "y" (Just (IConst 4))] (Bi BPlus (Var "x") (Var "y")) -- let {var int: x = 3; -- var int: y = 4;} -- in x + y --printExpr :: Expr -> Doc -- | This module integrates constraint solving programming through MiniZinc -- in Haskell. module Interfaces.MZinHaskell -- | Interactively runs a model and outputs its solution(s). The function -- first prompts the user for the paths of the file in which the -- represented MiniZinc model will be printed and the data file if -- required. Then asks the user to choose between supported solvers and -- the desired number of solutions (only one or all supported for now). -- Finally, it uses the chosen solver and parses the solution(s). iTestModel :: MZModel -> IO () -- | Runs a model and parses its solution(s). testModel :: MZModel -> FilePath -> FilePath -> String -> String -> IO () -- | Writes the model's data file. The MZModel of the argument must -- contain only Assignment items. writeData :: MZModel -> IO ()