MagicHaskeller-0.8.6.2: Automatic inductive functional programmer by systematic searchContentsIndex
MagicHaskeller.Analytical
Contents
Analytical synthesizer
Synthesizers which can be used with any types.
Synthesizers which are easier to use that can be used only with types appearing defaultPrimitives
Synopsis
get1 :: SplicedPrims -> SplicedPrims -> Exp
getMany :: SplicedPrims -> SplicedPrims -> [[Exp]]
getManyM :: Search m => SplicedPrims -> SplicedPrims -> m Exp
getManyTyped :: SplicedPrims -> SplicedPrims -> [[Exp]]
noBK :: SplicedPrims
c :: Q [Dec] -> ExpQ
type SplicedPrims = ([Dec], [Primitive])
getOne :: [Dec] -> [Dec] -> Exp
synth :: [Dec] -> [Dec] -> [[Exp]]
synthM :: Search m => [Dec] -> [Dec] -> m Exp
synthTyped :: [Dec] -> [Dec] -> [[Exp]]
Analytical synthesizer
This module provides with analytical synthesis, that only generates expressions without testing. (So this alone may not be very useful, and for this reason this is not very well-documented.) In order to generate-and-test over the result of this module, use MagicHaskeller.RunAnalytical.
Synthesizers which can be used with any types.
get1
:: SplicedPrimstarget function definition by example
-> SplicedPrimsbackground knowledge function definitions by example
-> Exp

get1 can be used to synthesize one expression. For example,

>> putStrLn $ pprint $ get1 $(c [d| f [] = 0; f [a] = 1; f [a,b] = 2 |]) noBK
 \a -> let fa (b@([])) = 0
           fa (b@(_ : d)) = succ (fa d)
       in fa a
getMany
:: SplicedPrimstarget function definition by example
-> SplicedPrimsbackground knowledge function definitions by example
-> [[Exp]]
getMany does what you expect from its name.
getManyM
:: Search m
=> SplicedPrimstarget function definition by example
-> SplicedPrimsbackground knowledge function definitions by example
-> m Exp
getManyTyped
:: SplicedPrimstarget function definition by example
-> SplicedPrimsbackground knowledge function definitions by example
-> [[Exp]]
getManyTyped is a variant of getMany that generates typed expressions. This alone is not very useful, but the type info is required when compiling the expression and is used in MagicHaskeller.RunAnalytical.
noBK :: SplicedPrims
c :: Q [Dec] -> ExpQ
Also, $(c [d| ... |]) :: SplicedPrims c is a helper function for extracting some info from the quoted declarations.
type SplicedPrims = ([Dec], [Primitive])
Synthesizers which are easier to use that can be used only with types appearing defaultPrimitives
getOne :: [Dec] -> [Dec] -> Exp

Example:

>> runQ [d| f [] = 0; f [a] = 1; f [a,b] = 2 |] >>= \iops -> putStrLn $ pprint $ getOne iops []
 \a -> let fa (b@([])) = 0
           fa (b@(_ : d)) = succ (fa d)
       in fa a
synth :: [Dec] -> [Dec] -> [[Exp]]
synthM :: Search m => [Dec] -> [Dec] -> m Exp
synthTyped :: [Dec] -> [Dec] -> [[Exp]]
synthTyped is like synth, but adds the infered type signature to each expression. This is useful for executing the expression at runtime using GHC API.
Produced by Haddock version 2.7.2