-- Hoogle documentation, generated by Haddock -- See Hoogle, http://www.haskell.org/hoogle/ -- | Automatic inductive functional programmer by systematic search -- -- MagicHaskeller is an inductive functional programming system for -- Haskell. This package contains the MagicHaskeller library, which can -- be used within GHCi or as an API for inductive program synthesis. It -- also contains the MagicHaskeller executable that is a standalone -- synthesis program which can be used interactively or as a backend -- server, and the MagicHaskeller.cgi executable that is a CGI frontend -- for providing the Web interface. @package MagicHaskeller @version 0.9.7.1 module MagicHaskeller.FastRatio data Ratio a (:%) :: !Integer -> !Integer -> Ratio a type Rational = Ratio Integer (%) :: Integral a => a -> a -> Ratio a numerator :: Integral a => Ratio a -> a denominator :: Integral a => Ratio a -> a notANumber :: Ratio a reduce :: Integer -> Integer -> Ratio a choose :: Ratio a -> Ratio a instance GHC.Classes.Ord (MagicHaskeller.FastRatio.Ratio a) instance GHC.Classes.Eq (MagicHaskeller.FastRatio.Ratio a) instance GHC.Real.Integral a => GHC.Num.Num (MagicHaskeller.FastRatio.Ratio a) instance GHC.Real.Integral a => GHC.Real.Fractional (MagicHaskeller.FastRatio.Ratio a) instance GHC.Real.Integral a => GHC.Real.RealFrac (MagicHaskeller.FastRatio.Ratio a) instance (GHC.Show.Show a, GHC.Real.Integral a) => GHC.Show.Show (MagicHaskeller.FastRatio.Ratio a) instance GHC.Real.Integral a => GHC.Real.Real (MagicHaskeller.FastRatio.Ratio a) instance GHC.Real.Integral a => GHC.Enum.Enum (MagicHaskeller.FastRatio.Ratio a) module MagicHaskeller.GetTime batchWrite :: FilePath -> [IO a] -> IO () batchRun :: [IO a] -> IO [Integer] time :: MonadIO m => m a -> m (a, Integer) showZero :: [Char] -> [Char] showCPUTime :: Integer -> String lenPrec :: Int module MagicHaskeller.MyCheck newtype Gen a Gen :: (Int -> StdGen -> a) -> Gen a [unGen] :: Gen a -> Int -> StdGen -> a type Coarb a b = a -> Gen b -> Gen b sized :: (Int -> Gen a) -> Gen a arbitraryR :: Random a => (a, a) -> Gen a arbitraryUnit :: Gen () coarbitraryUnit :: Coarb () b arbitraryBool :: Gen Bool coarbitraryBool :: Coarb Bool b arbitraryInt :: Gen Int coarbitraryInt :: Coarb Int b arbitraryInteger :: Gen Integer coarbitraryInteger :: Coarb Integer b arbitraryIntegral :: (Random i, Integral i) => Gen i logvariant :: (Bits i, Integral i) => i -> Gen a -> Gen a newvariant :: (Bits i, Integral i) => i -> Gen a -> Gen a arbitraryFloat :: Gen Float arbitraryDouble :: Gen Double coarbitraryFloat :: Coarb Float b coarbitraryDouble :: Coarb Double b fraction :: Fractional a => Integer -> Integer -> Integer -> a arbitraryRealFloat :: RealFloat a => Gen a coarbitraryRealFloat :: RealFloat a => Coarb a b arbitraryChar :: Gen Char retSpc :: Gen Char arbASC :: Gen Char arbNum :: Gen Char arbLow :: Gen Char arbUpp :: Gen Char coarbitraryChar :: Char -> Gen a -> Gen a arbitraryOrdering :: Gen Ordering arbitraryRatio :: (Random i, Integral i) => Gen (Ratio i) arbitraryMaybe :: Gen a -> Gen (Maybe a) arbitraryList :: Gen a -> Gen [a] k :: Int lg :: (Integral a, Integral b) => a -> b lg' :: Word32 -> Word8 multiplyDeBruijnBitPosition :: ByteString arbitraryPair :: Gen a -> Gen b -> Gen (a, b) arbitraryEither :: Gen a -> Gen b -> Gen (Either a b) arbitraryTriplet :: Gen a -> Gen b -> Gen c -> Gen (a, b, c) arbitraryFun :: Coarb a b -> Gen b -> Gen (a -> b) arbitraryRational :: Gen Rational coarbitraryOrdering :: Coarb Ordering b coarbitraryList :: Coarb a b -> Coarb [a] b coarbitraryMaybe :: Coarb a b -> Coarb (Maybe a) b coarbitraryEither :: Coarb a c -> Coarb b c -> Coarb (Either a b) c coarbitraryRatio :: (Bits a, Integral a) => Coarb (Ratio a) b coarbitraryPair :: Coarb a c -> Coarb b c -> Coarb (a, b) c coarbitraryTriplet :: Coarb a d -> Coarb b d -> Coarb c d -> Coarb (a, b, c) d coarbitraryFun :: Gen a -> Coarb b d -> Coarb (a -> b) d class Arbitrary a arbitrary :: Arbitrary a => Gen a class Coarbitrary a coarbitrary :: Coarbitrary a => a -> Gen b -> Gen b instance MagicHaskeller.MyCheck.Coarbitrary () instance MagicHaskeller.MyCheck.Coarbitrary GHC.Types.Bool instance MagicHaskeller.MyCheck.Coarbitrary GHC.Types.Int instance MagicHaskeller.MyCheck.Coarbitrary GHC.Integer.Type.Integer instance MagicHaskeller.MyCheck.Coarbitrary GHC.Types.Float instance MagicHaskeller.MyCheck.Coarbitrary GHC.Types.Double instance MagicHaskeller.MyCheck.Coarbitrary GHC.Types.Char instance MagicHaskeller.MyCheck.Coarbitrary GHC.Types.Ordering instance MagicHaskeller.MyCheck.Coarbitrary a => MagicHaskeller.MyCheck.Coarbitrary (GHC.Maybe.Maybe a) instance MagicHaskeller.MyCheck.Coarbitrary a => MagicHaskeller.MyCheck.Coarbitrary [a] instance (MagicHaskeller.MyCheck.Coarbitrary a, MagicHaskeller.MyCheck.Coarbitrary b) => MagicHaskeller.MyCheck.Coarbitrary (a, b) instance (MagicHaskeller.MyCheck.Coarbitrary a, MagicHaskeller.MyCheck.Coarbitrary b) => MagicHaskeller.MyCheck.Coarbitrary (Data.Either.Either a b) instance (MagicHaskeller.MyCheck.Coarbitrary a, MagicHaskeller.MyCheck.Coarbitrary b, MagicHaskeller.MyCheck.Coarbitrary c) => MagicHaskeller.MyCheck.Coarbitrary (a, b, c) instance (MagicHaskeller.MyCheck.Coarbitrary a, MagicHaskeller.MyCheck.Arbitrary b) => MagicHaskeller.MyCheck.Arbitrary (a -> b) instance (MagicHaskeller.MyCheck.Arbitrary a, MagicHaskeller.MyCheck.Coarbitrary b) => MagicHaskeller.MyCheck.Coarbitrary (a -> b) instance (GHC.Real.Integral i, Data.Bits.Bits i) => MagicHaskeller.MyCheck.Coarbitrary (MagicHaskeller.FastRatio.Ratio i) instance MagicHaskeller.MyCheck.Arbitrary () instance MagicHaskeller.MyCheck.Arbitrary GHC.Types.Bool instance MagicHaskeller.MyCheck.Arbitrary GHC.Types.Int instance MagicHaskeller.MyCheck.Arbitrary GHC.Integer.Type.Integer instance MagicHaskeller.MyCheck.Arbitrary GHC.Types.Float instance MagicHaskeller.MyCheck.Arbitrary GHC.Types.Double instance MagicHaskeller.MyCheck.Arbitrary GHC.Types.Char instance MagicHaskeller.MyCheck.Arbitrary GHC.Types.Ordering instance MagicHaskeller.MyCheck.Arbitrary a => MagicHaskeller.MyCheck.Arbitrary (GHC.Maybe.Maybe a) instance MagicHaskeller.MyCheck.Arbitrary a => MagicHaskeller.MyCheck.Arbitrary [a] instance (MagicHaskeller.MyCheck.Arbitrary a, MagicHaskeller.MyCheck.Arbitrary b) => MagicHaskeller.MyCheck.Arbitrary (a, b) instance (MagicHaskeller.MyCheck.Arbitrary a, MagicHaskeller.MyCheck.Arbitrary b) => MagicHaskeller.MyCheck.Arbitrary (Data.Either.Either a b) instance (MagicHaskeller.MyCheck.Arbitrary a, MagicHaskeller.MyCheck.Arbitrary b, MagicHaskeller.MyCheck.Arbitrary c) => MagicHaskeller.MyCheck.Arbitrary (a, b, c) instance (GHC.Real.Integral i, System.Random.Random i) => MagicHaskeller.MyCheck.Arbitrary (MagicHaskeller.FastRatio.Ratio i) instance GHC.Base.Functor MagicHaskeller.MyCheck.Gen instance GHC.Base.Applicative MagicHaskeller.MyCheck.Gen instance GHC.Base.Monad MagicHaskeller.MyCheck.Gen module Control.Monad.Search.Combinatorial newtype Matrix a Mx :: Stream (Bag a) -> Matrix a [unMx] :: Matrix a -> Stream (Bag a) (/\) :: Monad m => (a -> m b) -> (t -> m a) -> t -> m b (\/) :: MonadPlus m => (t -> m a) -> (t -> m a) -> t -> m a newtype Recomp a Rc :: (Int -> Bag a) -> Recomp a [unRc] :: Recomp a -> Int -> Bag a newtype RecompT m a RcT :: (Int -> m (Bag a)) -> RecompT m a [unRcT] :: RecompT m a -> Int -> m (Bag a) rcToMx :: Recomp a -> Matrix a mxToRc :: Matrix a -> Recomp a class (Delay m, MonadPlus m, Functor m) => Search m fromRc :: Search m => Recomp a -> m a toRc :: Search m => m a -> Recomp a fromMx :: Search m => Matrix a -> m a toMx :: Search m => m a -> Matrix a fromDB :: Search m => DBound a -> m a fromDF :: Search m => [a] -> m a toDF :: Search m => m a -> [a] -- | mapDepth applies a function to the bag at each depth. mapDepth :: Search m => (Bag a -> Bag b) -> m a -> m b -- | catBags flattens each bag. catBags :: Search m => m (Bag a) -> m a -- | mergesortDepthWithBy converts bags to sets, by (possibly -- sorting each bag and) removing duplicates. Efficiency on lists with -- lots of duplicates is required. mergesortDepthWithBy :: Search m => (k -> k -> k) -> (k -> k -> Ordering) -> m k -> m k ifDepth :: Search m => (Int -> Bool) -> m a -> m a -> m a diag :: Stream (Stream a) -> Stream (Bag a) class Delay m delay :: Delay m => m a -> m a ndelay :: Delay m => Int -> m a -> m a getDepth :: Delay m => m Int msumMx :: Bag a -> Matrix a msumRc :: Bag a -> Recomp a listToRc :: Bag a -> Recomp a consMx :: Bag a -> Matrix a -> Matrix a consRc :: Bag a -> Recomp a -> Recomp a zipWithBF :: Monad m => (a -> b -> m c) -> m a -> m b -> m c printMx :: Show a => Matrix a -> IO () printNMx :: Show a => Int -> Matrix a -> IO () mapDepthDB :: DB m => (Bag (a, Int) -> Bag (b, Int)) -> m a -> m b type Bag a = [a] type Stream a = [a] cat :: [[a]] -> [a] toList :: a -> a getDepth :: Delay m => m Int scanl1BF :: Search m => m x -> m x zipDepthMx :: (Int -> Bag a -> Bag b) -> Matrix a -> Matrix b zipDepthRc :: (Int -> Bag a -> Bag b) -> Recomp a -> Recomp b zipDepth3Mx :: (Int -> Bag a -> Bag b -> Bag c) -> Matrix a -> Matrix b -> Matrix c zipDepth3Rc :: (Int -> Bag a -> Bag b -> Bag c) -> Recomp a -> Recomp b -> Recomp c scanlRc :: (Bag a -> Bag b -> Bag a) -> Bag a -> Recomp b -> Recomp a newtype DBound a DB :: (Int -> Bag (a, Int)) -> DBound a [unDB] :: DBound a -> Int -> Bag (a, Int) newtype DBoundT m a DBT :: (Int -> m (Bag (a, Int))) -> DBoundT m a [unDBT] :: DBoundT m a -> Int -> m (Bag (a, Int)) zipDepthDB :: DB m => (Int -> Bag (a, Int) -> Bag (b, Int)) -> m a -> m b newtype DBMemo a DBM :: Stream (Bag (a, Int)) -> DBMemo a [unDBM] :: DBMemo a -> Stream (Bag (a, Int)) class (Search n) => Memoable m n tabulate :: Memoable m n => n a -> m a applyMemo :: Memoable m n => m a -> n a shrink :: (Ix b, Num b) => (a -> a -> a) -> (a -> a -> Maybe Ordering) -> b -> [(a, b)] -> [(a, b)] class Search m => DB m dbtToRcT :: forall (m :: Type -> Type) a. Monad m => DBoundT m a -> RecompT m a instance GHC.Show.Show a => GHC.Show.Show (Control.Monad.Search.Combinatorial.Matrix a) instance Control.Monad.Search.Combinatorial.Memoable Control.Monad.Search.Combinatorial.DBMemo Control.Monad.Search.Combinatorial.DBound instance Control.Monad.Search.Combinatorial.Memoable Control.Monad.Search.Combinatorial.Matrix Control.Monad.Search.Combinatorial.Recomp instance GHC.Base.Functor f => GHC.Base.Functor (Control.Monad.Search.Combinatorial.DBoundT f) instance (GHC.Base.Functor m, GHC.Base.Monad m) => Control.Monad.Search.Combinatorial.DB (Control.Monad.Search.Combinatorial.DBoundT m) instance (GHC.Base.Functor m, GHC.Base.Monad m) => GHC.Base.Applicative (Control.Monad.Search.Combinatorial.DBoundT m) instance (GHC.Base.Functor m, GHC.Base.Monad m) => GHC.Base.Monad (Control.Monad.Search.Combinatorial.DBoundT m) instance (GHC.Base.Functor m, GHC.Base.Monad m) => GHC.Base.Alternative (Control.Monad.Search.Combinatorial.DBoundT m) instance (GHC.Base.Functor m, GHC.Base.Monad m) => GHC.Base.MonadPlus (Control.Monad.Search.Combinatorial.DBoundT m) instance GHC.Base.Monad m => Control.Monad.Search.Combinatorial.Delay (Control.Monad.Search.Combinatorial.DBoundT m) instance (GHC.Base.Functor m, GHC.Base.Monad m) => Control.Monad.Search.Combinatorial.Search (Control.Monad.Search.Combinatorial.DBoundT m) instance Control.Monad.Search.Combinatorial.DB Control.Monad.Search.Combinatorial.DBound instance Control.Monad.Search.Combinatorial.Search Control.Monad.Search.Combinatorial.DBound instance Control.Monad.Search.Combinatorial.Delay Control.Monad.Search.Combinatorial.Matrix instance Control.Monad.Search.Combinatorial.Search Control.Monad.Search.Combinatorial.DepthFst instance Control.Monad.Search.Combinatorial.Search Control.Monad.Search.Combinatorial.Recomp instance (GHC.Base.Functor m, GHC.Base.Monad m) => Control.Monad.Search.Combinatorial.Search (Control.Monad.Search.Combinatorial.RecompT m) instance Control.Monad.Search.Combinatorial.Search Control.Monad.Search.Combinatorial.Matrix instance GHC.Base.Functor Control.Monad.Search.Combinatorial.DBound instance GHC.Show.Show (Control.Monad.Search.Combinatorial.DBound a) instance GHC.Base.Applicative Control.Monad.Search.Combinatorial.DBound instance GHC.Base.Monad Control.Monad.Search.Combinatorial.DBound instance GHC.Base.Alternative Control.Monad.Search.Combinatorial.DBound instance GHC.Base.MonadPlus Control.Monad.Search.Combinatorial.DBound instance Control.Monad.Search.Combinatorial.Delay Control.Monad.Search.Combinatorial.DBound instance Control.Monad.Search.Combinatorial.Delay Control.Monad.Search.Combinatorial.DepthFst instance Control.Monad.Search.Combinatorial.Delay Control.Monad.Search.Combinatorial.Recomp instance GHC.Base.Monad m => Control.Monad.Search.Combinatorial.Delay (Control.Monad.Search.Combinatorial.RecompT m) instance (GHC.Base.Monad m, Control.Monad.Search.Combinatorial.Delay m) => Control.Monad.Search.Combinatorial.Delay (Control.Monad.Trans.State.Lazy.StateT s m) instance (GHC.Base.Functor m, GHC.Base.Monad m) => GHC.Base.Semigroup (Control.Monad.Search.Combinatorial.RecompT m a) instance (GHC.Base.Functor m, GHC.Base.Monad m) => GHC.Base.Monoid (Control.Monad.Search.Combinatorial.RecompT m a) instance GHC.Base.Functor f => GHC.Base.Functor (Control.Monad.Search.Combinatorial.RecompT f) instance (GHC.Base.Functor m, GHC.Base.Monad m) => GHC.Base.Applicative (Control.Monad.Search.Combinatorial.RecompT m) instance (GHC.Base.Functor m, GHC.Base.Monad m) => GHC.Base.Monad (Control.Monad.Search.Combinatorial.RecompT m) instance (GHC.Base.Functor m, GHC.Base.Monad m) => GHC.Base.Alternative (Control.Monad.Search.Combinatorial.RecompT m) instance (GHC.Base.Functor m, GHC.Base.Monad m) => GHC.Base.MonadPlus (Control.Monad.Search.Combinatorial.RecompT m) instance GHC.Base.Semigroup (Control.Monad.Search.Combinatorial.Recomp a) instance GHC.Base.Monoid (Control.Monad.Search.Combinatorial.Recomp a) instance GHC.Base.Functor Control.Monad.Search.Combinatorial.Recomp instance GHC.Base.Applicative Control.Monad.Search.Combinatorial.Recomp instance GHC.Base.Monad Control.Monad.Search.Combinatorial.Recomp instance GHC.Base.Alternative Control.Monad.Search.Combinatorial.Recomp instance GHC.Base.MonadPlus Control.Monad.Search.Combinatorial.Recomp instance GHC.Show.Show (Control.Monad.Search.Combinatorial.Recomp a) instance GHC.Base.Semigroup (Control.Monad.Search.Combinatorial.Matrix a) instance GHC.Base.Monoid (Control.Monad.Search.Combinatorial.Matrix a) instance GHC.Base.Applicative Control.Monad.Search.Combinatorial.Matrix instance GHC.Base.Monad Control.Monad.Search.Combinatorial.Matrix instance GHC.Base.Alternative Control.Monad.Search.Combinatorial.Matrix instance GHC.Base.MonadPlus Control.Monad.Search.Combinatorial.Matrix instance GHC.Base.Functor Control.Monad.Search.Combinatorial.Matrix module Control.Monad.Search.Best -- | Unlike Matrix, Recomp, etc., the Best monad only -- keeps the best set of results. This makes the analytical synthesis -- like IgorII, and the exhaustive synthesis like Djinn, i.e., the -- resulting algorithms are more efficient, but cannot be used for -- (analytically-)generate-and-test. data Best a Result :: [a] -> Best a Delay :: Best a -> Best a getBests :: Best a -> [a] zero :: Best a fromLists :: [[a]] -> Best a instance GHC.Read.Read a => GHC.Read.Read (Control.Monad.Search.Best.Best a) instance GHC.Show.Show a => GHC.Show.Show (Control.Monad.Search.Best.Best a) instance GHC.Base.Functor Control.Monad.Search.Best.Best instance GHC.Base.Applicative Control.Monad.Search.Best.Best instance GHC.Base.Monad Control.Monad.Search.Best.Best instance GHC.Base.Alternative Control.Monad.Search.Best.Best instance GHC.Base.MonadPlus Control.Monad.Search.Best.Best instance Control.Monad.Search.Combinatorial.Delay Control.Monad.Search.Best.Best instance Control.Monad.Search.Combinatorial.Search Control.Monad.Search.Best.Best instance Control.Monad.Search.Combinatorial.Memoable Control.Monad.Search.Best.Best Control.Monad.Search.Best.Best module MagicHaskeller.PolyDynamic data Dynamic Dynamic :: Type -> (forall a. a) -> Exp -> Dynamic [dynType] :: Dynamic -> Type [unsafeFromDyn] :: Dynamic -> forall a. a [dynExp] :: Dynamic -> Exp fromDyn :: Typeable a => TyConLib -> Dynamic -> a -> a fromDynamic :: MonadPlus m => Type -> Dynamic -> m a dynApply :: Dynamic -> Dynamic -> Maybe Dynamic dynApp :: Dynamic -> Dynamic -> Dynamic infixl 9 `dynApp` dynAppErr :: String -> Dynamic -> Dynamic -> Dynamic unsafeToDyn :: TyConLib -> Type -> a -> Exp -> Dynamic aLittleSafeFromDyn :: Type -> Dynamic -> a fromPD :: a -> a dynamic :: ExpQ -> ExpQ -> ExpQ dynamicH :: ExpQ -> Name -> TypeQ -> ExpQ instance GHC.Show.Show MagicHaskeller.PolyDynamic.Dynamic module MagicHaskeller.CoreLang type Var = Int16 data CoreExpr S :: CoreExpr K :: CoreExpr I :: CoreExpr B :: CoreExpr C :: CoreExpr S' :: CoreExpr B' :: CoreExpr C' :: CoreExpr Y :: CoreExpr Lambda :: CoreExpr -> CoreExpr X :: {-# UNPACK #-} !Int8 -> CoreExpr FunLambda :: CoreExpr -> CoreExpr FunX :: Int8 -> CoreExpr Tuple :: {-# UNPACK #-} !Int8 -> CoreExpr Primitive :: {-# UNPACK #-} !Var -> CoreExpr [primId] :: CoreExpr -> {-# UNPACK #-} !Var PrimCon :: {-# UNPACK #-} !Var -> CoreExpr [primId] :: CoreExpr -> {-# UNPACK #-} !Var Context :: Dictionary -> CoreExpr (:$) :: CoreExpr -> CoreExpr -> CoreExpr Case :: CoreExpr -> [(Var, Int8, CoreExpr)] -> CoreExpr Fix :: CoreExpr -> Int8 -> [Int8] -> CoreExpr VarName :: String -> CoreExpr infixl 9 :$ newtype Dictionary Dict :: Dynamic -> Dictionary [undict] :: Dictionary -> Dynamic arityCE :: CoreExpr -> Int isAbsent :: Int -> CoreExpr -> Bool isa :: Integer -> CoreExpr -> Integer type VarLib = Array Var Dynamic type VarPriorityLib = Array Var Int actualVarName :: String -> Exp stripByd_ :: [Char] -> [Char] headIsX :: CoreExpr -> Bool isAPrimitiveCombinator :: CoreExpr -> Bool removeAbsents :: CoreExpr -> CoreExpr adjustXs :: (Bits a, Num a) => a -> Int8 -> CoreExpr -> CoreExpr unboundXs :: (Bits a, Num a) => Int8 -> CoreExpr -> a subexprs :: CoreExpr -> [CoreExpr] sub :: Integral i => i -> CoreExpr -> [CoreExpr] branches :: CoreExpr -> [CoreExpr] bra :: Integral i => i -> CoreExpr -> [CoreExpr] -- | parentsOfLeaves collects branch nodes whose children are leaf -- nodes. This can be used for incremental learning. parentsOfLeaves :: CoreExpr -> [CoreExpr] pol :: Integral i => i -> CoreExpr -> [CoreExpr] args :: CoreExpr -> [CoreExpr] isALeaf :: CoreExpr -> Bool ceToPriority :: VarPriorityLib -> CoreExpr -> Int exprToTHExp :: VarLib -> CoreExpr -> Exp exprToTHExpLite :: VarLib -> CoreExpr -> Exp exprToTHExp' :: Bool -> Array Var Dynamic -> CoreExpr -> Exp funOccursIn :: Int8 -> CoreExpr -> Bool lightBeta :: CoreExpr -> CoreExpr replace :: Int8 -> Int8 -> CoreExpr -> CoreExpr liftFun :: Int8 -> CoreExpr -> CoreExpr nlift :: Int8 -> Int8 -> CoreExpr -> CoreExpr nliftInt :: Int8 -> Int8 -> Int8 -> Int8 napply :: Integral i => i -> (a -> a) -> a -> a type Primitive = (HValue, Exp, Type) newtype HValue HV :: (forall a. a) -> HValue primitivesToTCL :: [Primitive] -> TyConLib primitivesToVL :: TyConLib -> [Primitive] -> VarLib -- | dynamicsToVL is useful for incremental learning. dynamicsToVL :: [Dynamic] -> VarLib prioritiesToVPL :: [Int] -> VarPriorityLib listToArray :: (Integral i, Ix i) => [a] -> Array i a primitiveToDynamic :: TyConLib -> Primitive -> Dynamic -- | defaultVarLib can be used as a VarLib for testing and -- debugging. Currently this is used only by the analytical synthesizer. defaultVarLib :: VarLib lenDefaultPrimitives :: Integer -- | defaultPrimitives is the set of primitives that we want to -- make sure to appear in VarLib but may not appear in the primitive set -- with which to synthesize. In other words, it is the set of primitives -- we want to make sure to assign IDs to. defaultPrimitives :: [Dynamic] instance GHC.Show.Show MagicHaskeller.CoreLang.Dictionary instance GHC.Classes.Ord MagicHaskeller.CoreLang.CoreExpr instance GHC.Show.Show MagicHaskeller.CoreLang.CoreExpr instance GHC.Classes.Eq MagicHaskeller.CoreLang.CoreExpr instance GHC.Classes.Ord MagicHaskeller.CoreLang.Dictionary instance GHC.Classes.Eq MagicHaskeller.CoreLang.Dictionary instance GHC.Read.Read Language.Haskell.TH.Syntax.Exp module MagicHaskeller.TICE type TI = PriorSubsts Maybe ceToDynamic :: TyConLib -> VarLib -> CoreExpr -> Dynamic tiCE :: (Functor m, MonadPlus m) => TyConLib -> VarLib -> CoreExpr -> m Type tiEx :: forall a (m :: Type -> Type) p. (IArray a Dynamic, MonadPlus m) => p -> a Var Dynamic -> CoreExpr -> PriorSubsts m Type module MagicHaskeller.ExecuteAPI610 pathToGHC :: FilePath loadObj :: [String] -> IO (VarLib -> CoreExpr -> Dynamic) prepareAPI :: [FilePath] -> [FilePath] -> IO HscEnv packageNameToFlag :: String -> PackageFlag unsafeExecuteAPI :: HscEnv -> VarLib -> CoreExpr -> Dynamic executeAPI :: HscEnv -> VarLib -> CoreExpr -> IO a executeTHExp :: HscEnv -> Exp -> IO a compileCoreExpr :: HscEnv -> Exp -> IO CoreExpr unwrapCore :: HscEnv -> CoreExpr -> IO a ce2b :: HscEnv -> CoreExpr -> IO UnlinkedBCO runCoreExpr :: HscEnv -> CoreExpr -> IO a runPrepedCoreExpr :: HscEnv -> CoreExpr -> IO a stmtToCore :: HscEnv -> GhciLStmt GhcPs -> IO (Maybe ([Id], CoreExpr)) perror :: DynFlags -> (Bag ErrMsg, Bag ErrMsg) -> IO (Maybe a) thExpToStmt :: HscEnv -> Exp -> GhciLStmt GhcPs wrapLHsExpr :: (HasSrcSpan a, IdP idL ~ RdrName, XValBinds idL idR ~ NoExtField, XLetStmt idL idR body ~ NoExtField, XHsValBinds idL idR ~ NoExtField, XVarBind idL idR ~ NoExtField, SrcSpanLess a ~ StmtLR idL idR body) => LHsExpr idR -> a thExpToLHsExpr :: HscEnv -> Exp -> LHsExpr GhcPs compileExprHscMain :: HscEnv -> CoreExpr -> IO HValue repeatN :: Int -> ((Any :: Type) -> Any :: Type) -> (Any :: Type) -> Any :: Type repeatIO :: Int -> IO a -> IO a force :: [a] -> a instance GHC.Classes.Eq (CoreSyn.Expr a) module MagicHaskeller.Options -- | options that limit the hypothesis space. data Opt a Opt :: Maybe a -> Int -> (Type -> Int -> Bool) -> MemoCond -> (VarLib -> CoreExpr -> Dynamic) -> Maybe Int -> Bool -> Bool -> Bool -> Bool -> Int -> Bool -> Bool -> StdGen -> [Int] -> (Int -> Int) -> Opt a -- | Use 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. [primopt] :: Opt a -> Maybe a -- | memoization 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. [memodepth] :: Opt a -> Int -- | This represents when to memoize. It takes the query type and the query -- depth, and returns True if the corresponding entry should be -- looked up from the lazy memo table. Currently this only works for -- ProgGenSF. [memoCondPure] :: Opt a -> Type -> Int -> Bool -- | This represents which memoization table to be used based on the query -- type and the search depth, when using the everythingIO -- family. [memoCond] :: Opt a -> MemoCond [execute] :: Opt a -> VarLib -> CoreExpr -> Dynamic -- | Just 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. [timeout] :: Opt a -> Maybe Int -- | If this option is True, forkProcess instead of -- 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. [forcibleTimeout] :: Opt a -> Bool -- | If 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 init075 instead of initialize. [guess] :: Opt a -> Bool -- | This 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.) [contain] :: Opt a -> Bool -- | If 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. [constrL] :: Opt a -> Bool -- | 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. [tvndelay] :: Opt a -> Int -- | If 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. [tv1] :: Opt a -> Bool [tv0] :: Opt a -> Bool -- | The random seed. [stdgen] :: Opt a -> StdGen -- | number of random samples at each depth, for each type, for the filter -- applied during synthesis (used by ProgGenSF, &c.). [nrands] :: Opt a -> [Int] -- | number of random samples at each depth, for each type, for the filter -- applied after synthesis (used by filterThenF, &c.). [fcnrand] :: Opt a -> Int -> Int -- | default options -- --
--   options = Opt{ primopt = Nothing
--                , memodepth = 10
--                , memoCondPure = \ _type depth -> 0<depth
--                , 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
--   
options :: Opt a forget :: Opt a -> Opt () nrnds :: [Int] chopRnds :: [[a]] -> [[a]] fnrnds :: Num p1 => p2 -> p1 module MagicHaskeller.Instantiate mkRandTrie :: [Int] -> TyConLib -> Generator -> RTrie -- | mkRandTrieExt is an extensible version of mkRandTrie -- that can be used with various types including user-defined ones. mkRandTrieExt :: [[(String, Dynamic)]] -> [[(String, Dynamic)]] -> [[(String, Dynamic)]] -> [Int] -> TyConLib -> Generator -> RTrie type RTrie = (CmpMap, Maps, MemoMap, Tries, MapType (Dynamic, Dynamic)) uncurryDyn :: Dynamic -> Type -> Dynamic -> Dynamic -- | uncurryTy converts a->b->c->d->e->r -- into ((((a,b),c),d),e)->r Note that Arbitrary -- (a,b,c,d,e) is not defined in Test.QuickCheck. uncurryTy :: TyConLib -> Type -> Type mkUncurry :: TyConLib -> Dynamic typeToOrd :: CmpMap -> Type -> Maybe Dynamic typeToRandomsOrd :: TyConLib -> RTrie -> Type -> Order typeToRandomsOrdDM :: [Int] -> TyConLib -> RTrie -> Type -> Maybe ([[Dynamic]], PackedOrd) mkCurry :: TyConLib -> Dynamic curryDyn :: Dynamic -> Type -> Dynamic -> Dynamic argTypeToRandoms :: TyConLib -> CmpMap -> Maps -> Type -> Maybe [Dynamic] typeToArb :: ArbMap -> CoarbMap -> Type -> Maybe Dynamic type PackedOrd = Dynamic -> Dynamic -> Ordering typeToCompare :: TyConLib -> CmpMap -> Type -> Maybe (Dynamic -> Dynamic -> Ordering) compareRealFloat :: (NearEq a, RealFloat a) => a -> a -> Ordering module MagicHaskeller.Classification class (Search m) => SStrategy m sfilter :: (SStrategy m, Relation r) => (k -> k -> r) -> (Int -> Int) -> m ([k], e) -> m ([k], e) ofilter :: (SStrategy m, Relation r) => (k -> k -> r) -> m (k, e) -> m (k, e) arbitraries :: Arbitrary a => [a] arbs :: Arbitrary a => Int -> StdGen -> [a] (/~) :: [a] -> (a -> a -> Bool) -> [[a]] nubSortBy :: (a -> a -> Ordering) -> [a] -> [a] nubSortByBot :: (a -> a -> Maybe Ordering) -> [a] -> [a] (/<) :: [a] -> (a -> a -> Ordering) -> [[a]] (/ (a -> a -> Maybe Ordering) -> [[a]] class Eq rel => Relation rel fromListBy :: Relation rel => (k -> k -> rel) -> [k] -> [k] fromListByDB :: Relation rel => (k -> k -> rel) -> [(k, Int)] -> [(k, Int)] (/) :: Relation rel => [k] -> (k -> k -> rel) -> [[k]] appendWithBy :: Relation rel => (k -> k -> k) -> (k -> k -> rel) -> [k] -> [k] -> [k] diffBy :: Relation rel => (k -> k -> rel) -> [k] -> [k] -> [k] cEQ :: Relation rel => rel appendQuotientsBy :: Relation rel => (k -> k -> rel) -> [[k]] -> [[k]] -> [[k]] appendRepresentativesBy :: Relation rel => (k -> k -> rel) -> [k] -> [k] -> [k] unionWithBy :: (a -> a -> a) -> (a -> a -> Bool) -> [a] -> [a] -> [a] randomTestFilter :: (SStrategy m, Filtrable a) => (Int -> Int) -> m (e, a) -> m (e, a) unsafeRandomTestFilter :: (SStrategy m, Filtrable a) => Maybe Int -> (Int -> Int) -> m (e, a) -> m (e, a) mapFst :: (t -> a) -> (t, b) -> (a, b) class Filtrable a filt :: (Filtrable a, SStrategy m) => (Int -> Int) -> m (a, e) -> m e filtFun :: (Filtrable a, SStrategy m, Arbitrary b) => (Int -> Int) -> m (b -> a, e) -> m e unsafeFilt :: (Filtrable a, SStrategy m) => Maybe Int -> (Int -> Int) -> m (a, e) -> m e unsafeFiltFun :: (Filtrable a, SStrategy m, Arbitrary b) => Maybe Int -> (Int -> Int) -> m (b -> a, e) -> m e filtNullary :: (SStrategy m, Relation r) => (k -> k -> r) -> (Int -> Int) -> m (k, e) -> m e filtUnary :: (SStrategy f, Relation r, Arbitrary a) => (k -> k -> r) -> (Int -> Int) -> f (a -> k, b) -> f b compareCx :: (RealFloat a, Ord a) => Complex a -> Complex a -> Ordering ofilterMx :: Relation r => (k -> k -> r) -> Matrix (k, e) -> Matrix (k, e) ofilterDB :: Relation rel => (k -> k -> rel) -> DBound (k, e) -> DBound (k, e) cumulativeRepresentatives :: Relation rel => [a -> a -> rel] -> Matrix a -> Matrix a representatives :: Relation rel => [a -> a -> rel] -> Matrix a -> Matrix a unscanlByList :: Relation r => [k -> k -> r] -> Matrix k -> Matrix k sfilterMx :: Relation r => (k -> k -> r) -> (Int -> Int) -> Matrix ([k], e) -> Matrix ([k], e) liftRelation :: Relation r => (k -> k -> r) -> Int -> ([k], e) -> ([k], e) -> r liftRel :: (Num t1, Relation p, Eq t1) => (t2 -> t3 -> p) -> t1 -> [t2] -> [t3] -> p sfilterDB :: Relation rel => (k -> k -> rel) -> (Int -> Int) -> DBound ([k], e) -> DBound ([k], e) cumulativeQuotients :: Relation rel => [k -> k -> rel] -> Matrix k -> Matrix [k] ns :: [Integer] instance (MagicHaskeller.MyCheck.Arbitrary a, MagicHaskeller.Classification.Filtrable r) => MagicHaskeller.Classification.Filtrable (a -> r) instance GHC.Classes.Ord a => MagicHaskeller.Classification.Filtrable a instance MagicHaskeller.Classification.Filtrable GHC.Types.Double instance (GHC.Float.RealFloat a, GHC.Classes.Ord a) => MagicHaskeller.Classification.Filtrable (Data.Complex.Complex a) instance MagicHaskeller.Classification.SStrategy Control.Monad.Search.Combinatorial.Matrix instance MagicHaskeller.Classification.SStrategy Control.Monad.Search.Combinatorial.DBound instance MagicHaskeller.Classification.Relation GHC.Types.Bool instance MagicHaskeller.Classification.Relation GHC.Types.Ordering instance MagicHaskeller.Classification.Relation (GHC.Maybe.Maybe GHC.Types.Ordering) module MagicHaskeller.Expression class (Ord e, Show e) => Expression e mkHead :: (Expression e, Integral i, Integral j) => (CoreExpr -> Dynamic) -> i -> j -> j -> CoreExpr -> e toCE :: Expression e => e -> CoreExpr fromCE :: Expression e => (CoreExpr -> Dynamic) -> CoreExpr -> e mapCE :: Expression e => (CoreExpr -> CoreExpr) -> e -> e aeAppErr :: Expression e => String -> e -> e -> e appEnv :: Expression e => Int8 -> e -> e -> e toAnnExpr :: Expression e => (CoreExpr -> Dynamic) -> e -> AnnExpr toAnnExprWind :: Expression e => (CoreExpr -> Dynamic) -> Type -> e -> AnnExpr toAnnExprWindWind :: Expression e => (CoreExpr -> Dynamic) -> Type -> e -> AnnExpr fromAnnExpr :: Expression e => AnnExpr -> e reorganize :: (Expression e, Monad m) => ([Type] -> m [e]) -> [Type] -> m [e] reorganize' :: (Expression e, Monad m) => ([Type] -> m [e]) -> [Type] -> m [e] reorganizeId :: Expression e => ([Type] -> [e]) -> [Type] -> [e] replaceVars' :: Expression e => Int8 -> e -> [Int8] -> e reorganizeId' :: (Expression e, Functor m) => ([Type] -> m e) -> [Type] -> m e decodeVars :: Expression e => Int -> [Int8] -> e -> e data MemoExpr ME :: CoreExpr -> Dynamic -> Dynamic -> MemoExpr data AnnExpr AE :: CoreExpr -> Dynamic -> AnnExpr aeToME :: TyConLib -> RTrie -> Type -> AnnExpr -> MemoExpr meToAE :: MemoExpr -> AnnExpr mapFst3 :: (t -> a) -> (t, b, c) -> (a, b, c) decodeVarsPos :: [Int8] -> ([CoreExpr], b, c) -> ([CoreExpr], b, c) decodeVarsCE :: [Int8] -> CoreExpr -> CoreExpr decodeVarsCE' :: Int8 -> Array Int8 Int8 -> CoreExpr -> CoreExpr decodeVarsAE :: Int -> [Int8] -> AnnExpr -> AnnExpr decodeVarsDyn :: Int -> [Int8] -> Dynamic -> Dynamic insAbsents :: Int8 -> [Int8] -> Dynamic (<$>) :: Expression e => e -> e -> e mkHeadAE :: (CoreExpr -> Dynamic) -> Int8 -> Int -> Int8 -> CoreExpr -> AnnExpr windType :: Type -> CoreExpr -> CoreExpr dynSn :: Int8 -> Dynamic getDyn :: Int8 -> Int8 -> Dynamic dynss :: [[Dynamic]] mkDyn :: Int8 -> Int8 -> Dynamic x :: Integral t => t -> Dynamic finiteDynar :: Array (Int8, Int8) Dynamic finiteDynarr :: Array (Int8, Int8, Int8) Dynamic finiteDynss :: [[Dynamic]] finiteDynsss :: [[[Dynamic]]] getDyn_LambdaBoundHead :: Int8 -> Int8 -> Int8 -> Dynamic dynsss :: [[[Dynamic]]] mkDyn_LambdaBoundHead :: Int8 -> Int8 -> Int8 -> Dynamic dynBK :: Dynamic reorganizer :: Monad m => ([Type] -> m [CoreExpr]) -> [Type] -> m [CoreExpr] reorganizerId :: ([Type] -> [CoreExpr]) -> [Type] -> [CoreExpr] replaceVars :: Int8 -> CoreExpr -> [[Int8]] -> [CoreExpr] cvtAvails :: [Type] -> ([Type], [[Int8]]) tkr10 :: [(Type, a)] -> [(Type, [a])] annotate :: [Type] -> [(Type, Int8)] reorganizeCE' :: Monad m => ([Type] -> m [CoreExpr]) -> [Type] -> m [CoreExpr] replaceVarsCE' :: Int8 -> CoreExpr -> [Int8] -> CoreExpr cvtAvails' :: [Type] -> ([Int8], [Type]) uniqSorter :: Expression e => [(e, Int)] -> [(e, Int)] uniqSort :: Ord a => [a] -> [a] swapUniqSort :: (Ord a, Ord b) => [(a, b)] -> [(a, b)] uniqSortAVL :: Ord a => [a] -> [a] uniqSortPatAVL :: Expression e => [(e, Int)] -> [(e, Int)] see :: Int8 -> Int8 -> String seeType :: Int8 -> Int8 -> CoreExpr sees :: Int8 -> Int8 -> Int8 -> String seesType :: Int8 -> Int8 -> Int8 -> CoreExpr e2THE :: CoreExpr -> Exp printTables :: IO () printTable :: IO () pprintType :: Type -> String mkVName :: Char -> Int -> Q Name mkVNames :: Char -> Int -> Q [Name] mkEs :: Int -> Q [Name] mkAs :: Int -> Q [Name] mkXs :: Int -> Q [Name] mkHd :: Q Name hdmnTHEQ :: Int8 -> Int8 -> ExpQ aimnTHEQ :: Int8 -> Int8 -> Int8 -> ExpQ hdmnTHE :: Int8 -> Int8 -> Exp aimnTHE :: Int8 -> Int8 -> Int8 -> Exp hdmnty :: Int8 -> Int8 -> Type aimnty :: Int8 -> Int8 -> Int8 -> Type mkTV :: TyVar -> Type tvrs :: [Type] tvas :: [Type] tvr :: Type maxArity :: Int8 maxLenavails :: Int8 maxDebindex :: Int8 mkCE :: Int8 -> Int8 -> CoreExpr mkCE_LambdaBoundHead :: Int8 -> Int8 -> Int8 -> CoreExpr data CoreExpr instance GHC.Show.Show MagicHaskeller.Expression.AnnExpr instance GHC.Classes.Eq MagicHaskeller.Expression.AnnExpr instance GHC.Classes.Ord MagicHaskeller.Expression.AnnExpr instance MagicHaskeller.Expression.Expression MagicHaskeller.CoreLang.CoreExpr instance MagicHaskeller.Expression.Expression MagicHaskeller.Expression.AnnExpr module MagicHaskeller.ProgramGenerator -- | options for limiting the hypothesis space. type Options = Opt [[Primitive]] data Common Cmn :: Opt () -> TyConLib -> VarLib -> VarLib -> VarPriorityLib -> RTrie -> Common [opt] :: Common -> Opt () [tcl] :: Common -> TyConLib [vl] :: Common -> VarLib [pvl] :: Common -> VarLib [vpl] :: Common -> VarPriorityLib [rt] :: Common -> RTrie class WithCommon a => ProgramGeneratorIO a -- | |mkTrie| creates the generator with the default parameters. mkTrieIO :: ProgramGeneratorIO a => Common -> [Typed [CoreExpr]] -> [[Typed [CoreExpr]]] -> IO a mkTrieOptIO :: ProgramGeneratorIO a => Common -> [Typed [CoreExpr]] -> [[Typed [CoreExpr]]] -> [[Typed [CoreExpr]]] -> IO a -- | Use memoization requiring IO matchingProgramsIO :: ProgramGeneratorIO a => Type -> a -> RecompT IO AnnExpr -- | Use memoization requiring IO unifyingProgramsIO :: ProgramGeneratorIO a => Type -> a -> RecompT IO AnnExpr -- | ProgramGenerator is a generalization of the old Memo type. class WithCommon a => ProgramGenerator a -- | |mkTrie| creates the generator with the default parameters. mkTrie :: ProgramGenerator a => Common -> [Typed [CoreExpr]] -> [[Typed [CoreExpr]]] -> a mkTrieOpt :: ProgramGenerator a => Common -> [Typed [CoreExpr]] -> [[Typed [CoreExpr]]] -> [[Typed [CoreExpr]]] -> a matchingPrograms :: (ProgramGenerator a, Search m) => Type -> a -> m AnnExpr matchingProgramsWOAbsents :: (ProgramGenerator a, Search m) => Type -> a -> m AnnExpr unifyingPrograms :: (ProgramGenerator a, Search m) => Type -> a -> m AnnExpr class WithCommon a extractCommon :: WithCommon a => a -> Common -- | annotated 'Typed [CoreExpr]' type Prim = (Int, Int, Type, TyVar, Typed [CoreExpr]) extractTCL :: WithCommon a => a -> TyConLib extractVL :: WithCommon a => a -> VarLib extractRTrie :: WithCommon a => a -> RTrie reducer :: Common -> CoreExpr -> Dynamic mkCommon :: Options -> [Primitive] -> [Primitive] -> [Int] -> Common initCommon :: Options -> [Primitive] -> Common initCommonExt :: (TyConLib -> [[(String, Dynamic)]]) -> (TyConLib -> [[(String, Dynamic)]]) -> (TyConLib -> [[(String, Dynamic)]]) -> Options -> [Primitive] -> Common -- | updateCommon can be used for incremetal learning updateCommon :: [Dynamic] -> [Dynamic] -> [Int] -> Common -> Common retsTVar :: (a, b, Type, d, e) -> Bool annotateTCEs :: Typed [CoreExpr] -> Prim splitPrims :: [Typed [CoreExpr]] -> ([Prim], [Prim]) splitPrimss :: [[Typed [CoreExpr]]] -> ([[Prim]], [[Prim]]) mapSum :: (MonadPlus m, Delay m) => (a -> m b) -> [[a]] -> m b applyDo :: (Functor m, Monad m) => ([Type] -> Type -> PriorSubsts m a) -> [Type] -> Type -> PriorSubsts m a wind :: (a -> a) -> ([Type] -> Type -> a) -> [Type] -> Type -> a wind_ :: ([Type] -> Type -> a) -> [Type] -> Type -> a fromAssumptions :: (Search m, Expression e) => Common -> Int -> (Type -> PriorSubsts m [e]) -> (Type -> Type -> PriorSubsts m ()) -> Type -> [Type] -> PriorSubsts m [e] retMono :: (Search m, Expression e) => Common -> Int -> (Type -> PriorSubsts m [e]) -> (Type -> PriorSubsts m ()) -> (Int8, (Int, [Type], Type)) -> PriorSubsts m [e] fromAvail :: [Type] -> [(Int8, (Int, [Type], Type))] mguAssumptions :: (Functor m, MonadPlus m) => Type -> [Type] -> PriorSubsts m [CoreExpr] mguAssumptions' :: forall (m :: Type -> Type). MonadPlus m => [Type] -> Type -> PriorSubsts m [CoreExpr] matchAssumptions :: (Functor m, MonadPlus m, Expression e) => Common -> Int -> Type -> [Type] -> PriorSubsts m [e] mguAssumptions_ :: (Functor m, MonadPlus m) => Type -> [Type] -> PriorSubsts m () mguAssumptions_' :: forall (m :: Type -> Type). MonadPlus m => [Type] -> Type -> PriorSubsts m () retPrimMono :: (Search m, Expression e) => Common -> Int -> (Type -> PriorSubsts m [e]) -> (Type -> PriorSubsts m [e]) -> (Type -> PriorSubsts m [e]) -> (Type -> Type -> PriorSubsts m ()) -> Type -> Prim -> PriorSubsts m [e] funApSub :: (Search m, Expression e) => (Type -> PriorSubsts m [e]) -> (Type -> PriorSubsts m [e]) -> (Type -> PriorSubsts m [e]) -> Type -> [e] -> PriorSubsts m [e] funApSubOp :: (Monad m1, Monad m2) => (r -> a2 -> r) -> (Type -> m1 (m2 a2)) -> (Type -> m1 (m2 a2)) -> (Type -> m1 (m2 a2)) -> Type -> m2 r -> m1 (m2 r) fap :: (Foldable t1, Monad m1, Monad m2, Expression r) => (t2 -> m1 (m2 r)) -> t1 t2 -> m2 r -> m1 (m2 r) mapAndFoldM :: Monad m => (t1 -> t2 -> t1) -> t1 -> (t3 -> m t2) -> [t3] -> m t1 retGen :: (Search m, Expression e) => Common -> Int -> (Type -> Type -> [e] -> [e]) -> (Type -> PriorSubsts m [e]) -> (Type -> PriorSubsts m [e]) -> (Type -> PriorSubsts m [e]) -> Type -> Prim -> PriorSubsts m [e] retGen' :: forall (n :: Type -> Type) e i t b c. (Search n, Expression e, Integral i) => (Type -> t -> PriorSubsts n b) -> Common -> i -> (Type -> Type -> [e] -> t) -> (Type -> PriorSubsts n [e]) -> (Type -> PriorSubsts n [e]) -> (Type -> PriorSubsts n [e]) -> Type -> (Int, Int, c, TyVar, Typed [CoreExpr]) -> PriorSubsts n b retGenOrd :: (Search m, Expression e) => Common -> Int -> (Type -> Type -> [e] -> [e]) -> (Type -> PriorSubsts m [e]) -> (Type -> PriorSubsts m [e]) -> (Type -> PriorSubsts m [e]) -> Type -> Prim -> PriorSubsts m [e] orderedAndUsedArgs :: Type -> Bool usedArg :: TyVar -> Type -> Bool retGenTV1 :: (Search m, Expression e) => Common -> Int -> (Type -> Type -> [e] -> [e]) -> (Type -> PriorSubsts m [e]) -> (Type -> PriorSubsts m [e]) -> (Type -> PriorSubsts m [e]) -> Type -> Prim -> PriorSubsts m [e] retGenTV0 :: forall (n :: Type -> Type) e j i b c. (Search n, Expression e, Integral j, Integral i) => Common -> i -> (Type -> Type -> [e] -> b) -> (Type -> PriorSubsts n [e]) -> (Type -> PriorSubsts n [e]) -> (Type -> PriorSubsts n [e]) -> Type -> (j, j, c, TyVar, Typed [CoreExpr]) -> PriorSubsts n b filtExprs :: Expression e => Bool -> Type -> Type -> [e] -> [e] filterExprs :: Expression e => Type -> Type -> [e] -> [e] getArgExprs :: CoreExpr -> [CoreExpr] gae :: CoreExpr -> [CoreExpr] -> [CoreExpr] constEq :: Type -> [CoreExpr] -> Bool ceq :: CoreExpr -> Type -> [CoreExpr] -> Bool recHead :: Type -> CoreExpr -> Bool retSameVal :: Type -> [CoreExpr] -> Bool rsv :: Type -> [CoreExpr] -> Bool rsv' :: CoreExpr -> Type -> [CoreExpr] -> Bool returnsAtoA :: Type -> Bool returnsId :: Type -> CoreExpr -> Bool isId :: CoreExpr -> Bool isId' :: Int8 -> CoreExpr -> Bool isId'' :: Int8 -> Int8 -> CoreExpr -> Bool retVal :: Type -> CoreExpr -> CoreExpr rv :: Type -> Int8 -> CoreExpr -> CoreExpr mapsub :: Int8 -> CoreExpr -> CoreExpr isConstrExpr :: CoreExpr -> Bool isClosed :: CoreExpr -> Bool isClosed' :: Int8 -> CoreExpr -> Bool includesStrictArg :: [CoreExpr] -> Bool anyRec :: Type -> [CoreExpr] -> Bool recursive :: Type -> CoreExpr -> Bool constRec :: Int8 -> CoreExpr -> Bool belowIsUsed :: Int8 -> CoreExpr -> Bool isUsed :: Int8 -> CoreExpr -> Bool mkSubsts :: Search m => Int -> TyVar -> Type -> PriorSubsts m Int mkSubst :: Search m => Int -> TyVar -> Type -> PriorSubsts m Int mkRetty :: Type -> (Type, Type) reorganizer_ :: ([Type] -> a) -> [Type] -> a hit :: Type -> [Type] -> Bool combs :: (Eq t, Num t) => t -> [a] -> [[a]] tails :: [a] -> [[a]] dynamic :: ExpQ -> ExpQ -> ExpQ module MagicHaskeller.ProgGen -- | The vanilla program generator corresponding to Version 0.7.* newtype ProgGen -- | internal data representation PG :: MemoDeb (ClassLib CoreExpr) CoreExpr -> ProgGen mkCL :: Common -> [Typed [CoreExpr]] -> ClassLib CoreExpr newtype ClassLib e CL :: MemoDeb (ClassLib e) e -> ClassLib e mguPrograms :: Search m => Generator m CoreExpr instance MagicHaskeller.ProgramGenerator.WithCommon MagicHaskeller.ProgGen.ProgGen instance MagicHaskeller.ProgramGenerator.ProgramGenerator MagicHaskeller.ProgGen.ProgGen instance MagicHaskeller.ProgramGenerator.ProgramGeneratorIO MagicHaskeller.ProgGen.ProgGen module MagicHaskeller.ProgGenSF type ProgGenSF = PGSF CoreExpr -- | Program generator with synergetic filtration. This program generator -- employs filtration by random testing, and rarely generate semantically -- equivalent expressions more than once, while different expressions -- will eventually appear (for most of the types, represented with -- Prelude types, whose arguments are instance of Arbitrary and which -- return instance of Ord). The idea is to apply random numbers to the -- generated expressions, compute the quotient set of the resulting -- values at each depth of the search tree, and adopt the complete system -- of representatives for the depth and push the remaining expressions to -- one step deeper in the search tree. (Thus, adoption of expressions -- that may be equivalent to another already-generated-expression will be -- postponed until their "uniqueness" is proved.) As a result, (unlike -- ProgGen,) expressions with size N may not appear at depth N but -- some deeper place. -- -- ProgGenSF is more efficient along with a middle-sized primitive -- set (like reallyall found in LibTH.hs), but is slower than -- ProgGen for a small-sized one. -- -- Also note that ProgGenSF depends on hard use of unsafe* stuff, -- so if there is a bug, it may segfault.... data PGSF e PGSF :: MemoDeb e -> TypeTrie -> ExpTrie e -> PGSF e freezePS :: Type -> PriorSubsts Recomp Type -> Matrix (Type, Subst, TyVar) funApSub_ :: (Search m, Monoid a) => (Type -> PriorSubsts m ()) -> (Type -> PriorSubsts m a) -> (Type -> PriorSubsts m a) -> Type -> PriorSubsts m a funApSub_spec :: forall (m :: Type -> Type) a. (Search m, Monoid a) => (Type -> PriorSubsts m ()) -> (Type -> PriorSubsts m a) -> Type -> PriorSubsts m a lookupNormalized :: (Functor m, MonadPlus m) => (Type -> m (e, Subst, TyVar)) -> [Type] -> Type -> PriorSubsts m e tokoro10fst :: (Eq k, Ord k) => [(k, s, i)] -> [(k, s, i)] mkTrieOptSFIO :: Expression e => Common -> [Typed [CoreExpr]] -> [[Typed [CoreExpr]]] -> [[Typed [CoreExpr]]] -> IO (PGSF e) instance GHC.Base.Semigroup MagicHaskeller.ProgGenSF.BitSet instance GHC.Base.Monoid MagicHaskeller.ProgGenSF.BitSet instance MagicHaskeller.Expression.Expression e => MagicHaskeller.ProgramGenerator.ProgramGenerator (MagicHaskeller.ProgGenSF.PGSF e) instance MagicHaskeller.Expression.Expression e => MagicHaskeller.ProgramGenerator.WithCommon (MagicHaskeller.ProgGenSF.PGSF e) module MagicHaskeller.ProgGenSFIORef type ProgGenSFIORef = PGSFIOR CoreExpr -- | Program generator with synergetic filtration. This program generator -- employs filtration by random testing, and rarely generate semantically -- equivalent expressions more than once, while different expressions -- will eventually appear (for most of the types, represented with -- Prelude types, whose arguments are instance of Arbitrary and which -- return instance of Ord). The idea is to apply random numbers to the -- generated expressions, compute the quotient set of the resulting -- values at each depth of the search tree, and adopt the complete system -- of representatives for the depth and push the remaining expressions to -- one step deeper in the search tree. (Thus, adoption of expressions -- that may be equivalent to another already-generated-expression will be -- postponed until their "uniqueness" is proved.) As a result, (unlike -- ProgGen,) expressions with size N may not appear at depth N but -- some deeper place. -- -- ProgGenSF is more efficient along with a middle-sized primitive -- set (like reallyall found in LibTH.hs), but is slower than -- ProgGen for a small-sized one. -- -- Also note that ProgGenSF depends on hard use of unsafe* stuff, -- so if there is a bug, it may segfault.... data PGSFIOR e instance MagicHaskeller.ProgramGenerator.ProgramGeneratorIO (MagicHaskeller.ProgGenSFIORef.PGSFIOR MagicHaskeller.CoreLang.CoreExpr) instance MagicHaskeller.Expression.Expression e => MagicHaskeller.ProgramGenerator.WithCommon (MagicHaskeller.ProgGenSFIORef.PGSFIOR e) module MagicHaskeller -- | ProgramGenerator is a generalization of the old Memo type. class WithCommon a => ProgramGenerator a -- | The vanilla program generator corresponding to Version 0.7.* data ProgGen type ProgGenSF = PGSF CoreExpr type ProgGenSFIORef = PGSFIOR CoreExpr -- | p is used to convert your primitive component set into the -- internal form. p :: ExpQ -> ExpQ -- | setPrimitives creates a ProgGen from the given set -- of primitives using the current set of options, and sets it as the -- current program generator. It used to be equivalent to setPG . -- mkPG which overwrites the options with the default, but it is not -- now. setPrimitives :: [Primitive] -> [Primitive] -> IO () mkPG :: ProgramGenerator pg => [Primitive] -> pg -- | mkPGSF and mkMemoSF are provided mainly for backward -- compatibility. These functions are defined only for the -- ProgramGenerators whose names end with SF (i.e., -- generators with synergetic filtration). For such generators, they are -- defined as: -- --
--   mkPGSF   gen nrnds optups tups = mkPGOpt (options{primopt = Just optups, contain = True,  stdgen = gen, nrands = nrnds}) tups
--   mkMemoSF gen nrnds optups tups = mkPGOpt (options{primopt = Just optups, contain = False, stdgen = gen, nrands = nrnds}) tups
--   
mkPGSF :: ProgramGenerator pg => StdGen -> [Int] -> [Primitive] -> [Primitive] -> [Primitive] -> pg setPG :: ProgGen -> IO () mkMemo :: ProgramGenerator pg => [Primitive] -> pg -- | mkPGSF and mkMemoSF are provided mainly for backward -- compatibility. These functions are defined only for the -- ProgramGenerators whose names end with SF (i.e., -- generators with synergetic filtration). For such generators, they are -- defined as: -- --
--   mkPGSF   gen nrnds optups tups = mkPGOpt (options{primopt = Just optups, contain = True,  stdgen = gen, nrands = nrnds}) tups
--   mkMemoSF gen nrnds optups tups = mkPGOpt (options{primopt = Just optups, contain = False, stdgen = gen, nrands = nrnds}) tups
--   
mkMemoSF :: ProgramGenerator pg => StdGen -> [Int] -> [Primitive] -> [Primitive] -> [Primitive] -> pg mkPG075 :: ProgramGenerator pg => [Primitive] -> [Primitive] -> pg mkMemo075 :: ProgramGenerator pg => [Primitive] -> [Primitive] -> pg mkPGOpt :: ProgramGenerator pg => Options -> [Primitive] -> [Primitive] -> pg -- | mkPG is defined as: -- --
--   mkPG prims = mkPGSF (mkStdGen 123456) (repeat 5) prims prims
--   
mkPGX :: ProgramGenerator pg => [Primitive] -> [[Primitive]] -> pg mkPGXOpt :: ProgramGenerator pg => Options -> [Primitive] -> [(Primitive, Primitive)] -> [[Primitive]] -> [[(Primitive, Primitive)]] -> pg mkPGXOpts :: (Common -> [Typed [CoreExpr]] -> [[Typed [CoreExpr]]] -> [[Typed [CoreExpr]]] -> a) -> Options -> [Primitive] -> [(Primitive, Primitive)] -> [[Primitive]] -> [[(Primitive, Primitive)]] -> a mkPGXOptsExt :: (TyConLib -> [[(String, Dynamic)]]) -> (TyConLib -> [[(String, Dynamic)]]) -> (TyConLib -> [[(String, Dynamic)]]) -> (Common -> [Typed [CoreExpr]] -> [[Typed [CoreExpr]]] -> [[Typed [CoreExpr]]] -> a) -> Options -> [Primitive] -> [(Primitive, Primitive)] -> [[Primitive]] -> [[(Primitive, Primitive)]] -> a updatePGXOpts :: (Common -> [Typed [CoreExpr]] -> [[Typed [CoreExpr]]] -> [[Typed [CoreExpr]]] -> a) -> Maybe [[Primitive]] -> [Dynamic] -> [(Dynamic, Dynamic)] -> [[Dynamic]] -> [[(Dynamic, Dynamic)]] -> Common -> a updatePGXOptsFilt :: Int -> (Common -> [Typed [CoreExpr]] -> [[Typed [CoreExpr]]] -> [[Typed [CoreExpr]]] -> a) -> Maybe [[Primitive]] -> [Dynamic] -> [(Dynamic, Dynamic)] -> [[Dynamic]] -> [[(Dynamic, Dynamic)]] -> Common -> a -- | options for limiting the hypothesis space. type Options = Opt [[Primitive]] -- | options that limit the hypothesis space. data Opt a Opt :: Maybe a -> Int -> (Type -> Int -> Bool) -> MemoCond -> (VarLib -> CoreExpr -> Dynamic) -> Maybe Int -> Bool -> Bool -> Bool -> Bool -> Int -> Bool -> Bool -> StdGen -> [Int] -> (Int -> Int) -> Opt a -- | Use 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. [primopt] :: Opt a -> Maybe a -- | memoization 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. [memodepth] :: Opt a -> Int -- | This represents when to memoize. It takes the query type and the query -- depth, and returns True if the corresponding entry should be -- looked up from the lazy memo table. Currently this only works for -- ProgGenSF. [memoCondPure] :: Opt a -> Type -> Int -> Bool -- | This represents which memoization table to be used based on the query -- type and the search depth, when using the everythingIO -- family. [memoCond] :: Opt a -> MemoCond [execute] :: Opt a -> VarLib -> CoreExpr -> Dynamic -- | Just 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. [timeout] :: Opt a -> Maybe Int -- | If this option is True, forkProcess instead of -- 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. [forcibleTimeout] :: Opt a -> Bool -- | If 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 init075 instead of initialize. [guess] :: Opt a -> Bool -- | This 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.) [contain] :: Opt a -> Bool -- | If 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. [constrL] :: Opt a -> Bool -- | 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. [tvndelay] :: Opt a -> Int -- | If 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. [tv1] :: Opt a -> Bool [tv0] :: Opt a -> Bool -- | The random seed. [stdgen] :: Opt a -> StdGen -- | number of random samples at each depth, for each type, for the filter -- applied during synthesis (used by ProgGenSF, &c.). [nrands] :: Opt a -> [Int] -- | number of random samples at each depth, for each type, for the filter -- applied after synthesis (used by filterThenF, &c.). [fcnrand] :: Opt a -> Int -> Int -- | default options -- --
--   options = Opt{ primopt = Nothing
--                , memodepth = 10
--                , memoCondPure = \ _type depth -> 0<depth
--                , 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
--   
options :: Opt a data MemoType -- | Recompute instead of memoizing. Recompute :: MemoType -- | Use the memoization table based on lazy evaluation, like in older -- versions. Ram :: MemoType -- | Use the directory specified by FilePath as the persistent -- memoization table. Disk :: FilePath -> MemoType dynamic :: ExpQ -> ExpQ -> ExpQ mkPGIO :: ProgramGeneratorIO pg => [Primitive] -> [Primitive] -> IO pg mkPGXOptIO :: ProgramGeneratorIO pg => Options -> [Primitive] -> [(Primitive, Primitive)] -> [[Primitive]] -> [[(Primitive, Primitive)]] -> IO pg -- | load loads a component library file. load :: FilePath -> ExpQ -- | f is supposed to be used by load, but not hidden. f :: String -> ExpQ -- | Currently the default depth is 10. You may want to lower the value if -- your computer often swaps, or increase it if you have a lot of memory. setDepth :: Int -> IO () -- | setTimeout sets the timeout in 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 setTimeout 20000 -- is the default!) setTimeout :: Int -> IO () -- | unsetTimeout disables timeout. This is the safe choice. unsetTimeout :: IO () -- | define eases use of this library by automating some function -- definitions. For example, -- --
--   $( define ''ProgGen "Foo" (p [| (1 :: Int, (+) :: Int -> Int -> Int) |]) )
--   
-- -- is equivalent to -- --
--   memoFoo :: ProgGen
--   memoFoo = mkPG (p [| (1 :: Int, (+) :: Int -> Int -> Int) |])
--   everyFoo :: Everything
--   everyFoo = everything memoFoo
--   filterFoo :: Filter
--   filterFoo pred = filterThen pred everyFoo
--   
-- -- If you do not think this function reduces the number of your -- keystrokes a lot, you can do without it. define :: Name -> String -> ExpQ -> Q [Dec] type Everything = forall a. Typeable a => Every a type Filter = forall a. Typeable a => (a -> Bool) -> IO (Every a) type Every a = [[(Exp, a)]] type EveryIO a = Int -> IO [(Exp, a)] -- | findOne pred finds an expression e that -- satisfies pred e == True, and returns it in Exp. findOne :: Typeable a => Bool -> (a -> Bool) -> Exp -- | printOne prints the expression found first. printOne :: Typeable a => Bool -> (a -> Bool) -> IO Exp -- | printAll prints all the expressions satisfying the given -- predicate. printAll :: Typeable a => Bool -> (a -> Bool) -> IO () printAllF :: (Typeable a, Filtrable a) => Bool -> (a -> Bool) -> IO () -- | io2pred converts a specification given as a set of I/O pairs -- to the predicate form which other functions accept. io2pred :: Eq b => [(a, b)] -> (a -> b) -> Bool -- | filterFirst is like printAll, but by itself it does not -- print anything. Instead, it creates a stream of expressions -- represented in tuples of Exp and the expressions themselves. filterFirst :: Typeable a => Bool -> (a -> Bool) -> IO (Every a) filterFirstF :: (Typeable a, Filtrable a) => Bool -> (a -> Bool) -> IO (Every a) -- | filterThen may be used to further filter the results. filterThen :: Typeable a => (a -> Bool) -> Every a -> IO (Every a) filterThenF :: (Typeable a, Filtrable a) => (a -> Bool) -> Every a -> IO [[(Exp, a)]] fp :: Typeable a => Maybe Int -> (a -> Bool) -> [(Exp, a)] -> [(Exp, a)] -- | getEverything uses the 'global' values set with set* -- functions. getEverythingF is its filtered version getEverything :: Typeable a => Bool -> IO (Every a) -- | everything generates all the expressions that fit the inferred -- type, and their representations in the Exp form. It returns a -- stream of lists, which is equivalent to Spivey's Matrix data -- type, i.e., that contains expressions consisted of n primitive -- components at the n-th element (n = 1,2,...). everythingF is -- its filtered version everything :: (ProgramGenerator pg, Typeable a) => pg -> Bool -> Every a everythingM :: (ProgramGenerator pg, Typeable a, Monad m, Functor m) => pg -> Bool -> Int -> m [(Exp, a)] everythingIO :: (ProgramGeneratorIO pg, Typeable a) => pg -> EveryIO a -- | Those functions are like everything, but take Type as an -- argument, which may be polymorphic. For example, printQ -- ([t| forall a. a->a->a |] >>= return . unifyable -- True 10 memo) will print all the expressions using memo -- whose types unify with forall a. a->a->a. (At first I -- (Susumu) could not find usefulness in finding unifyable expressions, -- but seemingly Hoogle does something alike, and these functions might -- enhance it.) unifyable :: ProgramGenerator pg => pg -> Type -> [[Exp]] -- | Those functions are like everything, but take Type as an -- argument, which may be polymorphic. For example, printQ -- ([t| forall a. a->a->a |] >>= return . unifyable -- True 10 memo) will print all the expressions using memo -- whose types unify with forall a. a->a->a. (At first I -- (Susumu) could not find usefulness in finding unifyable expressions, -- but seemingly Hoogle does something alike, and these functions might -- enhance it.) matching :: ProgramGenerator pg => pg -> Type -> [[Exp]] getEverythingF :: Typeable a => Bool -> IO (Every a) -- | everything generates all the expressions that fit the inferred -- type, and their representations in the Exp form. It returns a -- stream of lists, which is equivalent to Spivey's Matrix data -- type, i.e., that contains expressions consisted of n primitive -- components at the n-th element (n = 1,2,...). everythingF is -- its filtered version everythingF :: (ProgramGenerator pg, Typeable a) => pg -> Bool -> Every a -- | Those functions are like everything, but take Type as an -- argument, which may be polymorphic. For example, printQ -- ([t| forall a. a->a->a |] >>= return . unifyable -- True 10 memo) will print all the expressions using memo -- whose types unify with forall a. a->a->a. (At first I -- (Susumu) could not find usefulness in finding unifyable expressions, -- but seemingly Hoogle does something alike, and these functions might -- enhance it.) unifyableF :: ProgramGenerator pg => pg -> Type -> [[Exp]] -- | Those functions are like everything, but take Type as an -- argument, which may be polymorphic. For example, printQ -- ([t| forall a. a->a->a |] >>= return . unifyable -- True 10 memo) will print all the expressions using memo -- whose types unify with forall a. a->a->a. (At first I -- (Susumu) could not find usefulness in finding unifyable expressions, -- but seemingly Hoogle does something alike, and these functions might -- enhance it.) matchingF :: ProgramGenerator pg => pg -> Type -> [[Exp]] everyACE :: (ProgramGenerator pg, Typeable a) => pg -> Bool -> [[(CoreExpr, a)]] everyF :: (Typeable a, Filtrable a) => Opt b -> [[(e, a)]] -> [[(e, a)]] stripEvery :: Every a -> a -- | pprs pretty prints the results to the console, using -- pprintUC pprs :: Every a -> IO () -- | pprsIO is the EveryIO version of pprs pprsIO :: EveryIO a -> IO () -- | pprsIOn depth eio is the counterpart of pprs (take depth -- eio), while pprsIO eio is the counterpart of pprs -- eio. Example: pprsIOn 5 (everythingIO (mlist::ProgGen) :: -- EveryIO ([Char]->[Char])) pprsIOn :: Int -> EveryIO a -> IO () lengths :: Every a -> IO () lengthsIO :: EveryIO a -> IO () lengthsIOn :: Int -> EveryIO a -> IO () lengthsIOnLn :: Int -> EveryIO a -> IO () printQ :: (Ppr a, Data a) => Q a -> IO () type Primitive = (HValue, Exp, Type) newtype HValue HV :: (forall a. a) -> HValue -- | The function unsafeCoerce# allows you to side-step the -- typechecker entirely. That is, it allows you to coerce any type into -- any other type. If you use this function, you had better get it right, -- otherwise segmentation faults await. It is generally used when you -- want to write a program that you know is well-typed, but where -- Haskell's type system is not expressive enough to prove that it is -- well typed. -- -- The following uses of unsafeCoerce# are supposed to work -- (i.e. not lead to spurious compile-time or run-time crashes): -- -- -- -- Other uses of unsafeCoerce# are undefined. In particular, you -- should not use unsafeCoerce# to cast a T to an algebraic data -- type D, unless T is also an algebraic data type. For example, do not -- cast Int->Int to Bool, even if you later cast -- that Bool back to Int->Int before applying it. -- The reasons have to do with GHC's internal representation details (for -- the cognoscenti, data values can be entered but function closures -- cannot). If you want a safe type to cast things to, use Any, -- which is not an algebraic data type. -- -- Warning: this can fail with an unchecked exception. unsafeCoerce# :: forall (k0 :: RuntimeRep) (k1 :: RuntimeRep) (a :: TYPE k0) (b :: TYPE k1). a -> b exprToTHExp :: VarLib -> CoreExpr -> Exp trToTHType :: TypeRep -> Type -- | printAll prints all the expressions satisfying the given -- predicate. printAny :: Typeable a => Bool -> (a -> Bool) -> IO () p1 :: Exp -> ExpQ class Filtrable a zipAppend :: [[a]] -> [[a]] -> [[a]] mapIO :: (a -> IO b) -> [a] -> IO [b] fpIO :: Typeable a => Maybe Int -> (a -> Bool) -> [((Exp, a), (Exp, a))] -> IO [(Exp, a)] fIO :: Typeable a => Maybe Int -> (a -> Bool) -> ((Exp, a), (Exp, a)) -> Int -> IO (Maybe (Exp, a)) fpartial :: Typeable a => Maybe Int -> (a -> Bool) -> [((Exp, a), (Exp, a))] -> [(Exp, a)] fpartialIO :: Typeable a => Maybe Int -> (a -> Bool) -> [((e, a), (e, a))] -> IO [(e, a)] ftotalIO :: Typeable a => Maybe Int -> (a -> Bool) -> [(e, a)] -> IO [(e, a)] etup :: (ProgramGenerator pg, Typeable a) => a -> pg -> Bool -> [[((Exp, a), (Exp, a))]] mkCurriedDecls :: String -> ExpQ -> ExpQ -> DecsQ unJust :: Maybe a -> a tup :: [Exp] -> Exp module MagicHaskeller.LibTH newtype Ordered a Ord :: (a -> a -> Ordering) -> Ordered a [by1_compare] :: Ordered a -> a -> a -> Ordering newtype Equivalence a Eq :: (a -> a -> Bool) -> Equivalence a [--#==] :: Equivalence a -> a -> a -> Bool newtype Partial a Part :: a -> Partial a [undef] :: Partial a -> a succOnlyForNumbers :: Bool last' :: a -> [a] -> a tail :: [a] -> [a] gcd :: Integral t => t -> t -> t enumFromThenTo :: (Enum b, Enum a1, Enum a2, Enum a3) => a3 -> a2 -> a1 -> [b] initialize :: IO () init075 :: IO () inittv1 :: IO () tuple :: [Primitive] tuple' :: [Primitive] mall :: ProgramGenerator pg => pg mlist :: ProgramGenerator pg => pg mlist' :: ProgramGenerator pg => pg mnat :: ProgramGenerator pg => pg mnatural :: ProgramGenerator pg => pg mlistnat :: ProgramGenerator pg => pg mlistnatural :: ProgramGenerator pg => pg mnat_nc :: ProgramGenerator pg => pg hd :: [a] -> Maybe a mb :: [Primitive] mb' :: [Primitive] nat :: [Primitive] natural :: [Primitive] nat' :: [Primitive] nat'woPred :: [Primitive] natural' :: [Primitive] plusInt :: [Primitive] plusInteger :: [Primitive] nat_para :: Integral i => i -> a -> (i -> a -> a) -> a nat_cata :: Integral i => i -> a -> (a -> a) -> a list'' :: [Primitive] list' :: [Primitive] list :: [Primitive] list_para :: [b] -> a -> (b -> [b] -> a -> a) -> a bool :: [Primitive] iF :: Bool -> a -> a -> a -- | postprocess replaces uncommon functions like catamorphisms with -- well-known functions. postprocess :: Exp -> Exp byMap :: IntMap (Exp -> Exp -> Exp) byEqs :: [(Int, Exp -> Exp -> Exp)] byOrds :: [(Int, Exp -> Exp -> Exp)] skip :: String -> String -> Exp -> Exp -> Exp skipEq :: String -> Exp -> Exp -> Exp skipOrd :: String -> Exp -> Exp -> Exp appearsIn :: Data a => [Char] -> a -> Bool ppLambda :: [Pat] -> Exp -> Exp ppv :: Exp -> Exp ppopn :: Name -> Name ppdrop :: Integer -> Exp -> Exp constE :: Exp flipE :: Exp plusE :: Exp dropE :: Exp reverseE :: Exp lengthE :: Exp sumE :: Exp productE :: Exp procSucc :: Integer -> Exp -> Exp postprocessQ :: Exp -> ExpQ exploit :: (Typeable a, Filtrable a) => Bool -> (a -> Bool) -> IO () boolean :: [Primitive] undefs :: [((HValue, Exp, Type), (HValue, Exp, Type))] by1_head :: Partial a -> [a] -> a (--#!!) :: Partial a -> [a] -> Int -> a prelPartial :: [(HValue, Exp, Type)] eq :: Eq a => Equivalence a by1_eqMaybe :: Equivalence a -> Equivalence (Maybe a) eqMaybeBy :: (t1 -> t2 -> Bool) -> Maybe t1 -> Maybe t2 -> Bool by1_eqList :: Equivalence a -> Equivalence [a] eqListBy :: (t1 -> t2 -> Bool) -> [t1] -> [t2] -> Bool by2_eqEither :: Equivalence a -> Equivalence b -> Equivalence (Either a b) eqEitherBy :: (t1 -> t2 -> Bool) -> (t3 -> t4 -> Bool) -> Either t1 t3 -> Either t2 t4 -> Bool by2_eqPair :: Equivalence a -> Equivalence b -> Equivalence (a, b) eqPairBy :: (t1 -> t2 -> Bool) -> (t3 -> t4 -> Bool) -> (t1, t3) -> (t2, t4) -> Bool eqs :: [(HValue, Exp, Type)] prelEqRelated :: [[(HValue, Exp, Type)]] dataListEqRelated :: [[(HValue, Exp, Type)]] (--#/=) :: Equivalence a -> a -> a -> Bool by1_elem :: Equivalence a -> a -> [a] -> Bool by1_group :: Equivalence a -> [a] -> [[a]] by1_nub :: Equivalence a -> [a] -> [a] by1_isPrefixOf :: Equivalence a -> [a] -> [a] -> Bool by1_isSuffixOf :: Equivalence a -> [a] -> [a] -> Bool by1_isInfixOf :: Equivalence a -> [a] -> [a] -> Bool by1_stripPrefix :: Equivalence a -> [a] -> [a] -> Maybe [a] by1_lookup :: Equivalence a -> a -> (->) [(a, b)] (Maybe b) cmp :: Ord a => Ordered a by1_cmpMaybe :: Ordered a -> Ordered (Maybe a) compareMaybeBy :: (t1 -> t2 -> Ordering) -> Maybe t1 -> Maybe t2 -> Ordering by1_cmpList :: Ordered a -> Ordered [a] compareListBy :: (t1 -> t2 -> Ordering) -> [t1] -> [t2] -> Ordering by2_cmpEither :: Ordered a -> Ordered b -> Ordered (Either a b) compareEitherBy :: (t1 -> t2 -> Ordering) -> (t3 -> t4 -> Ordering) -> Either t1 t3 -> Either t2 t4 -> Ordering by2_cmpPair :: Ordered a -> Ordered b -> Ordered (a, b) comparePairBy :: (t1 -> t2 -> Ordering) -> (t3 -> t4 -> Ordering) -> (t1, t3) -> (t2, t4) -> Ordering ords :: [(HValue, Exp, Type)] prelOrdRelated :: [[(HValue, Exp, Type)]] dataListOrdRelated :: [[(HValue, Exp, Type)]] (--#<=) :: Ordered a -> a -> a -> Bool (--#<) :: Ordered a -> a -> a -> Bool by1_max :: Ordered p -> p -> p -> p by1_min :: Ordered p -> p -> p -> p by1_sort :: Ordered a -> [a] -> [a] intinst :: [Primitive] intinst1 :: [(HValue, Exp, Type)] intpartials :: [(HValue, Exp, Type)] intinst2 :: [(HValue, Exp, Type)] list1 :: [Primitive] list1' :: [Primitive] list2 :: [Primitive] list3 :: [Primitive] list3' :: [Primitive] nats :: [Primitive] reallyall :: ProgramGenerator pg => pg nrnds :: Num a => [a] generator :: StdGen mix :: ProgramGenerator pg => pg soso :: [Primitive] rich :: [Primitive] poormix :: ProgramGenerator pg => pg ra :: ProgramGenerator pg => pg rich' :: [Primitive] mx :: ProgramGenerator pg => pg debug :: [Primitive] -- | Library used by the program server backend pgfull :: ProgGenSF pgfulls :: [ProgGenSF] mkPgFull :: IO ProgGenSF mkPgTotal :: IO ProgGenSF mkDebugPg :: IO ProgGenSF deb :: [[(HValue, Exp, Type)]] pgfullIO :: IO ProgGenSFIORef full :: [[(HValue, Exp, Type)]] clspartialss :: [(Primitive, Primitive)] tupartialss :: [[(Primitive, Primitive)]] tupartialssNormal :: [[(Primitive, Primitive)]] literals :: [[(HValue, Exp, Type)]] fromPrelude :: [[Primitive]] fromDataList :: [[(HValue, Exp, Type)]] fromDataChar :: [[(HValue, Exp, Type)]] fromDataMaybe :: [[(HValue, Exp, Type)]] pgWithDoubleRatio :: ProgGenSF pgWithDoubleRatios :: [ProgGenSF] withDoubleRatio :: [[(HValue, Exp, Type)]] pgWithRatio :: ProgGenSF pgWithRatios :: [ProgGenSF] pgRatio :: ProgGenSF pgRatios :: [ProgGenSF] withRatio :: [[(HValue, Exp, Type)]] ratioCls :: [(HValue, Exp, Type)] fromPrelRatio :: [[(HValue, Exp, Type)]] fromDataRatio :: [[(HValue, Exp, Type)]] pgWithDouble :: ProgGenSF pgWithDoubles :: [ProgGenSF] mkPgWithDouble :: IO ProgGenSF withDouble :: [[(HValue, Exp, Type)]] doubleCls :: [(HValue, Exp, Type)] fromPrelDouble :: [[(HValue, Exp, Type)]] module MagicHaskeller.Individual availableNames :: [String] prioritizedNamesToPg :: Maybe Int -> [(Int, String)] -> IO ProgGenSF module MagicHaskeller.LibExcel succOnlyForNumbers :: Bool last' :: a -> [a] -> a -- | ppExcel replaces uncommon functions like catamorphisms with -- well-known functions. ppExcel :: Exp -> Exp ppv :: Exp -> Exp ppopn :: Name -> Name ppdrop :: Integer -> Exp -> Exp constE :: Exp flipE :: Exp plusE :: Exp dropE :: Exp reverseE :: Exp lengthE :: Exp sumE :: Exp productE :: Exp leftE :: Exp rightE :: Exp lenE :: Exp absE :: Exp mkIF :: Exp -> Exp -> Exp -> Exp mkUncurried :: String -> [Exp] -> Exp mkSUBST4 :: [Exp] -> Exp mkVarOp :: Exp -> String -> Exp -> Exp char7 :: Exp lit0 :: Exp lit1 :: Exp procSucc :: Integer -> Exp -> Exp nrnds :: Num a => [a] mkPgExcel :: IO ProgGenSF mkPgExcels :: Int -> IO ProgGenSF (<>) :: Eq a => a -> a -> Bool excel :: [[(HValue, Exp, Type)]] totalGCD :: Integral t => t -> t -> t curry2 :: ((a, b) -> c) -> a -> b -> c curry3 :: ((a, b, c) -> d) -> a -> b -> c -> d curry4 :: ((a, b, c, d) -> e) -> a -> b -> c -> d -> e curry5 :: ((a, b, c, d, e) -> f) -> a -> b -> c -> d -> e -> f curry6 :: ((a, b, c, d, e, f) -> g) -> a -> b -> c -> d -> e -> f -> g iF :: (Bool, a, a) -> a upper :: [Char] -> [Char] lower :: [Char] -> [Char] proper :: [Char] -> [Char] right :: ([b], Int) -> [b] left :: ([b], Int) -> [b] left1 :: [a] -> [a] right1 :: [b] -> [b] dropLeft :: [Char] -> Int -> [Char] mid :: ([a], Int, Int) -> [a] len :: Num a => String -> a concatenate :: ([a], [a]) -> [a] concatenatE :: ([a], [a], [a]) -> [a] concatenaTE :: ([a], [a], [a], [a]) -> [a] concatenATE :: ([a], [a], [a], [a], [a]) -> [a] concateNATE :: ([a], [a], [a], [a], [a], [a]) -> [a] cEILING :: (Double, Double) -> Double fLOOR :: (Double, Double) -> Double mround :: (Double, Double) -> Double fLOOR0 :: RealFrac p => p -> p -> p rOUND :: (Double, Int) -> Double roundup :: (Double, Int) -> Double rounddown :: (Double, Int) -> Double trim :: String -> String fIND :: Num b => (String, String, Int) -> Maybe b ifERROR :: (Maybe a, a) -> a aND :: (Bool, Bool) -> Bool oR :: (Bool, Bool) -> Bool sign :: Num a => a -> a power :: RealFloat a => (a, a) -> Maybe a sQRT :: (Ord a, Floating a) => a -> Maybe a lOG :: (Ord a, Floating a) => (a, a) -> Maybe a ln :: (Ord a, Floating a) => a -> Maybe a pI :: Floating a => () -> a aTAN2 :: RealFloat a => (a, a) -> a fact :: (Ord a, Num a, Enum a) => a -> Maybe a combin :: Integral a => (a, a) -> Maybe a mOD :: (Int, Int) -> Maybe Int degrees :: Double -> Double radians :: Double -> Double gCD :: (Integral t, RealFrac a1, RealFrac a2) => (a1, a2) -> t findIx :: Num a => [Char] -> [Char] -> Int -> a finD :: Num b => (String, String) -> b char :: Int -> [Char] sUBsTITUTE :: (String, String, String) -> String sUBSTITUTE :: (String, String, String, Int) -> String sUB :: (Ord a, Num a) => [Char] -> [Char] -> [Char] -> a -> [Char] sUBST4 :: String -> String -> String -> Int -> String countStr :: Num a => String -> String -> a gCD'2 :: Double -> Double -> Int mOD'2 :: Int -> Int -> Maybe Int combin'2 :: Int -> Int -> Maybe Int aTAN2'2 :: Double -> Double -> Double lOG'2 :: Double -> Double -> Maybe Double power'2 :: Double -> Double -> Maybe Double oR'2 :: Bool -> Bool -> Bool aND'2 :: Bool -> Bool -> Bool ifERROR'2 :: Maybe c -> c -> c rounddown'2 :: Double -> Int -> Double roundup'2 :: Double -> Int -> Double rOUND'2 :: Double -> Int -> Double mround'2 :: Double -> Double -> Double cEILING'2 :: Double -> Double -> Double concatenate'2 :: [a] -> [a] -> [a] right'2 :: [b] -> Int -> [b] left'2 :: [b] -> Int -> [b] concatenatE'3 :: [a] -> [a] -> [a] -> [a] sUBsTITUTE'3 :: String -> String -> String -> String fIND'3 :: String -> String -> Int -> Maybe Int mid'3 :: [a] -> Int -> Int -> [a] iF'3 :: Bool -> d -> d -> d concatenaTE'4 :: [a] -> [a] -> [a] -> [a] -> [a] concatenATE'5 :: [a] -> [a] -> [a] -> [a] -> [a] -> [a] concateNATE'6 :: [a] -> [a] -> [a] -> [a] -> [a] -> [a] -> [a] module MagicHaskeller.Minimal e :: Typeable a => (Exp -> Exp) -> a -> ProgGenSF -> Bool -> [[Exp]] f1E :: Typeable a => (Exp -> Exp) -> (a -> Bool) -> ProgGenSF -> Bool -> [[Exp]] f1EF :: (Filtrable a, Typeable a) => (Exp -> Exp) -> (a -> Bool) -> ProgGenSF -> Bool -> [[Exp]] f1EIO :: Typeable a => (Exp -> Exp) -> (a -> Bool) -> ProgGenSF -> Bool -> IO [[Exp]] f1EFIO :: (Filtrable a, Typeable a) => (Exp -> Exp) -> (a -> Bool) -> ProgGenSF -> Bool -> IO [[Exp]] simpleEF :: (Filtrable a, Typeable a) => ProgGenSF -> Bool -> [[(CoreExpr, a)]] type ProgGenSF = PGSF CoreExpr class NearEq a (~=) :: NearEq a => a -> a -> Bool infix 4 ~= -- | postprocess replaces uncommon functions like catamorphisms with -- well-known functions. postprocess :: Exp -> Exp -- | ppExcel replaces uncommon functions like catamorphisms with -- well-known functions. ppExcel :: Exp -> Exp module MagicHaskeller.Analytical -- | 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
--   
get1 :: SplicedPrims -> SplicedPrims -> Exp -- | getMany does what you expect from its name. getMany :: SplicedPrims -> SplicedPrims -> [[Exp]] getManyM :: Search m => SplicedPrims -> SplicedPrims -> m 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. getManyTyped :: SplicedPrims -> SplicedPrims -> [[Exp]] noBK :: SplicedPrims -- | Also, $(c [d| ... |]) :: SplicedPrims c is a helper -- function for extracting some info from the quoted declarations. c :: Q [Dec] -> ExpQ type SplicedPrims = ([Dec], [Primitive]) -- | 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
--   
getOne :: [Dec] -> [Dec] -> Exp synth :: [Dec] -> [Dec] -> [[Exp]] synthM :: Search m => [Dec] -> [Dec] -> m 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. synthTyped :: [Dec] -> [Dec] -> [[Exp]] module MagicHaskeller.RunAnalytical -- | Example of quickStart -- --
--   >>> quickStart [d| f [] = 0; f [a] = 1 |] noBKQ (\f -> f "12345" == 5)
--   > \a -> let fa (b@([])) = 0
--   >           fa (b@(c : d)) = succ (fa d)
--   >       in fa a :: forall t2 . [t2] -> Int
--   > ^CInterrupted.
--   
quickStart :: Typeable a => Q [Dec] -> Q [Dec] -> (a -> Bool) -> IO () quickStartF :: (Filtrable a, Typeable a) => Q [Dec] -> Q [Dec] -> (a -> Bool) -> IO () filterGetOne_ :: Typeable a => HscEnv -> Q [Dec] -> (a -> Bool) -> IO () filterGetOne :: Typeable a => HscEnv -> Q [Dec] -> (a -> Bool) -> IO (Every a) filterGetOneBK :: Typeable a => HscEnv -> Q [Dec] -> Q [Dec] -> (a -> Bool) -> IO (Every a) synthFilt :: Typeable a => HscEnv -> Q [Dec] -> Q [Dec] -> (a -> Bool) -> IO (Every a) synthFiltF :: (Filtrable a, Typeable a) => HscEnv -> Q [Dec] -> Q [Dec] -> (a -> Bool) -> IO (Every a) synthAll :: Typeable a => HscEnv -> Q [Dec] -> Q [Dec] -> IO (Every a) noBKQ :: Q [Dec]