summaryrefslogtreecommitdiff
path: root/src/server
diff options
context:
space:
mode:
authorkrangelov <kr.angelov@gmail.com>2021-07-26 16:52:11 +0200
committerkrangelov <kr.angelov@gmail.com>2021-07-26 16:52:11 +0200
commite47042424ee2450c69c509601ddc3c1cc8cd9a39 (patch)
tree5cfad2acca46f8c9aafa3a5f97600ae26bbe0e1c /src/server
parentecf309a28e9935923308da4b6aa2b1cc6c4b52e2 (diff)
parentd0a881f9038d2ca1620e0d95f90c297a452774d5 (diff)
Merge branch 'master' of https://github.com/GrammaticalFramework/gf-core
Diffstat (limited to 'src/server')
-rw-r--r--src/server/PGFService.hs1
-rw-r--r--src/server/URLEncoding.hs18
-rw-r--r--src/server/transfer/Fold.hs8
3 files changed, 14 insertions, 13 deletions
diff --git a/src/server/PGFService.hs b/src/server/PGFService.hs
index 3f5307571..260c2e278 100644
--- a/src/server/PGFService.hs
+++ b/src/server/PGFService.hs
@@ -1032,6 +1032,7 @@ instance JSON PGF.Trie where
showJSON (PGF.Ap f [[]]) = makeObj ["fun".=f] -- leaf
-- showJSON (PGF.Ap f [es]) = makeObj ["fun".=f,"children".=es] -- one alternative
showJSON (PGF.Ap f alts) = makeObj ["fun".=f,"alts".=alts]
+ readJSON = error "PGF.Trie.readJSON intentionally not defined"
instance JSON PGF.CId where
readJSON x = readJSON x >>= maybe (fail "Bad language.") return . PGF.readLanguage
diff --git a/src/server/URLEncoding.hs b/src/server/URLEncoding.hs
index 881ca21cd..1a8f579b2 100644
--- a/src/server/URLEncoding.hs
+++ b/src/server/URLEncoding.hs
@@ -6,9 +6,9 @@ import Data.Char (chr,digitToInt,isHexDigit)
-- | Decode hexadecimal escapes
urlDecodeUnicode :: String -> String
urlDecodeUnicode [] = ""
-urlDecodeUnicode ('%':'u':x1:x2:x3:x4:s)
+urlDecodeUnicode ('%':'u':x1:x2:x3:x4:s)
| all isHexDigit [x1,x2,x3,x4] =
- chr ( digitToInt x1 `shiftL` 12
+ chr ( digitToInt x1 `shiftL` 12
.|. digitToInt x2 `shiftL` 8
.|. digitToInt x3 `shiftL` 4
.|. digitToInt x4) : urlDecodeUnicode s
@@ -45,8 +45,8 @@ fromhex2 d1 d2 = 16*digitToInt d1+digitToInt d2
-- Repeatedly extract (and transform) values until a predicate hold. Return the list of values.
unfoldr :: (a -> (b, a)) -> (a -> Bool) -> a -> [b]
unfoldr f p x | p x = []
- | otherwise = y:unfoldr f p x'
- where (y, x') = f x
+ | otherwise = y:unfoldr f p x'
+ where (y, x') = f x
chopList :: ([a] -> (b, [a])) -> [a] -> [b]
chopList f l = unfoldr f null l
@@ -54,8 +54,8 @@ chopList f l = unfoldr f null l
breakAt :: (Eq a) => a -> [a] -> ([a], [a])
breakAt _ [] = ([], [])
breakAt x (x':xs) =
- if x == x' then
- ([], xs)
- else
- let (ys, zs) = breakAt x xs
- in (x':ys, zs)
+ if x == x' then
+ ([], xs)
+ else
+ let (ys, zs) = breakAt x xs
+ in (x':ys, zs)
diff --git a/src/server/transfer/Fold.hs b/src/server/transfer/Fold.hs
index 61f0d4b34..165e762fb 100644
--- a/src/server/transfer/Fold.hs
+++ b/src/server/transfer/Fold.hs
@@ -13,14 +13,14 @@ fold t =
case unApp t of
Just (i,[x]) ->
case M.lookup i foldable of
- Just j -> appFold j x
- _ -> mkApp i [fold x]
+ Just j -> appFold j x
+ _ -> mkApp i [fold x]
Just (i,xs) -> mkApp i $ map fold xs
_ -> t
appFold :: CId -> Tree -> Tree
-appFold j t =
+appFold j t =
case unApp t of
Just (i,[t,ts]) | isPre i "Cons" -> mkApp j [fold t, appFold j ts]
Just (i,[t,s]) | isPre i "Base" -> mkApp j [fold t, fold s]
- where isPre i s = take 4 (show i) == s \ No newline at end of file
+ where isPre i s = take 4 (show i) == s