cookbook 0.1.3.0 → 0.1.3.1
raw patch · 3 files changed
+20/−3 lines, 3 files
Files
- Cookbook/IO.hs +8/−1
- Cookbook/Ingredients/Lists/Access.hs +11/−1
- cookbook.cabal +1/−1
Cookbook/IO.hs view
@@ -1,4 +1,4 @@-module Cookbook.IO(filelines) where+module Cookbook.IO(filelines,prompt) where import System.IO import System.Environment @@ -8,3 +8,10 @@ y <- openFile x ReadMode yc <- hGetContents y return (lines yc)++-- | Prompts the user for a string+prompt :: String -> IO (String)+prompt x = do+ putStr x+ hFlush stdout+ getLine
Cookbook/Ingredients/Lists/Access.hs view
@@ -1,5 +1,5 @@ module Cookbook.Ingredients.Lists.Access(-count,contains,qsort) where+count,contains,qsort,pull,refpos) where import qualified Cookbook.Ingredients.Functional.Break as Br @@ -24,3 +24,13 @@ where lessT = qsort [y | y <- xs, y <= x] greatT = qsort [y | y <- xs, y > x]++-- | Safe !!+pull :: [a] -> Int -> Maybe a+pull _ (-1) = Nothing+pull [] _ = Nothing+pull (x:xs) c = if c == 0 then (Just x) else pull xs (c - 1)++-- | Reference an element from one list to another.+refpos :: (Eq a) => ([a],[a]) -> a -> a+refpos (a,b) c = let d = (pull b (Cm.pos a c)) in case d of (Just x) -> x;(Nothing) -> c
cookbook.cabal view
@@ -10,7 +10,7 @@ -- PVP summary: +-+------- breaking API changes -- | | +----- non-breaking API additions -- | | | +--- code changes with no API change-version: 0.1.3.0+version: 0.1.3.1 -- A short (one-line) description of the package. synopsis: An independent library of common haskell operations.