1{-# LANGUAGE OverloadedStrings #-}
2{-# LANGUAGE RecordWildCards #-}
4module Main (main) where
9import Control.Applicative (empty)
12import qualified Data.ByteString.Lazy.Char8 as BL
14data Coord = Coord { x :: Double, y :: Double }
17-- A ToJSON instance allows us to encode a value as JSON.
19instance ToJSON Coord where
20 toJSON (Coord xV yV) = object [ "x" .= xV,
23 toEncoding Coord{..} = pairs $
27-- A FromJSON instance allows us to decode a value from JSON. This
28-- should match the format used by the ToJSON instance.
30instance FromJSON Coord where
31 parseJSON (Object v) = Coord <$>
38 let req = decode "{\"x\":3.0,\"y\":-1.0}" :: Maybe Coord
40 let reply = Coord 123.4 20
41 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