MagicHaskeller-0.8.6.2: Automatic inductive functional programmer by systematic searchContentsIndex
MagicHaskeller.Options
Synopsis
data Opt a = Opt {
primopt :: Maybe a
memodepth :: Int
memoCond :: MemoCond
execute :: VarLib -> CoreExpr -> Dynamic
timeout :: Maybe Int
forcibleTimeout :: Bool
guess :: Bool
contain :: Bool
constrL :: Bool
tvndelay :: Int
tv1 :: Bool
tv0 :: Bool
stdgen :: StdGen
nrands :: [Int]
}
options :: Opt a
forget :: Opt a -> Opt ()
chopRnds :: [[a]] -> [[a]]
Documentation
data Opt a
options that limit the hypothesis space.
Constructors
Opt
primopt :: Maybe aUse this option if you want to use a different component library for the stage of solving the inhabitation problem. Nothing means using the same one. This option makes sense only when using *SF style generators, because otherwise the program generation is not staged. Using a minimal set for solving the inhabitation and a redundant library for the real program generation can be a good bet.
memodepth :: Intmemoization depth. (Sub)expressions within this size are memoized, while greater expressions will be recomputed (to save the heap space). Only effective when using ProgGen and unless using the everythingIO family.
memoCond :: MemoCondThis represents which memoization table to be used based on the query type and the search depth, when using the everythingIO family.
execute :: VarLib -> CoreExpr -> Dynamic
timeout :: Maybe IntJust ms sets the timeout to ms microseconds. Also, my implementation of timeout also catches inevitable exceptions like stack space overflow. Note that setting timeout makes the library referentially untransparent. (But currently Just 20000 is the default!) Setting this option to Nothing disables both timeout and capturing exceptions.
forcibleTimeout :: BoolIf this option is True, System.Posix.Process.forkProcess instead of Control.Concurrent.forkIO is used for timeout. The former is much heavier than the latter, but is more preemptive and thus is necessary for interrupting some infinite loops. This record is ignored if FORCIBLETO is not defined.
guess :: BoolIf this option is True, the program guesses whether each function is a casecatamorphismparamorphism or not. This information is used to filter out some duplicate expressions. (History: I once abandoned this guessing strategy around the time I moved to the library implementation, because I could not formally prove the exhaustiveness of the resulting algorithm. For this reason, the old standalone version of MagicHaskeller uses this strategy, but almost the same effect can be obtained by setting this option to True, or using MagicHaskeller.init075 instead of MagicHaskeller.initialize.
contain :: BoolThis option is now obsolete, and we always assume True now. If this option was False, data structures might not contain functions, and thus types like [Int->Int], (Int->Bool, Char), etc. were not permitted. (NB: recently I noticed that making this False might not improve the efficiency of generating lambda terms at all, though when I generated combinatory expressions it WAS necessary. In fact, I mistakenly turned this limitation off, and my code always regarded this as True, but I did not notice that, so this option can be obsoleted.)
constrL :: BoolIf this option is True, matching at the antecedent of induction rules may occur, which constrains generation of existential types. You need to use prefixed (->) to show that some parameter can be matched at the antecedent, e.g., p [| ( []::[a], (:)::a->[a]->[a], foldr :: (a->b->b) -> b -> (->) [a] b ) |] See LibTH.hs for examples.
tvndelay :: Int

Each time the type variable which appears in the return type of a function (e.g. b in foldr::(a->b->b)->b->[a]->b) is expanded to a function type, the search priority of the current computation is lowered by this number. It's default value is 1, which means there is nothing special, and the priority for each expression corresponds to the number of function applications in the expression.

Example: when tvndelay = 1,

The priority of

 \xs -> foldr (\x y -> x+y) 0 xs

is 5, because there are five $'s in

 \xs -> ((foldr $ (\x y -> ((+) $ x) $ y)) $ 0) xs

The priority of

 \xs ys -> foldr (\x y zs -> x : y zs) (\ws->ws) xs ys

is 7, because there are seven $'s in

 \xs ys -> (((foldr $ (\x y zs -> (((:) $ x) $ y) $ zs)) $ (\ws->ws)) $ xs) $ ys

Example: when tvndelay = 2,

The priority of

 \xs -> foldr (\x y -> x+y) 0 xs

is 5, because there are five $'s in

 \xs -> ((foldr $ (\x y -> ((+) $ x) $ y)) $ 0) xs

The priority of

 \xs ys -> foldr (\x y zs -> x : y zs) (\ws->ws) xs ys

is 8, because there are eight $'s in

 \xs ys -> (((foldr $ (\x y zs -> (((:) $ x) $ y) $ zs)) $ (\ws->ws)) $ xs) $$ ys

where $$ denotes the function application caused by expanding a type variable into a function type.

tv1 :: BoolIf this option is True, the return type of functions returning a type variable (e.g. b in foldr::(a->b->b)->b->[a]->b) can only be replaced with Eval t => t and Eval t => u -> t, while if False with Eval t => t, Eval t => u->t, Eval t => u->v->t, etc., where Eval t means t cannot be replaced with a function. The restriction can be amended if the tuple constructor and destructors are available.
tv0 :: Bool
stdgen :: StdGenThe random seed.
nrands :: [Int]number of random samples at each depth, for each type.
options :: Opt a

default options

 options = Opt{ primopt = Nothing
              , memodepth = 10
              , memoCond = \ _type depth -> return $ if depth < 10 then Ram else Recompute
              , execute = unsafeExecute
              , timeout = Just 20000
              , forcibleTimeout = False
              , guess   = False
              , contain = True
              , constrL = False
              , tv1     = False
              , stdgen  = mkStdGen 123456
              , nrands  = repeat 5
              }
forget :: Opt a -> Opt ()
chopRnds :: [[a]] -> [[a]]
Produced by Haddock version 2.7.2