[Fencommits] fenserve: use available abbreviations when converting potion expressions to URI syntax
Benja Fallenstein
benja.fallenstein at gmail.com
Thu Jun 21 19:25:11 EEST 2007
Thu Jun 21 19:24:57 EEST 2007 Benja Fallenstein <benja.fallenstein at gmail.com>
* use available abbreviations when converting potion expressions to URI syntax
diff -rN -u old-fenserve/fendata/Rendering.hs new-fenserve/fendata/Rendering.hs
--- old-fenserve/fendata/Rendering.hs 2007-06-21 19:25:10.000000000 +0300
+++ new-fenserve/fendata/Rendering.hs 2007-06-21 19:25:10.000000000 +0300
@@ -94,7 +94,7 @@
renderExp :: (?imp :: Imp) => Exp -> HTML
-renderExp exp = tag "span" [P "class" "potion"] $ joinPieces (Focus exp)
+renderExp exp = tag "span" [P "class" "potion"] $ joinPieces (Focus (removeFocus exp))
$ flip evalState 0 $ runReaderT (renderExp' exp) $ Env [] [] exp
joinPieces :: (?imp :: Imp) => Exp -> [(Bool,HTML)] -> HTML
diff -rN -u old-fenserve/fendata/Syntax.hs new-fenserve/fendata/Syntax.hs
--- old-fenserve/fendata/Syntax.hs 2007-06-21 19:25:10.000000000 +0300
+++ new-fenserve/fendata/Syntax.hs 2007-06-21 19:25:10.000000000 +0300
@@ -50,6 +50,12 @@
expCase (Focus exp) = SExp "focus" [toSExp exp]
otherCase :: Data a => a -> SExp
+ otherCase x | t <- dataTypeOf x, dataTypeName t == "Prelude.[]" =
+ if constrIndex (toConstr x) == 1 then SExp "" [] else
+ case gmapQi 1 otherCase x of
+ SExp "" xs -> SExp "" (gmapQi 0 toSExp x : xs)
+ otherCase x | t <- dataTypeOf x, isAlgType t, maxConstrIndex t == 1 =
+ SExp "" (gmapQ toSExp x)
otherCase x = SExp (showConstr (toConstr x)) (gmapQ toSExp x)
readExp = fromSExp . head . fst . f z where
More information about the Fencommits
mailing list