summaryrefslogtreecommitdiffstats
path: root/lib/Phi/X11
diff options
context:
space:
mode:
authorMatthias Schiffer <mschiffer@universe-factory.net>2011-07-13 02:13:01 +0200
committerMatthias Schiffer <mschiffer@universe-factory.net>2011-07-13 02:13:01 +0200
commit5c9c99b41ce1ecfee70071ecd3b369855b72d259 (patch)
tree77e460321ef2375adeaec2e96c09484b5948cc0f /lib/Phi/X11
parent982bcffcfeb074b4c1beff64ca7361a9a66ed273 (diff)
downloadphi-5c9c99b41ce1ecfee70071ecd3b369855b72d259.tar
phi-5c9c99b41ce1ecfee70071ecd3b369855b72d259.zip
Added basic rendering functions
Diffstat (limited to 'lib/Phi/X11')
-rw-r--r--lib/Phi/X11/AtomList.hs1
-rw-r--r--lib/Phi/X11/Atoms.hs11
2 files changed, 5 insertions, 7 deletions
diff --git a/lib/Phi/X11/AtomList.hs b/lib/Phi/X11/AtomList.hs
index 60cd0c5..5965d69 100644
--- a/lib/Phi/X11/AtomList.hs
+++ b/lib/Phi/X11/AtomList.hs
@@ -15,4 +15,3 @@ atoms = [ "_XROOTPMAP_ID"
, "_NET_WM_STRUT"
, "_NET_WM_STRUT_PARTIAL"
]
-
diff --git a/lib/Phi/X11/Atoms.hs b/lib/Phi/X11/Atoms.hs
index a2708dd..38f8f3c 100644
--- a/lib/Phi/X11/Atoms.hs
+++ b/lib/Phi/X11/Atoms.hs
@@ -11,17 +11,15 @@ import Graphics.X11
import Phi.X11.AtomList
-$(do
- let atomsName = mkName "Atoms"
- atomNames = map (\atom -> (atom, mkName ("atom" ++ atom))) atoms
- fields = map (\(_, name) -> (name, IsStrict, ConT ''Atom)) atomNames
- return [DataD [] atomsName [] [RecC atomsName fields] []]
+$(let atomsName = mkName "Atoms"
+ atomNames = map (\atom -> (atom, mkName ("atom" ++ atom))) atoms
+ fields = map (\(_, name) -> (name, IsStrict, ConT ''Atom)) atomNames
+ in return [DataD [] atomsName [] [RecC atomsName fields] []]
)
initAtoms :: Display -> IO Atoms
initAtoms display =
$(do
- let atomsName = mkName "Atoms"
atomNames <- mapM (\atom -> do
varName <- newName ('_':atom)
return (atom, mkName ("atom" ++ atom), varName)
@@ -30,6 +28,7 @@ initAtoms display =
\(atom, _, varName) -> liftM (BindS (VarP varName)) [| internAtom display atom False |]
let atomFieldExps = map (\(_, atomName, varName) -> (atomName, VarE varName)) atomNames
+ atomsName = mkName "Atoms"
atomsContruction = NoBindS $ AppE (VarE 'return) $ RecConE atomsName atomFieldExps
return $ DoE $ atomInitializers ++ [atomsContruction]