summaryrefslogtreecommitdiff
path: root/src/Miscellaneous.hs
diff options
context:
space:
mode:
authorJed Barber <jjbarber@y7mail.com>2017-01-14 14:05:02 +1100
committerJed Barber <jjbarber@y7mail.com>2017-01-14 14:05:02 +1100
commitb7bcf8a3377bc3b847234baaf24fe6e46d7f85b7 (patch)
tree580d54267de7ed4cc650c5d07345532699c803b1 /src/Miscellaneous.hs
parentcedc60f86a22eddef26d8db4cb3ec36d50a7fd75 (diff)
Some code/style cleanup
Diffstat (limited to 'src/Miscellaneous.hs')
-rw-r--r--src/Miscellaneous.hs7
1 files changed, 4 insertions, 3 deletions
diff --git a/src/Miscellaneous.hs b/src/Miscellaneous.hs
index de20a3d..5a559a5 100644
--- a/src/Miscellaneous.hs
+++ b/src/Miscellaneous.hs
@@ -7,7 +7,7 @@ module Miscellaneous(
-import Control.Monad as Con
+import qualified Control.Monad as Con
import qualified Data.List as List
import qualified Data.Maybe as Maybe
@@ -26,6 +26,7 @@ infixr 1 ?
+
-- kinda functions like poor man's sql
-- first argument is the indices of the items you want in the results
-- second argument is index-item pairs to dictate what records are acceptable to select from
@@ -34,13 +35,13 @@ infixr 1 ?
-- (note that all indices start from 1)
selectFrom :: (Num t, Eq t, Eq a, Enum t) => [t] -> [(t,a)] -> [a] -> Maybe [a]
selectFrom pick has from =
- let tailFunc r i =
+ let foldFunc r i =
let check = List.lookup (fst i) has
in if (Maybe.isNothing check || Maybe.fromJust check == snd i)
then if (List.elem (fst i) pick)
then Just (r ++ [snd i])
else Just r
else Nothing
- in Con.foldM tailFunc [] (zip [1,2..] from)
+ in Con.foldM foldFunc [] (zip [1,2..] from)