module Utils.Foldable where import Utils.String (indent) import Data.Foldable as Foldable (Foldable(toList)) import Data.List (intercalate) hasNone :: Foldable m => m a -> Bool hasNone :: m a -> Bool hasNone = m a -> Bool forall (t :: * -> *) a. Foldable t => t a -> Bool null hasSome :: Foldable m => m a -> Bool hasSome :: m a -> Bool hasSome = Bool -> Bool not (Bool -> Bool) -> (m a -> Bool) -> m a -> Bool forall b c a. (b -> c) -> (a -> b) -> a -> c . m a -> Bool forall (m :: * -> *) a. Foldable m => m a -> Bool hasNone hasMany :: Foldable m => m a -> Bool hasMany :: m a -> Bool hasMany m a xs = ([a] -> Bool) -> [[a]] -> Bool forall (t :: * -> *) a. Foldable t => (a -> Bool) -> t a -> Bool all [a] -> Bool forall (m :: * -> *) a. Foldable m => m a -> Bool hasSome ([[a]] -> Bool) -> [[a]] -> Bool forall a b. (a -> b) -> a -> b $ [[a] -> [a] forall a. a -> a id, [a] -> [a] forall a. [a] -> [a] tail] [[a] -> [a]] -> [[a]] -> [[a]] forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b <*> [m a -> [a] forall (t :: * -> *) a. Foldable t => t a -> [a] Foldable.toList m a xs] stringify :: (Foldable m) => String -> String -> String -> Int -> m String -> String stringify :: String -> String -> String -> Int -> m String -> String stringify String sep String start String end Int n m String xs = String start String -> String -> String forall a. [a] -> [a] -> [a] ++ Int -> String -> String indent Int n String str String -> String -> String forall a. [a] -> [a] -> [a] ++ String end where str :: String str = String -> [String] -> String forall a. [a] -> [[a]] -> [a] intercalate String sep [String] list list :: [String] list = m String -> [String] forall (t :: * -> *) a. Foldable t => t a -> [a] toList m String xs