summaryrefslogtreecommitdiffstats
path: root/lib/Phi/X11/Atoms.hs
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/Atoms.hs
parent982bcffcfeb074b4c1beff64ca7361a9a66ed273 (diff)
downloadphi-5c9c99b41ce1ecfee70071ecd3b369855b72d259.tar
phi-5c9c99b41ce1ecfee70071ecd3b369855b72d259.zip
Added basic rendering functions
Diffstat (limited to 'lib/Phi/X11/Atoms.hs')
-rw-r--r--lib/Phi/X11/Atoms.hs11
1 files changed, 5 insertions, 6 deletions
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]