From 5c9c99b41ce1ecfee70071ecd3b369855b72d259 Mon Sep 17 00:00:00 2001 From: Matthias Schiffer Date: Wed, 13 Jul 2011 02:13:01 +0200 Subject: Added basic rendering functions --- lib/Phi/X11/AtomList.hs | 1 - lib/Phi/X11/Atoms.hs | 11 +++++------ 2 files changed, 5 insertions(+), 7 deletions(-) (limited to 'lib/Phi/X11') 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] -- cgit v1.2.3