[Fencommits] fenserve: make the potion editing page determine the type of the focused subexpression
Benja Fallenstein
benja.fallenstein at gmail.com
Fri Jun 22 14:53:42 EEST 2007
Fri Jun 22 14:53:34 EEST 2007 Benja Fallenstein <benja.fallenstein at gmail.com>
* make the potion editing page determine the type of the focused subexpression
diff -rN -u old-fenserve/fendata/Main.hs new-fenserve/fendata/Main.hs
--- old-fenserve/fendata/Main.hs 2007-06-22 14:53:42.000000000 +0300
+++ new-fenserve/fendata/Main.hs 2007-06-22 14:53:42.000000000 +0300
@@ -129,5 +129,9 @@
( para $ tag' "small" $
link (impRoot ?imp ++ "potion/" ++ showExp (removeFocus exp))
"<< Back"
- , para $ renderExp exp )
+ , para $ renderExp exp
+ , hr
+ , para
+ ( "The focused subexpression is of type '"
+ , renderType $ expType $ case getFocus exp of Just x -> x, "'" ))
]
diff -rN -u old-fenserve/fendata/Rendering.hs new-fenserve/fendata/Rendering.hs
--- old-fenserve/fendata/Rendering.hs 2007-06-22 14:53:42.000000000 +0300
+++ new-fenserve/fendata/Rendering.hs 2007-06-22 14:53:42.000000000 +0300
@@ -58,6 +58,12 @@
n i = (if i<26 then "" else n (i `div` 26))
++ [toEnum $ fromEnum 'a' + i `mod` 26]
+getFocus :: Exp -> Maybe Exp
+getFocus exp = (case getFoci exp of (x:xs) -> Just x; [] -> Nothing) where
+ getFoci :: Data a => a -> [Exp]
+ getFoci = (concat . gmapQ getFoci) `extQ` expCase
+ expCase (Focus e) = [e]; expCase e = concat $ gmapQ getFoci e
+
focusPath p = focusPath' p . removeFocus
focusPath' :: [Int] -> GenericT
More information about the Fencommits
mailing list