Skip to content
This repository has been archived by the owner on Mar 4, 2023. It is now read-only.

Commit

Permalink
move json helper functions into Utils.hs
Browse files Browse the repository at this point in the history
  • Loading branch information
MarcWeber committed Jul 26, 2009
1 parent e067cd6 commit f82826e
Show file tree
Hide file tree
Showing 3 changed files with 16 additions and 10 deletions.
15 changes: 15 additions & 0 deletions lib/Scion/Utils.hs
Original file line number Original file line Diff line number Diff line change
Expand Up @@ -25,6 +25,8 @@ import Data.Maybe ( fromMaybe )


import Data.Char (isLower, isUpper) import Data.Char (isLower, isUpper)


import Text.JSON

thingsAroundPoint :: (Int, Int) -> [Located n] -> [Located n] thingsAroundPoint :: (Int, Int) -> [Located n] -> [Located n]
thingsAroundPoint pt ls = [ l | l <- ls, spans (getLoc l) pt ] thingsAroundPoint pt ls = [ l | l <- ls, spans (getLoc l) pt ]


Expand Down Expand Up @@ -58,6 +60,19 @@ ifM cm tm em = do
c <- cm c <- cm
if c then tm else em if c then tm else em



------------------------------------------------------------------------
-- JSON helper functions

lookupKey :: JSON a => JSObject JSValue -> String -> Result a
lookupKey = flip valFromObj

makeObject :: [(String, JSValue)] -> JSValue
makeObject = makeObj

------------------------------------------------------------------------------


-- an alternative to the broken Fuzzy module -- an alternative to the broken Fuzzy module
-- match sH simpleHTTP -- match sH simpleHTTP
-- match siH simpleHTTP -- match siH simpleHTTP
Expand Down
1 change: 1 addition & 0 deletions lib/scion.cabal
Original file line number Original file line Diff line number Diff line change
Expand Up @@ -28,6 +28,7 @@ library
uniplate == 1.2.*, uniplate == 1.2.*,
time == 1.1.*, time == 1.1.*,
filepath == 1.1.*, filepath == 1.1.*,
json == 0.4.*,
multiset == 0.1.* multiset == 0.1.*
hs-source-dirs: . hs-source-dirs: .
extensions: CPP, PatternGuards extensions: CPP, PatternGuards
Expand Down
10 changes: 0 additions & 10 deletions server/Scion/Server/Commands.hs
Original file line number Original file line Diff line number Diff line change
Expand Up @@ -59,16 +59,6 @@ import Packages ( pkgIdMap )
import Distribution.InstalledPackageInfo import Distribution.InstalledPackageInfo
#endif #endif


------------------------------------------------------------------------

lookupKey :: JSON a => JSObject JSValue -> String -> Result a
lookupKey = flip valFromObj

makeObject :: [(String, JSValue)] -> JSValue
makeObject = makeObj

------------------------------------------------------------------------------

type KeepGoing = Bool type KeepGoing = Bool


-- a scion request is JS object with 3 keys: -- a scion request is JS object with 3 keys:
Expand Down

0 comments on commit f82826e

Please sign in to comment.