diff --git a/src/Waterdeep/Actions.hs b/src/Waterdeep/Actions.hs index cc12e55..025a9e4 100644 --- a/src/Waterdeep/Actions.hs +++ b/src/Waterdeep/Actions.hs @@ -495,18 +495,6 @@ forCurrentPlayer a1 = do p <- use gameCurrentPlayer withActivePlayer p a1 --- Like (<$>), but with the same fixity and precedence as ($) -(<$$>) :: Applicative f => (a -> b) -> f a -> f b -(<$$>) = (<$>) -infixr 0 <$$> - -joinStrings :: [String] -> String -joinStrings [] = "nothing" -joinStrings [x] = x -joinStrings [x,y] = x ++ " and " ++ y -joinStrings [x,y,z] = x ++ ", " ++ y ++ ", and " ++ z -joinStrings (x:xs) = x ++ ", " ++ joinStrings xs - shufflePiles :: Lens WaterdeepState WaterdeepState [a] [a] -> Lens WaterdeepState WaterdeepState [a] [a] -> Waterdeep () diff --git a/src/Waterdeep/Util.hs b/src/Waterdeep/Util.hs index eacf936..b8717d0 100644 --- a/src/Waterdeep/Util.hs +++ b/src/Waterdeep/Util.hs @@ -8,12 +8,15 @@ module Waterdeep.Util , countOf , singular , mif + , joinStrings + , (<$$>) ) where -import Lens.Family2 +import Control.Applicative import Data.List import Data.Maybe import Data.Monoid +import Lens.Family2 deleteAt :: Int -> [a] -> [a] deleteAt n l = left ++ drop 1 right @@ -42,3 +45,15 @@ singular t f b = (\a' -> b & t .~ a') `fmap` (f (unJust (firstOf t b))) mif :: Monoid m => Bool -> m -> m mif c m = if c then m else mempty + +joinStrings :: [String] -> String +joinStrings [] = "nothing" +joinStrings [x] = x +joinStrings [x,y] = x ++ " and " ++ y +joinStrings [x,y,z] = x ++ ", " ++ y ++ ", and " ++ z +joinStrings (x:xs) = x ++ ", " ++ joinStrings xs + +-- Like (<$>), but with the same fixity and precedence as ($) +(<$$>) :: Applicative f => (a -> b) -> f a -> f b +(<$$>) = (<$>) +infixr 0 <$$>