1{-# LANGUAGE DataKinds #-}
2{-# LANGUAGE TypeFamilies #-}
3{-# LANGUAGE DeriveGeneric #-}
4{-# LANGUAGE TypeOperators #-}
5{-# LANGUAGE OverloadedStrings #-}
8import Control.Applicative
9import Control.Monad.IO.Class
11import Data.Text (Text)
18import qualified Data.Text as T
19import qualified Language.Javascript.JQuery as JQ
28randomPoint :: MonadIO m => m Point
29randomPoint = liftIO . getStdRandom $ \g ->
30 let (rx, g') = randomR (-1, 1) g
31 (ry, g'') = randomR (-1, 1) g'
39mkSearch :: Text -> [a] -> Search a
42instance ToJSON a => ToJSON (Search a)
52book :: Text -> Text -> Int -> Book
57 [ book "Paul Hudak" "The Haskell School of Expression: Learning Functional Programming through Multimedia" 2000
58 , book "Bryan O'Sullivan, Don Stewart, and John Goerzen" "Real World Haskell" 2008
59 , book "Miran Lipovača" "Learn You a Haskell for Great Good!" 2011
60 , book "Graham Hutton" "Programming in Haskell" 2007
61 , book "Simon Marlow" "Parallel and Concurrent Programming in Haskell" 2013
62 , book "Richard Bird" "Introduction to Functional Programming using Haskell" 1998
65searchBook :: Monad m => Maybe Text -> m (Search Book)
66searchBook Nothing = return (mkSearch "" books)
67searchBook (Just q) = return (mkSearch q books')
69 where books' = filter (\b -> q' `T.isInfixOf` T.toLower (author b)
70 || q' `T.isInfixOf` T.toLower (title b)
75type API = "point" :> Get '[JSON] Point
76 :<|> "books" :> QueryParam "q" Text :> Get '[JSON] (Search Book)
78type API' = API :<|> Raw
92 :<|> serveDirectory "tutorial/t9"
99 writeFile "tutorial/t9/api.js" apiJS
100 jq <- readFile =<< JQ.file
101 writeFile "tutorial/t9/jq.js" jq
104app = serve api' server'
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