1{-# LANGUAGE BangPatterns #-}
3import Data.List (foldl')
4import System.Environment (getArgs)
5import qualified Data.ByteString.Char8 as B
6import qualified Data.ByteString.Lazy.Char8 as BL
7import qualified Data.ByteString.Lex.Double as B
8import qualified Data.ByteString.Lex.Lazy.Double as BL
9import qualified Data.Text as T
10import qualified Data.Text.Encoding as T
11import qualified Data.Text.Lazy as TL
12import qualified Data.Text.Lazy.Encoding as TL
13import qualified Data.Text.Lazy.Read as TL
14import qualified Data.Text.Read as T
16readem :: (Ord a, Num a) =>
17 IO [t] -> (t -> Either String (a,t)) -> IO ()
18readem act reader = print . foldl' go 1000000 =<< act
19 where go z t = case reader t of
21 Right (n,_) -> min n z
23bytey :: (Ord a, Num a) =>
24 IO [t] -> (t -> Maybe (a,t)) -> IO ()
25bytey act reader = print . foldl' go 1000000 =<< act
26 where go z t = case reader t of
27 Nothing -> error "barf"
32 let strict = (T.lines . T.decodeUtf8) `fmap` B.getContents
33 lazy = (TL.lines . TL.decodeUtf8) `fmap` BL.getContents
34 bs = B.lines `fmap` B.getContents
35 lbs = BL.lines `fmap` BL.getContents
37 ["dec"] -> readem strict (T.signed T.decimal :: T.Reader Int)
38 ["hex"] -> readem strict (T.signed T.hexadecimal :: T.Reader Int)
39 ["double"] -> readem strict (T.double :: T.Reader Double)
40 ["rational"] -> readem strict (T.rational :: T.Reader Double)
41 ["ldec"] -> readem lazy (TL.signed TL.decimal :: TL.Reader Int)
42 ["lhex"] -> readem lazy (TL.signed TL.hexadecimal :: TL.Reader Int)
43 ["ldouble"] -> readem lazy (TL.double :: TL.Reader Double)
44 ["lrational"] -> readem lazy (TL.rational :: TL.Reader Double)
45 ["bdec"] -> bytey bs B.readInt
46 ["bdouble"] -> bytey bs B.readDouble
47 ["bldec"] -> bytey lbs BL.readInt
48 ["bldouble"] -> bytey lbs BL.readDouble
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