MagicHaskeller-0.9.6.7: Automatic inductive functional programmer by systematic search

Safe HaskellNone
LanguageHaskell98

Control.Monad.Search.Combinatorial

Documentation

newtype Matrix a Source #

Constructors

Mx 

Fields

Instances

Monad Matrix Source # 

Methods

(>>=) :: Matrix a -> (a -> Matrix b) -> Matrix b #

(>>) :: Matrix a -> Matrix b -> Matrix b #

return :: a -> Matrix a #

fail :: String -> Matrix a #

Functor Matrix Source # 

Methods

fmap :: (a -> b) -> Matrix a -> Matrix b #

(<$) :: a -> Matrix b -> Matrix a #

Applicative Matrix Source # 

Methods

pure :: a -> Matrix a #

(<*>) :: Matrix (a -> b) -> Matrix a -> Matrix b #

(*>) :: Matrix a -> Matrix b -> Matrix b #

(<*) :: Matrix a -> Matrix b -> Matrix a #

Alternative Matrix Source # 

Methods

empty :: Matrix a #

(<|>) :: Matrix a -> Matrix a -> Matrix a #

some :: Matrix a -> Matrix [a] #

many :: Matrix a -> Matrix [a] #

MonadPlus Matrix Source # 

Methods

mzero :: Matrix a #

mplus :: Matrix a -> Matrix a -> Matrix a #

Search Matrix Source # 

Methods

fromRc :: Recomp a -> Matrix a Source #

toRc :: Matrix a -> Recomp a Source #

fromMx :: Matrix a -> Matrix a Source #

toMx :: Matrix a -> Matrix a Source #

fromDB :: DBound a -> Matrix a Source #

fromDF :: [a] -> Matrix a Source #

toDF :: Matrix a -> [a] Source #

mapDepth :: (Bag a -> Bag b) -> Matrix a -> Matrix b Source #

catBags :: Matrix (Bag a) -> Matrix a Source #

mergesortDepthWithBy :: (k -> k -> k) -> (k -> k -> Ordering) -> Matrix k -> Matrix k Source #

ifDepth :: (Int -> Bool) -> Matrix a -> Matrix a -> Matrix a Source #

Delay Matrix Source # 
SStrategy Matrix Source # 

Methods

sfilter :: Relation r => (k -> k -> r) -> (Int -> Int) -> Matrix ([k], e) -> Matrix ([k], e) Source #

ofilter :: Relation r => (k -> k -> r) -> Matrix (k, e) -> Matrix (k, e) Source #

Memoable Matrix Recomp Source # 
Show a => Show (Matrix a) Source # 

Methods

showsPrec :: Int -> Matrix a -> ShowS #

show :: Matrix a -> String #

showList :: [Matrix a] -> ShowS #

Monoid (Matrix a) Source # 

Methods

mempty :: Matrix a #

mappend :: Matrix a -> Matrix a -> Matrix a #

mconcat :: [Matrix a] -> Matrix a #

(/\) :: Monad m => (a -> m b) -> (t -> m a) -> t -> m b Source #

(\/) :: MonadPlus m => (t -> m a) -> (t -> m a) -> t -> m a Source #

newtype Recomp a Source #

Constructors

Rc 

Fields

Instances

Monad Recomp Source # 

Methods

(>>=) :: Recomp a -> (a -> Recomp b) -> Recomp b #

(>>) :: Recomp a -> Recomp b -> Recomp b #

return :: a -> Recomp a #

fail :: String -> Recomp a #

Functor Recomp Source # 

Methods

fmap :: (a -> b) -> Recomp a -> Recomp b #

(<$) :: a -> Recomp b -> Recomp a #

Applicative Recomp Source # 

Methods

pure :: a -> Recomp a #

(<*>) :: Recomp (a -> b) -> Recomp a -> Recomp b #

(*>) :: Recomp a -> Recomp b -> Recomp b #

(<*) :: Recomp a -> Recomp b -> Recomp a #

Alternative Recomp Source # 

Methods

empty :: Recomp a #

(<|>) :: Recomp a -> Recomp a -> Recomp a #

some :: Recomp a -> Recomp [a] #

many :: Recomp a -> Recomp [a] #

MonadPlus Recomp Source # 

Methods

mzero :: Recomp a #

mplus :: Recomp a -> Recomp a -> Recomp a #

Search Recomp Source # 

Methods

fromRc :: Recomp a -> Recomp a Source #

toRc :: Recomp a -> Recomp a Source #

fromMx :: Matrix a -> Recomp a Source #

toMx :: Recomp a -> Matrix a Source #

fromDB :: DBound a -> Recomp a Source #

fromDF :: [a] -> Recomp a Source #

toDF :: Recomp a -> [a] Source #

mapDepth :: (Bag a -> Bag b) -> Recomp a -> Recomp b Source #

catBags :: Recomp (Bag a) -> Recomp a Source #

mergesortDepthWithBy :: (k -> k -> k) -> (k -> k -> Ordering) -> Recomp k -> Recomp k Source #

ifDepth :: (Int -> Bool) -> Recomp a -> Recomp a -> Recomp a Source #

Delay Recomp Source # 
Memoable Matrix Recomp Source # 
Show (Recomp a) Source # 

Methods

showsPrec :: Int -> Recomp a -> ShowS #

show :: Recomp a -> String #

showList :: [Recomp a] -> ShowS #

Monoid (Recomp a) Source # 

Methods

mempty :: Recomp a #

mappend :: Recomp a -> Recomp a -> Recomp a #

mconcat :: [Recomp a] -> Recomp a #

newtype RecompT m a Source #

Constructors

RcT 

Fields

Instances

(Functor m, Monad m) => Monad (RecompT m) Source # 

Methods

(>>=) :: RecompT m a -> (a -> RecompT m b) -> RecompT m b #

(>>) :: RecompT m a -> RecompT m b -> RecompT m b #

return :: a -> RecompT m a #

fail :: String -> RecompT m a #

Functor f => Functor (RecompT f) Source # 

Methods

fmap :: (a -> b) -> RecompT f a -> RecompT f b #

(<$) :: a -> RecompT f b -> RecompT f a #

(Functor m, Monad m) => Applicative (RecompT m) Source # 

Methods

pure :: a -> RecompT m a #

(<*>) :: RecompT m (a -> b) -> RecompT m a -> RecompT m b #

(*>) :: RecompT m a -> RecompT m b -> RecompT m b #

(<*) :: RecompT m a -> RecompT m b -> RecompT m a #

(Functor m, Monad m) => Alternative (RecompT m) Source # 

Methods

empty :: RecompT m a #

(<|>) :: RecompT m a -> RecompT m a -> RecompT m a #

some :: RecompT m a -> RecompT m [a] #

many :: RecompT m a -> RecompT m [a] #

(Functor m, Monad m) => MonadPlus (RecompT m) Source # 

Methods

mzero :: RecompT m a #

mplus :: RecompT m a -> RecompT m a -> RecompT m a #

(Functor m, Monad m) => Search (RecompT m) Source # 

Methods

fromRc :: Recomp a -> RecompT m a Source #

toRc :: RecompT m a -> Recomp a Source #

fromMx :: Matrix a -> RecompT m a Source #

toMx :: RecompT m a -> Matrix a Source #

fromDB :: DBound a -> RecompT m a Source #

fromDF :: [a] -> RecompT m a Source #

toDF :: RecompT m a -> [a] Source #

mapDepth :: (Bag a -> Bag b) -> RecompT m a -> RecompT m b Source #

catBags :: RecompT m (Bag a) -> RecompT m a Source #

mergesortDepthWithBy :: (k -> k -> k) -> (k -> k -> Ordering) -> RecompT m k -> RecompT m k Source #

ifDepth :: (Int -> Bool) -> RecompT m a -> RecompT m a -> RecompT m a Source #

Monad m => Delay (RecompT m) Source # 

Methods

delay :: RecompT m a -> RecompT m a Source #

ndelay :: Int -> RecompT m a -> RecompT m a Source #

getDepth :: RecompT m Int Source #

(Functor m, Monad m) => Monoid (RecompT m a) Source # 

Methods

mempty :: RecompT m a #

mappend :: RecompT m a -> RecompT m a -> RecompT m a #

mconcat :: [RecompT m a] -> RecompT m a #

class (Delay m, MonadPlus m, Functor m) => Search m where Source #

Minimal complete definition

fromRc, toRc, fromMx, toMx, fromDB, fromDF, toDF, mapDepth, ifDepth

Methods

fromRc :: Recomp a -> m a Source #

toRc :: m a -> Recomp a Source #

fromMx :: Matrix a -> m a Source #

toMx :: m a -> Matrix a Source #

fromDB :: DBound a -> m a Source #

fromDF :: [a] -> m a Source #

toDF :: m a -> [a] Source #

mapDepth :: (Bag a -> Bag b) -> m a -> m b Source #

mapDepth applies a function to the bag at each depth.

catBags :: m (Bag a) -> m a Source #

catBags flattens each bag.

mergesortDepthWithBy :: (k -> k -> k) -> (k -> k -> Ordering) -> m k -> m k Source #

mergesortDepthWithBy converts bags to sets, by (possibly sorting each bag and) removing duplicates. Efficiency on lists with lots of duplicates is required.

ifDepth :: (Int -> Bool) -> m a -> m a -> m a Source #

Instances

Search DBound Source # 

Methods

fromRc :: Recomp a -> DBound a Source #

toRc :: DBound a -> Recomp a Source #

fromMx :: Matrix a -> DBound a Source #

toMx :: DBound a -> Matrix a Source #

fromDB :: DBound a -> DBound a Source #

fromDF :: [a] -> DBound a Source #

toDF :: DBound a -> [a] Source #

mapDepth :: (Bag a -> Bag b) -> DBound a -> DBound b Source #

catBags :: DBound (Bag a) -> DBound a Source #

mergesortDepthWithBy :: (k -> k -> k) -> (k -> k -> Ordering) -> DBound k -> DBound k Source #

ifDepth :: (Int -> Bool) -> DBound a -> DBound a -> DBound a Source #

Search Recomp Source # 

Methods

fromRc :: Recomp a -> Recomp a Source #

toRc :: Recomp a -> Recomp a Source #

fromMx :: Matrix a -> Recomp a Source #

toMx :: Recomp a -> Matrix a Source #

fromDB :: DBound a -> Recomp a Source #

fromDF :: [a] -> Recomp a Source #

toDF :: Recomp a -> [a] Source #

mapDepth :: (Bag a -> Bag b) -> Recomp a -> Recomp b Source #

catBags :: Recomp (Bag a) -> Recomp a Source #

mergesortDepthWithBy :: (k -> k -> k) -> (k -> k -> Ordering) -> Recomp k -> Recomp k Source #

ifDepth :: (Int -> Bool) -> Recomp a -> Recomp a -> Recomp a Source #

Search Matrix Source # 

Methods

fromRc :: Recomp a -> Matrix a Source #

toRc :: Matrix a -> Recomp a Source #

fromMx :: Matrix a -> Matrix a Source #

toMx :: Matrix a -> Matrix a Source #

fromDB :: DBound a -> Matrix a Source #

fromDF :: [a] -> Matrix a Source #

toDF :: Matrix a -> [a] Source #

mapDepth :: (Bag a -> Bag b) -> Matrix a -> Matrix b Source #

catBags :: Matrix (Bag a) -> Matrix a Source #

mergesortDepthWithBy :: (k -> k -> k) -> (k -> k -> Ordering) -> Matrix k -> Matrix k Source #

ifDepth :: (Int -> Bool) -> Matrix a -> Matrix a -> Matrix a Source #

Search Best Source # 

Methods

fromRc :: Recomp a -> Best a Source #

toRc :: Best a -> Recomp a Source #

fromMx :: Matrix a -> Best a Source #

toMx :: Best a -> Matrix a Source #

fromDB :: DBound a -> Best a Source #

fromDF :: [a] -> Best a Source #

toDF :: Best a -> [a] Source #

mapDepth :: (Bag a -> Bag b) -> Best a -> Best b Source #

catBags :: Best (Bag a) -> Best a Source #

mergesortDepthWithBy :: (k -> k -> k) -> (k -> k -> Ordering) -> Best k -> Best k Source #

ifDepth :: (Int -> Bool) -> Best a -> Best a -> Best a Source #

(Functor m, Monad m) => Search (DBoundT m) Source # 

Methods

fromRc :: Recomp a -> DBoundT m a Source #

toRc :: DBoundT m a -> Recomp a Source #

fromMx :: Matrix a -> DBoundT m a Source #

toMx :: DBoundT m a -> Matrix a Source #

fromDB :: DBound a -> DBoundT m a Source #

fromDF :: [a] -> DBoundT m a Source #

toDF :: DBoundT m a -> [a] Source #

mapDepth :: (Bag a -> Bag b) -> DBoundT m a -> DBoundT m b Source #

catBags :: DBoundT m (Bag a) -> DBoundT m a Source #

mergesortDepthWithBy :: (k -> k -> k) -> (k -> k -> Ordering) -> DBoundT m k -> DBoundT m k Source #

ifDepth :: (Int -> Bool) -> DBoundT m a -> DBoundT m a -> DBoundT m a Source #

(Functor m, Monad m) => Search (RecompT m) Source # 

Methods

fromRc :: Recomp a -> RecompT m a Source #

toRc :: RecompT m a -> Recomp a Source #

fromMx :: Matrix a -> RecompT m a Source #

toMx :: RecompT m a -> Matrix a Source #

fromDB :: DBound a -> RecompT m a Source #

fromDF :: [a] -> RecompT m a Source #

toDF :: RecompT m a -> [a] Source #

mapDepth :: (Bag a -> Bag b) -> RecompT m a -> RecompT m b Source #

catBags :: RecompT m (Bag a) -> RecompT m a Source #

mergesortDepthWithBy :: (k -> k -> k) -> (k -> k -> Ordering) -> RecompT m k -> RecompT m k Source #

ifDepth :: (Int -> Bool) -> RecompT m a -> RecompT m a -> RecompT m a Source #

class Delay m where Source #

Minimal complete definition

getDepth

Methods

delay :: m a -> m a Source #

ndelay :: Int -> m a -> m a Source #

getDepth :: m Int Source #

consMx :: Bag a -> Matrix a -> Matrix a Source #

consRc :: Bag a -> Recomp a -> Recomp a Source #

zipWithBF :: Monad m => (a -> b -> m c) -> m a -> m b -> m c Source #

printMx :: Show a => Matrix a -> IO () Source #

printNMx :: Show a => Int -> Matrix a -> IO () Source #

mapDepthDB :: DB m => (Bag (a, Int) -> Bag (b, Int)) -> m a -> m b Source #

type Bag a = [a] Source #

type Stream a = [a] Source #

cat :: [[a]] -> [a] Source #

toList :: a -> a Source #

scanl1BF :: Search m => m x -> m x Source #

zipDepthMx :: (Int -> Bag a -> Bag b) -> Matrix a -> Matrix b Source #

zipDepthRc :: (Int -> Bag a -> Bag b) -> Recomp a -> Recomp b Source #

zipDepth3Mx :: (Int -> Bag a -> Bag b -> Bag c) -> Matrix a -> Matrix b -> Matrix c Source #

zipDepth3Rc :: (Int -> Bag a -> Bag b -> Bag c) -> Recomp a -> Recomp b -> Recomp c Source #

scanlRc :: (Bag a -> Bag b -> Bag a) -> Bag a -> Recomp b -> Recomp a Source #

newtype DBound a Source #

Constructors

DB 

Fields

Instances

Monad DBound Source # 

Methods

(>>=) :: DBound a -> (a -> DBound b) -> DBound b #

(>>) :: DBound a -> DBound b -> DBound b #

return :: a -> DBound a #

fail :: String -> DBound a #

Functor DBound Source # 

Methods

fmap :: (a -> b) -> DBound a -> DBound b #

(<$) :: a -> DBound b -> DBound a #

Applicative DBound Source # 

Methods

pure :: a -> DBound a #

(<*>) :: DBound (a -> b) -> DBound a -> DBound b #

(*>) :: DBound a -> DBound b -> DBound b #

(<*) :: DBound a -> DBound b -> DBound a #

Alternative DBound Source # 

Methods

empty :: DBound a #

(<|>) :: DBound a -> DBound a -> DBound a #

some :: DBound a -> DBound [a] #

many :: DBound a -> DBound [a] #

MonadPlus DBound Source # 

Methods

mzero :: DBound a #

mplus :: DBound a -> DBound a -> DBound a #

Search DBound Source # 

Methods

fromRc :: Recomp a -> DBound a Source #

toRc :: DBound a -> Recomp a Source #

fromMx :: Matrix a -> DBound a Source #

toMx :: DBound a -> Matrix a Source #

fromDB :: DBound a -> DBound a Source #

fromDF :: [a] -> DBound a Source #

toDF :: DBound a -> [a] Source #

mapDepth :: (Bag a -> Bag b) -> DBound a -> DBound b Source #

catBags :: DBound (Bag a) -> DBound a Source #

mergesortDepthWithBy :: (k -> k -> k) -> (k -> k -> Ordering) -> DBound k -> DBound k Source #

ifDepth :: (Int -> Bool) -> DBound a -> DBound a -> DBound a Source #

Delay DBound Source # 
DB DBound Source # 

Methods

mapDepthDB :: (Bag (a, Int) -> Bag (b, Int)) -> DBound a -> DBound b Source #

zipDepthDB :: (Int -> Bag (a, Int) -> Bag (b, Int)) -> DBound a -> DBound b Source #

SStrategy DBound Source # 

Methods

sfilter :: Relation r => (k -> k -> r) -> (Int -> Int) -> DBound ([k], e) -> DBound ([k], e) Source #

ofilter :: Relation r => (k -> k -> r) -> DBound (k, e) -> DBound (k, e) Source #

Memoable DBMemo DBound Source # 
Show (DBound a) Source # 

Methods

showsPrec :: Int -> DBound a -> ShowS #

show :: DBound a -> String #

showList :: [DBound a] -> ShowS #

newtype DBoundT m a Source #

Constructors

DBT 

Fields

Instances

(Functor m, Monad m) => Monad (DBoundT m) Source # 

Methods

(>>=) :: DBoundT m a -> (a -> DBoundT m b) -> DBoundT m b #

(>>) :: DBoundT m a -> DBoundT m b -> DBoundT m b #

return :: a -> DBoundT m a #

fail :: String -> DBoundT m a #

Functor f => Functor (DBoundT f) Source # 

Methods

fmap :: (a -> b) -> DBoundT f a -> DBoundT f b #

(<$) :: a -> DBoundT f b -> DBoundT f a #

(Functor m, Monad m) => Applicative (DBoundT m) Source # 

Methods

pure :: a -> DBoundT m a #

(<*>) :: DBoundT m (a -> b) -> DBoundT m a -> DBoundT m b #

(*>) :: DBoundT m a -> DBoundT m b -> DBoundT m b #

(<*) :: DBoundT m a -> DBoundT m b -> DBoundT m a #

(Functor m, Monad m) => Alternative (DBoundT m) Source # 

Methods

empty :: DBoundT m a #

(<|>) :: DBoundT m a -> DBoundT m a -> DBoundT m a #

some :: DBoundT m a -> DBoundT m [a] #

many :: DBoundT m a -> DBoundT m [a] #

(Functor m, Monad m) => MonadPlus (DBoundT m) Source # 

Methods

mzero :: DBoundT m a #

mplus :: DBoundT m a -> DBoundT m a -> DBoundT m a #

(Functor m, Monad m) => Search (DBoundT m) Source # 

Methods

fromRc :: Recomp a -> DBoundT m a Source #

toRc :: DBoundT m a -> Recomp a Source #

fromMx :: Matrix a -> DBoundT m a Source #

toMx :: DBoundT m a -> Matrix a Source #

fromDB :: DBound a -> DBoundT m a Source #

fromDF :: [a] -> DBoundT m a Source #

toDF :: DBoundT m a -> [a] Source #

mapDepth :: (Bag a -> Bag b) -> DBoundT m a -> DBoundT m b Source #

catBags :: DBoundT m (Bag a) -> DBoundT m a Source #

mergesortDepthWithBy :: (k -> k -> k) -> (k -> k -> Ordering) -> DBoundT m k -> DBoundT m k Source #

ifDepth :: (Int -> Bool) -> DBoundT m a -> DBoundT m a -> DBoundT m a Source #

Monad m => Delay (DBoundT m) Source # 

Methods

delay :: DBoundT m a -> DBoundT m a Source #

ndelay :: Int -> DBoundT m a -> DBoundT m a Source #

getDepth :: DBoundT m Int Source #

(Functor m, Monad m) => DB (DBoundT m) Source # 

Methods

mapDepthDB :: (Bag (a, Int) -> Bag (b, Int)) -> DBoundT m a -> DBoundT m b Source #

zipDepthDB :: (Int -> Bag (a, Int) -> Bag (b, Int)) -> DBoundT m a -> DBoundT m b Source #

zipDepthDB :: DB m => (Int -> Bag (a, Int) -> Bag (b, Int)) -> m a -> m b Source #

newtype DBMemo a Source #

Constructors

DBM 

Fields

class Search n => Memoable m n where Source #

Minimal complete definition

tabulate, applyMemo

Methods

tabulate :: n a -> m a Source #

applyMemo :: m a -> n a Source #

shrink :: (Num t, Ix t) => (t1 -> t1 -> t1) -> (t1 -> t1 -> Maybe Ordering) -> t -> [(t1, t)] -> [(t1, t)] Source #

class Search m => DB m where Source #

Minimal complete definition

mapDepthDB, zipDepthDB

Methods

mapDepthDB :: (Bag (a, Int) -> Bag (b, Int)) -> m a -> m b Source #

zipDepthDB :: (Int -> Bag (a, Int) -> Bag (b, Int)) -> m a -> m b Source #

Instances

DB DBound Source # 

Methods

mapDepthDB :: (Bag (a, Int) -> Bag (b, Int)) -> DBound a -> DBound b Source #

zipDepthDB :: (Int -> Bag (a, Int) -> Bag (b, Int)) -> DBound a -> DBound b Source #

(Functor m, Monad m) => DB (DBoundT m) Source # 

Methods

mapDepthDB :: (Bag (a, Int) -> Bag (b, Int)) -> DBoundT m a -> DBoundT m b Source #

zipDepthDB :: (Int -> Bag (a, Int) -> Bag (b, Int)) -> DBoundT m a -> DBoundT m b Source #

dbtToRcT :: Monad m => DBoundT m a -> RecompT m a Source #