module InternAtom(internAtomK, internAtomF, internAtom,
atomNameK, atomNameF, atomName) where
import Command
import Event
import Xrequest
internAtomK :: String -> Bool -> Cont (K b c) Atom
internAtomK = (XRequest -> (XResponse -> Maybe Atom) -> Cont (K b c) Atom)
-> String -> Bool -> Cont (K b c) Atom
forall t.
(XRequest -> (XResponse -> Maybe Atom) -> t) -> String -> Bool -> t
ia XRequest -> (XResponse -> Maybe Atom) -> Cont (K b c) Atom
forall a b c. XRequest -> (XResponse -> Maybe a) -> Cont (K b c) a
xrequestK
internAtomF :: String -> Bool -> Cont (F b c) Atom
internAtomF = (XRequest -> (XResponse -> Maybe Atom) -> Cont (F b c) Atom)
-> String -> Bool -> Cont (F b c) Atom
forall t.
(XRequest -> (XResponse -> Maybe Atom) -> t) -> String -> Bool -> t
ia XRequest -> (XResponse -> Maybe Atom) -> Cont (F b c) Atom
forall a b c. XRequest -> (XResponse -> Maybe a) -> Cont (F b c) a
xrequestF
internAtom :: String -> Bool -> (Atom -> f b ho) -> f b ho
internAtom String
a Bool
e = (XRequest
-> (XResponse -> Maybe Atom) -> (Atom -> f b ho) -> f b ho)
-> String -> Bool -> (Atom -> f b ho) -> f b ho
forall t.
(XRequest -> (XResponse -> Maybe Atom) -> t) -> String -> Bool -> t
ia XRequest -> (XResponse -> Maybe Atom) -> (Atom -> f b ho) -> f b ho
forall (f :: * -> * -> *) ans b ho.
FudgetIO f =>
XRequest -> (XResponse -> Maybe ans) -> (ans -> f b ho) -> f b ho
xrequest String
a Bool
e
ia :: (XRequest -> (XResponse -> Maybe Atom) -> t) -> String -> Bool -> t
ia XRequest -> (XResponse -> Maybe Atom) -> t
k String
atomNm Bool
ifExists =
let gotit :: XResponse -> Maybe Atom
gotit (GotAtom Atom
atom) = Atom -> Maybe Atom
forall a. a -> Maybe a
Just Atom
atom
gotit XResponse
_ = Maybe Atom
forall a. Maybe a
Nothing
in XRequest -> (XResponse -> Maybe Atom) -> t
k (String -> Bool -> XRequest
InternAtom String
atomNm Bool
ifExists) XResponse -> Maybe Atom
gotit
atomNameK :: Atom -> Cont (K b c) (Maybe String)
atomNameK = (XRequest
-> (XResponse -> Maybe (Maybe String))
-> Cont (K b c) (Maybe String))
-> Atom -> Cont (K b c) (Maybe String)
forall t.
(XRequest -> (XResponse -> Maybe (Maybe String)) -> t) -> Atom -> t
an XRequest
-> (XResponse -> Maybe (Maybe String))
-> Cont (K b c) (Maybe String)
forall a b c. XRequest -> (XResponse -> Maybe a) -> Cont (K b c) a
xrequestK
atomNameF :: Atom -> Cont (F b c) (Maybe String)
atomNameF = (XRequest
-> (XResponse -> Maybe (Maybe String))
-> Cont (F b c) (Maybe String))
-> Atom -> Cont (F b c) (Maybe String)
forall t.
(XRequest -> (XResponse -> Maybe (Maybe String)) -> t) -> Atom -> t
an XRequest
-> (XResponse -> Maybe (Maybe String))
-> Cont (F b c) (Maybe String)
forall a b c. XRequest -> (XResponse -> Maybe a) -> Cont (F b c) a
xrequestF
atomName :: Atom -> (Maybe String -> f b ho) -> f b ho
atomName Atom
a = (XRequest
-> (XResponse -> Maybe (Maybe String))
-> (Maybe String -> f b ho)
-> f b ho)
-> Atom -> (Maybe String -> f b ho) -> f b ho
forall t.
(XRequest -> (XResponse -> Maybe (Maybe String)) -> t) -> Atom -> t
an XRequest
-> (XResponse -> Maybe (Maybe String))
-> (Maybe String -> f b ho)
-> f b ho
forall (f :: * -> * -> *) ans b ho.
FudgetIO f =>
XRequest -> (XResponse -> Maybe ans) -> (ans -> f b ho) -> f b ho
xrequest Atom
a
an :: (XRequest -> (XResponse -> Maybe (Maybe String)) -> t) -> Atom -> t
an XRequest -> (XResponse -> Maybe (Maybe String)) -> t
k Atom
atom =
let gotit :: XResponse -> Maybe (Maybe String)
gotit (GotAtomName (Just String
s)) = Maybe String -> Maybe (Maybe String)
forall a. a -> Maybe a
Just (String -> Maybe String
forall a. a -> Maybe a
Just String
s)
gotit XResponse
_ = Maybe (Maybe String)
forall a. Maybe a
Nothing
in XRequest -> (XResponse -> Maybe (Maybe String)) -> t
k (Atom -> XRequest
GetAtomName Atom
atom) XResponse -> Maybe (Maybe String)
gotit