1{-# LANGUAGE OverloadedStrings #-}
3import Control.Applicative ((<$>), (<*>), empty)
5import qualified Data.ByteString.Lazy.Char8 as BL
7data Coord = Coord { x :: Double, y :: Double }
10-- A ToJSON instance allows us to encode a value as JSON.
12instance ToJSON Coord where
13 toJSON (Coord xV yV) = object [ "x" .= xV,
16-- A FromJSON instance allows us to decode a value from JSON. This
17-- should match the format used by the ToJSON instance.
19instance FromJSON Coord where
20 parseJSON (Object v) = Coord <$>
27 let req = decode "{\"x\":3.0,\"y\":-1.0}" :: Maybe Coord
29 let reply = Coord 123.4 20
30 BL.putStrLn (encode reply)
keysesc to close
- j k
- move down, up
- enter
- open
- esc
- back, or up a level
- 1 2 3 4
- readme, files, commits, refs
- /
- filter
- y
- copy the clone command
- c
- compare the chosen commit with another (or shift-click both)
- ?
- show or hide this list