module Data.XCB.Utils where
import Data.Char
import Control.Applicative
ensureUpper :: String -> String
ensureUpper :: String -> String
ensureUpper [] = []
ensureUpper (Char
x:String
xs) = (Char -> Char
toUpper Char
x) forall a. a -> [a] -> [a]
: String
xs
mapAlt :: Alternative f => (a -> f b) -> [a] -> f [b]
mapAlt :: forall (f :: * -> *) a b.
Alternative f =>
(a -> f b) -> [a] -> f [b]
mapAlt a -> f b
f [a]
xs = [a] -> f [b]
go [a]
xs
where go :: [a] -> f [b]
go [] = forall (f :: * -> *) a. Applicative f => a -> f a
pure []
go (a
y:[a]
ys) = forall (f :: * -> *) a. Applicative f => a -> f a
pure (:) forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
<*> a -> f b
f a
y forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
<*> [a] -> f [b]
go [a]
ys
forall (f :: * -> *) a. Alternative f => f a -> f a -> f a
<|> [a] -> f [b]
go [a]
ys