packages feed

cookbook 3.0.0.1 → 3.0.1.1

raw patch · 16 files changed

+35/−81 lines, 16 filesPVP: major bump suggested

API removals or changes: PVP suggests a major version bump

API changes (from Hackage documentation)

- Cookbook.Essential.Continuous: instance Eq a => Continuous [a] [a]
- Cookbook.Essential.Continuous: instance Eq a => Continuous [a] a
- Cookbook.Essential.Continuous: instance Eq a => Removable [a] [a]
- Cookbook.Essential.Continuous: instance Eq a => Removable [a] a
- Cookbook.Essential.Continuous: instance Eq a => Replacable [a] ([a], [a])
- Cookbook.Essential.Continuous: instance Eq a => Replacable [a] (a, a)
- Cookbook.Essential.Continuous: instance Eq a => Replacable [a] [([a], [a])]
- Cookbook.Essential.Continuous: instance Eq a => Replacable [a] [(a, a)]
- Cookbook.Essential.Continuous: instance Eq a => Splicable [a] ([a], [a])
- Cookbook.Essential.Continuous: instance Eq a => Splicable [a] (a, a)
- Cookbook.Ingredients.Lists.Encompass: notEncompassedSplit :: Eq a => [a] -> (a, a) -> a -> [[a]]
- Cookbook.Ingredients.Lists.Stats: freqScore :: Eq a => [a] -> [a] -> Double
- Cookbook.Ingredients.Lists.Stats: wordscore :: Eq a => [a] -> [a] -> Double
- Cookbook.Project.Quill2.Q2Prelude: instance Eq QuillAddition
- Cookbook.Project.Quill2.Q2Prelude: instance Eq a => Eq (Element a)
- Cookbook.Project.Quill2.Q2Prelude: instance Eq a => Eq (QuillStatus a)
- Cookbook.Project.Quill2.Q2Prelude: instance Show QuillAddition
- Cookbook.Project.Quill2.Q2Prelude: instance Show a => Show (Element a)
- Cookbook.Project.Quill2.Q2Prelude: instance Show a => Show (QuillStatus a)
- Cookbook.Recipes.Cline: instance Eq Cline
- Cookbook.Recipes.Cline: instance Show Cline
- Cookbook.Recipes.DataStructures: instance Show a => Show (Tree a)
+ Cookbook.Essential.Continuous: instance GHC.Classes.Eq a => Cookbook.Essential.Continuous.Continuous [a] [a]
+ Cookbook.Essential.Continuous: instance GHC.Classes.Eq a => Cookbook.Essential.Continuous.Continuous [a] a
+ Cookbook.Essential.Continuous: instance GHC.Classes.Eq a => Cookbook.Essential.Continuous.Removable [a] [a]
+ Cookbook.Essential.Continuous: instance GHC.Classes.Eq a => Cookbook.Essential.Continuous.Removable [a] a
+ Cookbook.Essential.Continuous: instance GHC.Classes.Eq a => Cookbook.Essential.Continuous.Replacable [a] ([a], [a])
+ Cookbook.Essential.Continuous: instance GHC.Classes.Eq a => Cookbook.Essential.Continuous.Replacable [a] (a, a)
+ Cookbook.Essential.Continuous: instance GHC.Classes.Eq a => Cookbook.Essential.Continuous.Replacable [a] [([a], [a])]
+ Cookbook.Essential.Continuous: instance GHC.Classes.Eq a => Cookbook.Essential.Continuous.Replacable [a] [(a, a)]
+ Cookbook.Essential.Continuous: instance GHC.Classes.Eq a => Cookbook.Essential.Continuous.Splicable [a] ([a], [a])
+ Cookbook.Essential.Continuous: instance GHC.Classes.Eq a => Cookbook.Essential.Continuous.Splicable [a] (a, a)
+ Cookbook.Project.Quill2.Q2Prelude: instance GHC.Classes.Eq Cookbook.Project.Quill2.Q2Prelude.QuillAddition
+ Cookbook.Project.Quill2.Q2Prelude: instance GHC.Classes.Eq a => GHC.Classes.Eq (Cookbook.Project.Quill2.Q2Prelude.Element a)
+ Cookbook.Project.Quill2.Q2Prelude: instance GHC.Classes.Eq a => GHC.Classes.Eq (Cookbook.Project.Quill2.Q2Prelude.QuillStatus a)
+ Cookbook.Project.Quill2.Q2Prelude: instance GHC.Show.Show Cookbook.Project.Quill2.Q2Prelude.QuillAddition
+ Cookbook.Project.Quill2.Q2Prelude: instance GHC.Show.Show a => GHC.Show.Show (Cookbook.Project.Quill2.Q2Prelude.Element a)
+ Cookbook.Project.Quill2.Q2Prelude: instance GHC.Show.Show a => GHC.Show.Show (Cookbook.Project.Quill2.Q2Prelude.QuillStatus a)
+ Cookbook.Recipes.Cline: instance GHC.Classes.Eq Cookbook.Recipes.Cline.Cline
+ Cookbook.Recipes.Cline: instance GHC.Show.Show Cookbook.Recipes.Cline.Cline
+ Cookbook.Recipes.DataStructures: instance GHC.Show.Show a => GHC.Show.Show (Cookbook.Recipes.DataStructures.Tree a)
- Cookbook.Essential.Common: afterX :: Eq a => [a] -> a -> Int -> [a]
+ Cookbook.Essential.Common: afterX :: (Eq a) => [a] -> a -> Int -> [a]
- Cookbook.Essential.Common: pos :: Eq a => [a] -> a -> Int
+ Cookbook.Essential.Common: pos :: (Eq a) => [a] -> a -> Int
- Cookbook.Essential.Common: positions :: Eq a => [a] -> a -> [Int]
+ Cookbook.Essential.Common: positions :: (Eq a) => [a] -> a -> [Int]
- Cookbook.Essential.Common: sub :: Eq a => [a] -> Int -> [a]
+ Cookbook.Essential.Common: sub :: (Eq a) => [a] -> Int -> [a]
- Cookbook.Ingredients.Lists.Access: areAll :: Eq a => [a] -> a -> Bool
+ Cookbook.Ingredients.Lists.Access: areAll :: (Eq a) => [a] -> a -> Bool
- Cookbook.Ingredients.Lists.Access: contains :: Eq a => [a] -> [a] -> Bool
+ Cookbook.Ingredients.Lists.Access: contains :: (Eq a) => [a] -> [a] -> Bool
- Cookbook.Ingredients.Lists.Access: count :: Eq a => [a] -> a -> Int
+ Cookbook.Ingredients.Lists.Access: count :: (Eq a) => [a] -> a -> Int
- Cookbook.Ingredients.Lists.Access: isBefore :: Eq a => [a] -> [a] -> Bool
+ Cookbook.Ingredients.Lists.Access: isBefore :: (Eq a) => [a] -> [a] -> Bool
- Cookbook.Ingredients.Lists.Access: qsort :: Ord a => [a] -> [a]
+ Cookbook.Ingredients.Lists.Access: qsort :: (Ord a) => [a] -> [a]
- Cookbook.Ingredients.Lists.Access: refpos :: Eq a => ([a], [a]) -> a -> a
+ Cookbook.Ingredients.Lists.Access: refpos :: (Eq a) => ([a], [a]) -> a -> a
- Cookbook.Ingredients.Lists.Access: surrounds :: Eq a => (a, a) -> [a] -> Bool
+ Cookbook.Ingredients.Lists.Access: surrounds :: (Eq a) => (a, a) -> [a] -> Bool
- Cookbook.Ingredients.Lists.Encompass: afterEncompassing :: Eq a => [a] -> (a, a) -> [a]
+ Cookbook.Ingredients.Lists.Encompass: afterEncompassing :: (Eq a) => [a] -> (a, a) -> [a]
- Cookbook.Ingredients.Lists.Encompass: beforeEncompassing :: Eq a => [a] -> (a, a) -> [a]
+ Cookbook.Ingredients.Lists.Encompass: beforeEncompassing :: (Eq a) => [a] -> (a, a) -> [a]
- Cookbook.Ingredients.Lists.Encompass: encompassing :: Eq a => [a] -> (a, a) -> [a]
+ Cookbook.Ingredients.Lists.Encompass: encompassing :: (Eq a) => [a] -> (a, a) -> [a]
- Cookbook.Ingredients.Lists.Encompass: gatherEncompassing :: Eq a => [a] -> (a, a) -> [[a]]
+ Cookbook.Ingredients.Lists.Encompass: gatherEncompassing :: (Eq a) => [a] -> (a, a) -> [[a]]
- Cookbook.Ingredients.Lists.Encompass: splitEncompassing :: Eq a => [a] -> (a, a) -> [[a]]
+ Cookbook.Ingredients.Lists.Encompass: splitEncompassing :: (Eq a) => [a] -> (a, a) -> [[a]]
- Cookbook.Ingredients.Lists.Encompass: toGaps :: Eq a => [[a]] -> [[a]]
+ Cookbook.Ingredients.Lists.Encompass: toGaps :: (Eq a) => [[a]] -> [[a]]
- Cookbook.Ingredients.Lists.Modify: linesBetween :: Eq a => [[a]] -> ([a], [a]) -> [[a]]
+ Cookbook.Ingredients.Lists.Modify: linesBetween :: (Eq a) => [[a]] -> ([a], [a]) -> [[a]]
- Cookbook.Ingredients.Lists.Modify: rm :: Eq a => [a] -> a -> [a]
+ Cookbook.Ingredients.Lists.Modify: rm :: (Eq a) => [a] -> a -> [a]
- Cookbook.Ingredients.Lists.Modify: splitOn :: Eq a => [a] -> a -> [[a]]
+ Cookbook.Ingredients.Lists.Modify: splitOn :: (Eq a) => [a] -> a -> [[a]]
- Cookbook.Ingredients.Lists.Modify: surroundedBy :: Eq a => [a] -> (a, a) -> [[a]]
+ Cookbook.Ingredients.Lists.Modify: surroundedBy :: (Eq a) => [a] -> (a, a) -> [[a]]
- Cookbook.Ingredients.Lists.Stats: frequency :: Eq a => [a] -> [(a, Int)]
+ Cookbook.Ingredients.Lists.Stats: frequency :: (Eq a) => [a] -> [(a, Int)]
- Cookbook.Ingredients.Lists.Stats: mostFrequent :: Eq a => [a] -> Int -> [a]
+ Cookbook.Ingredients.Lists.Stats: mostFrequent :: (Eq a) => [a] -> Int -> [a]
- Cookbook.Ingredients.Tupples.Assemble: assemble :: Ord b => [(a, b)] -> [a]
+ Cookbook.Ingredients.Tupples.Assemble: assemble :: (Ord b) => [(a, b)] -> [a]
- Cookbook.Ingredients.Tupples.Assemble: rmDb :: Eq a => [(a, b)] -> [(a, b)]
+ Cookbook.Ingredients.Tupples.Assemble: rmDb :: (Eq a) => [(a, b)] -> [(a, b)]
- Cookbook.Ingredients.Tupples.Assemble: tupsort :: Ord b => [(a, b)] -> [(a, b)]
+ Cookbook.Ingredients.Tupples.Assemble: tupsort :: (Ord b) => [(a, b)] -> [(a, b)]
- Cookbook.Ingredients.Tupples.Look: look :: Eq a => [(a, b)] -> a -> Maybe b
+ Cookbook.Ingredients.Tupples.Look: look :: (Eq a) => [(a, b)] -> a -> Maybe b
- Cookbook.Ingredients.Tupples.Look: lookList :: Eq a => [(a, b)] -> a -> [b]
+ Cookbook.Ingredients.Tupples.Look: lookList :: (Eq a) => [(a, b)] -> a -> [b]
- Cookbook.Ingredients.Tupples.Look: rmLook :: Eq a => [(a, b)] -> a -> [(a, b)]
+ Cookbook.Ingredients.Tupples.Look: rmLook :: (Eq a) => [(a, b)] -> a -> [(a, b)]
- Cookbook.Recipes.Math: dec :: Enum a => a -> a
+ Cookbook.Recipes.Math: dec :: (Enum a) => a -> a
- Cookbook.Recipes.Math: inc :: Enum a => a -> a
+ Cookbook.Recipes.Math: inc :: (Enum a) => a -> a
- Cookbook.Recipes.Math: sqr :: Num a => a -> a
+ Cookbook.Recipes.Math: sqr :: (Num a) => a -> a
- Cookbook.Recipes.Sanitize: blacklist :: Eq a => [a] -> [a] -> [a]
+ Cookbook.Recipes.Sanitize: blacklist :: (Eq a) => [a] -> [a] -> [a]
- Cookbook.Recipes.Sanitize: down :: Eq a => ([a], [a]) -> [a] -> [a]
+ Cookbook.Recipes.Sanitize: down :: (Eq a) => ([a], [a]) -> [a] -> [a]
- Cookbook.Recipes.Sanitize: rmdb :: Eq a => [a] -> [a]
+ Cookbook.Recipes.Sanitize: rmdb :: (Eq a) => [a] -> [a]
- Cookbook.Recipes.Sanitize: rmdbAll :: Eq a => [a] -> [a]
+ Cookbook.Recipes.Sanitize: rmdbAll :: (Eq a) => [a] -> [a]
- Cookbook.Recipes.Sanitize: rmleading :: Eq a => [a] -> a -> [a]
+ Cookbook.Recipes.Sanitize: rmleading :: (Eq a) => [a] -> a -> [a]
- Cookbook.Recipes.Sanitize: up :: Eq a => ([a], [a]) -> [a] -> [a]
+ Cookbook.Recipes.Sanitize: up :: (Eq a) => ([a], [a]) -> [a] -> [a]

Files

Cookbook/Essential/Common.hs view
@@ -1,6 +1,6 @@ {- |    Module      :   Cookbook.Essential.Common-   Copyright   :   (c) 2014 by Nate Pisarski+   Copyright   :   (c) 2015 by Nate Pisarski    License     :   BSD3    Maintainer  :   nathanpisarski@gmail.com    Stability   :   Stable@@ -15,8 +15,8 @@ sub :: (Eq a) => [a] -> Int -> [a] sub [] _ = [] sub x 0 = x-sub (x:xs) c = sub xs (c - 1)-+sub (_:xs) c = sub xs (c - 1)+   -- | Find the occurrences of an element in a list.  positions :: (Eq a) => [a] -> a -> [Int] positions x c = let y = zip x [0..(length x)] in find y
Cookbook/Essential/Continuous.hs view
@@ -1,5 +1,4 @@ {-# LANGUAGE FlexibleInstances     #-}- {-# LANGUAGE MultiParamTypeClasses #-}  {- |@@ -27,7 +26,7 @@    -- | Returns all elements after part.   before :: list -> part -> list-+     -- | Removes part from the list.   delete :: list -> part -> list @@ -48,12 +47,10 @@  -- | Classifies information which can be split by a tupple. class Splicable a b where-+     -- | Removes everything between the tupple's parameters, including the parameters themselves.-  splice   :: a -> b -> a--  -- | Gets everything between the tupple's parameters.-  between  :: a -> b -> a+  splice :: a -> b -> a+  between :: a -> b -> a    instance (Eq a) => Splicable [a] (a,a) where   splice ls (a,b) = before ls a ++ Cm.fromLast (`before` b) ls@@ -64,6 +61,7 @@   splice ls (a,b)  = before ls a ++ after (after ls a) b    between a (b,c)  = before (after a b) c+   -- | Classifies data which can be replaced. class Replacable list repls where 
Cookbook/Essential/IO.hs view
@@ -15,9 +15,7 @@ import qualified System.IO.Strict                  as SIO import qualified Cookbook.Essential.Common         as Cm import qualified Cookbook.Essential.Continuous     as Ct-import qualified Cookbook.Ingredients.Lists.Modify as Md--import System.Environment       +  import System.Directory  -- | Return the lines of a file as a list of Strings.
Cookbook/Ingredients/Lists/Access.hs view
@@ -10,8 +10,7 @@ module Cookbook.Ingredients.Lists.Access where  import qualified Cookbook.Ingredients.Functional.Break as Br-import qualified Cookbook.Ingredients.Tupples.Assemble as As-import qualified Cookbook.Essential.Common             as Cm+import qualified Cookbook.Essential.Common as Cm  -- | Counts the occurrences an element has within a list. count :: (Eq a) => [a] -> a -> Int
Cookbook/Ingredients/Lists/Encompass.hs view
@@ -21,7 +21,7 @@     helper [] _  = []     helper (y:ys) e       | y == b && e <= 1 = []-      | y == a && a == b = if e == 0 then [] else condInp $ helper ys (e + 1)+      | y == a && a == b = if e == 0 then [] else condInp $ helper ys ((e :: Integer )+ 1)       | y == a = condInp $ helper ys (e + 1)       | y == b = y : helper ys (e - 1)       | otherwise = condInp $ helper ys e@@ -44,21 +44,6 @@       | not $  f `elem` e && g `elem` e = [e]       | otherwise = beforeEncompassing e (f,g) : splitEncompassing (afterEncompassing e (f,g)) (f,g) --- | There is a long story behind this function, and why it sucks. See ENN1 in the source.-notEncompassedSplit :: (Eq a) => [a] -> (a,a) -> a -> [[a]]-notEncompassedSplit [] _ _ = [] -- "b{c,d},e,{f:g,e:h}"-notEncompassedSplit ls (sp1,sp2) sp = toGaps $ helper ls 0-  where-    helper [] _ = []-    helper (x:xs) c-      | x == sp1 && c >= 0 = (sp1: encompassing (x:xs) (sp1,sp2)) : helper (afterEncompassing xs (sp1,sp2)) (c + 1)-      | x == sp2 && c <= 0 = [x] :  helper xs (c - 1)-      | x == sp1 = [x] : helper xs (c+1)-      | x == sp2 = [x] : helper xs (c - 1)-      | x == sp && c > 0 = [x] : helper xs c-      | x == sp && c <= 0 = [] : helper xs c-      | otherwise = [x] : helper xs c- toGaps :: (Eq a) => [[a]] -> [[a]] toGaps [] = [] toGaps x@@ -70,13 +55,3 @@ gatherEncompassing a (b,c)    | not $ b `elem` a && c `elem` a = []   | otherwise = encompassing a (b,c) : gatherEncompassing (afterEncompassing a (b,c)) (b,c)---- [ENN1]--- This function is terrible. Bloody AWFUL. So, why include it? Because it works.--- the implementation of the function is hard to rework, so unfortunately it doesn't--- get much better than this. I've tried rereading it time and time again, and the--- details of how it works confuse me. Prior to making the function, I spent--- more than a month thinking about how it should work. After that didn't work--- I began to change variables and behaviors in a fit of rage, and it started--- to work. And don't question the helper function either. This is as good--- as it gets, ladies and gentlemen.
Cookbook/Ingredients/Lists/Modify.hs view
@@ -9,7 +9,6 @@ -} module Cookbook.Ingredients.Lists.Modify where -import qualified Cookbook.Essential.Common             as Cm import qualified Cookbook.Essential.Continuous         as Ct import qualified Cookbook.Ingredients.Functional.Break as Br import qualified Cookbook.Ingredients.Lists.Access     as Ac
Cookbook/Ingredients/Lists/Stats.hs view
@@ -13,8 +13,6 @@ import qualified Cookbook.Ingredients.Lists.Access     as Ac import qualified Cookbook.Ingredients.Lists.Modify     as Md import qualified Cookbook.Ingredients.Tupples.Assemble as As-import qualified Cookbook.Recipes.Sanitize             as Sn-import qualified Cookbook.Recipes.Math                 as Ma  -- | Creates a list with the frequency of elements in a list. frequency :: (Eq a) => [a] -> [(a,Int)] @@ -23,15 +21,3 @@ -- | Returns the x-amount of most frequent elements in a list. If there is a "tie", the order it appears in a list takes precedence.  mostFrequent :: (Eq a) => [a] -> Int -> [a] mostFrequent x c = take c $ Md.rev (As.assemble  $ frequency x)---- | Provides a mathematical score out of 1 based on the similarities between the two words. This is freqScore, but it takes into account length.-wordscore :: (Eq a) => [a] -> [a] -> Double-wordscore a b = (freqScore a b - 0.1) + (0.1 / realToFrac (if diffLen == 0 then 1 else diffLen))-  where diffLen = abs $ length a - length b---- | Provides a frequency score between two lists.-freqScore :: (Eq a) => [a] -> [a] -> Double-freqScore a b =  rawFreq / fromIntegral diffLen-  where diffLen = fromIntegral  $ length (frequency (if length (frequency a) < length (frequency b) then a else b))-        rawFreq = fromIntegral (sum $ map (\e -> if e `elem` d then 1 else 0) c)-        (c:d:_) = map (`mostFrequent` diffLen) [a,b]
Cookbook/Ingredients/Tupples/Look.hs view
@@ -18,7 +18,7 @@  -- | Returns all elements where the lval matches the element. lookList :: (Eq a) => [(a,b)] -> a -> [b]-lookList a b = map snd $ filter (\(c,d) -> c == b) a+lookList a b = map snd $ filter (\(c,_) -> c == b) a  -- | Swap the lval with the rval, and vice-versa. swp :: (a,b) -> (b,a)@@ -32,5 +32,5 @@ -- | Turns a list into as many double-tupples (a,a) as it can, dropping items from uneven lists. group :: [a] -> [(a,a)] group [] = []-group [x] = []+group [_] = [] group (x:y:z) = (x,y) : group z
Cookbook/Project/Quill2/Q2Api.hs view
@@ -16,7 +16,6 @@ import qualified Cookbook.Ingredients.Lists.Access as Ac  import Cookbook.Project.Quill2.Q2Prelude-import Cookbook.Project.Quill2.Q2Parse  -- | Get the name of a Quill. getQuillName :: Quill -> String@@ -37,13 +36,11 @@ -- | Look up the value of a Quill TABLE. Will produce an error on a list. lookUp :: [Quill] -> (String, String) -> QuillStatus String lookUp x (a,b) = case getQuill x a of-  (QuillSuccess (c,d)) -> case d of-    (List f) -> error "Cannot look up the value of a list."+  (QuillSuccess (_,d)) -> case d of+    (List _) -> error "Cannot look up the value of a list."     (Table f) -> let c = Lk.lookList f b in if null c|| (length c > 1) then QuillMissing b else QuillSuccess $ head c-   (QuillMissing _)  -> QuillMissing a   (QuillMultiple _) -> QuillMultiple a-    where multipleInnerError = QuillMultiple b  -- | Remove a quill from the database by name. removeQuill :: [Quill] -> String -> [Quill]@@ -75,12 +72,12 @@     (List d)  -> case qa of       (AList (_,b)) -> QuillSuccess $ (y, List (b:d)) : removeQuill x a       (ATable _) -> error $ "Type Mismatch! Attempted to add Table type to List in table " ++ show qa-  QuillMultiple v -> QuillMultiple a-  QuillMissing  v -> QuillMissing a --M+  QuillMultiple _ -> QuillMultiple a+  QuillMissing  _ -> QuillMissing a --M   where     a = case qa of-      (ATable (g,b,c)) -> g-      (AList  (g,b))   -> g+      (ATable (g,_,_)) -> g+      (AList  (g,_))   -> g  -- | Map a Quill function. qMap :: QuillStatus [Quill] -> ([Quill] -> QuillStatus [Quill]) -> QuillStatus [Quill]@@ -91,7 +88,7 @@ -- | Change an item within the database using a Quill addition. Wrapper of addItem and removeItem. changeItem :: [Quill] -> QuillAddition -> QuillStatus [Quill] changeItem x y = case y of-                      (ATable (a,b,c)) ->  qMap (removeItem x (a,b)) (`addItem` y)+                      (ATable (a,b,_)) ->  qMap (removeItem x (a,b)) (`addItem` y)                       (AList  (a,b))   ->  qMap (removeItem x (a,b)) (`addItem` y)                   
Cookbook/Project/Quill2/Q2Io.hs view
@@ -17,7 +17,6 @@ import Cookbook.Project.Quill2.Q2Prelude import Cookbook.Project.Quill2.Q2Parse -import System.IO  -- | Read a Quill database from a file. fromFile :: FilePath ->  IO [Quill]
Cookbook/Project/Quill2/Q2Parse.hs view
@@ -10,7 +10,6 @@  module Cookbook.Project.Quill2.Q2Parse where -import qualified Cookbook.Essential.Common         as Cm import qualified Cookbook.Essential.Continuous     as Ct  import qualified Cookbook.Ingredients.Lists.Modify    as Md@@ -35,7 +34,7 @@     typ  = (name,if Ct.before x '{' `Ac.contains` "table" then Table (parseTables body) else List body) -- Determines what kind of type the Quill is.     body = Md.splitOn (En.encompassing x ('{','}')) ';'      quoted y = if ('`','\'') `Ac.surrounds` y then En.encompassing x ('`','\'') else Ct.remove y ' ' -- Whole String encapsulation-    parseTables = map (\x -> (quoted $ Ct.before x ':', Ct.after x ':'))+    parseTables = map (\y -> (quoted $ Ct.before y ':', Ct.after y ':'))  -- | Turn the lines of a file into a list of tables, AKA a Database. pFile :: [String] -> [Quill]
Cookbook/Recipes/Algorithm.hs view
@@ -11,7 +11,6 @@ module Cookbook.Recipes.Algorithm where  import Cookbook.Recipes.DataStructures-import Cookbook.Ingredients.Lists.Modify  -- | Get every node of a tree, put it into a list. climb :: Tree a -> [a]@@ -23,14 +22,14 @@ treeMap :: Tree a -> (a -> a) -> Tree a treeMap tr f = case tr of   Empty -> Empty-  (Branch a Empty z@(Branch c _ _)) -> Branch (f c) (treeMap z f) Empty-  (Branch a z@(Branch b _ _) Empty) -> Branch (f b) Empty $ treeMap z f+  (Branch _ Empty z@(Branch c _ _)) -> Branch (f c) (treeMap z f) Empty+  (Branch _ z@(Branch b _ _) Empty) -> Branch (f b) Empty $ treeMap z f  -- | Collectively nullify nodes on a tree. treeFilter :: Tree a -> (a -> Bool) -> Tree a-treeFilter Empty f = Empty-treeFilter (Branch a Empty z@(Branch b _ _)) f = if f a then Branch a Empty (treeFilter z f) else Empty-treeFilter (Branch a z@(Branch b _ _) Empty) f = if f a then Branch a (treeFilter z f) Empty else Empty+treeFilter Empty _ = Empty+treeFilter (Branch a Empty z@(Branch _ _ _)) f = if f a then Branch a Empty (treeFilter z f) else Empty+treeFilter (Branch a z@(Branch _ _ _) Empty) f = if f a then Branch a (treeFilter z f) Empty else Empty  -- | Generates a list of points, with the specified null data in the snd of the tupples. genMatrix :: (Int,Int) -> a -> [((Int,Int),a)]
Cookbook/Recipes/Cline.hs view
@@ -1,7 +1,6 @@ module Cookbook.Recipes.Cline(parse,Cline(..),clineExtract,clArg) where  import qualified  Cookbook.Essential.Continuous     as Ct-import qualified  Cookbook.Essential.Common         as Cm import qualified  Cookbook.Ingredients.Lists.Modify as Md import qualified  Cookbook.Ingredients.Lists.Access as Ac import qualified  Cookbook.Recipes.Sanitize         as Sn@@ -20,8 +19,11 @@ data Cline = Flag Char | Argument String String deriving (Show,Eq)  -- | Parses a flag argument.+singleParse :: String -> Cline singleParse y = Flag (last y)+ -- | Parses an argument Cline.+doubleParse :: (String, String) -> Cline doubleParse (a,b) = Argument (Ct.after a "--") b  -- | Extract arguments from a list of word-separated strings.@@ -30,12 +32,14 @@   (a:b:[]) -> if Ac.count a '-' == 2 then [doubleParse (a,b)] else [singleParse a,singleParse b]   (a:[]) -> [singleParse a]   _ -> helper x-  ++-- | Helps clineExtract. Determines whether to single or double parse something+helper :: [String] -> [Cline] helper x   | Ac.count w1 '-' == 1 = singleParse w1 : clineExtract (w2:r)   | Ac.count w1 '-' == 2 = doubleParse (w1,w2) : clineExtract r   | otherwise = clineExtract (w2:r)-  where (w1:w2:r) = x+    where (w1:w2:r) = x  -- | Parse a flat string into a list of Clines. parse :: String -> [Cline]
Cookbook/Recipes/Math.hs view
Cookbook/Recipes/Sanitize.hs view
cookbook.cabal view
@@ -3,7 +3,7 @@ -- PVP summary:      +-+------- breaking API changes --                   | | +----- non-breaking API additions --                   | | | +--- code changes with no API change-version:             3.0.0.1+version:             3.0.1.1 synopsis:    Tiered general-purpose libraries with domain-specific applications. description:        Cookbook is a line of libraries covering a wide variety of Haskell applications. Every application that I make, I add its functions to Cookbook, turning Cookbook into an all-encompassing general-purpose library over time. The claim-to-fame for the library is its use of overloaded typeclasses, called "Continuities".  license:             BSD3@@ -52,6 +52,7 @@                                         build-depends:       base ==4.*, directory, strict+ source-repository head   type: git   location: https://github.com/natepisarski/Cookbook-hs