[Fencommits] fenserve: twids to make potion URI syntax less boring
Benja Fallenstein
benja.fallenstein at gmail.com
Sun Jun 17 01:06:33 EEST 2007
Sun Jun 17 01:06:21 EEST 2007 Benja Fallenstein <benja.fallenstein at gmail.com>
* twids to make potion URI syntax less boring
diff -rN -u old-fenserve/fendata/Potions.hs new-fenserve/fendata/Potions.hs
--- old-fenserve/fendata/Potions.hs 2007-06-17 01:06:33.000000000 +0300
+++ new-fenserve/fendata/Potions.hs 2007-06-17 01:06:33.000000000 +0300
@@ -42,10 +42,14 @@
Exp name (fromSExps args :: t)
otherCase :: (?db :: DB, ?time :: Int64, Data a) => SExp -> a
- otherCase (SExp name args) =
- fix $ \r -> snd $ gunfold k (\x -> (args, x)) $ c (dataTypeOf r) where
+ otherCase (SExp name args) = fix $ \r -> f (dataTypeOf r) where
+ f t | name == "" && dataTypeName t == "Prelude.[]" =
+ case args of [] -> otherCase (SExp "[]" [])
+ (x:xs) -> otherCase (SExp "(:)" [x, SExp "" xs])
+ f t = snd $ gunfold k (\x -> (args, x)) c where
k (x:xs, f) = (xs, f $ fromSExp x)
- c t = fromMaybe (error $ "not found: "++name) $ readConstr t name
+ c | name == "" && maxConstrIndex t == 1 = indexConstr t 1
+ | True = fromMaybe (error $ "not found: "++name) $ readConstr t name
readExp = fromSExp . head . fst . f z where
z = SExp "" []; f e "" = ([e], ""); f e (')':cs) = ([e], cs)
More information about the Fencommits
mailing list