2module ExtractNoscript (extract) where
5import List (isPrefixOf)
9extract' expr = makeLinks terms where
17 Binop op e1 e2 -> case (op, extract' e1, extract' e2) of
18 ("++", [s1], [s2]) -> [ s1 ++ s2 ]
19 (_ , ss1 , ss2 ) -> ss1 ++ ss2
20 Lambda v e -> extract' e
21 App e1 e2 -> extract' e1 ++ extract' e2
22 If eb et ef -> extract' et ++ extract' ef
23 Lift f es -> extract' f ++ concatMap extract es
24 Fold e1 e2 e3 -> concatMap extract' [e1,e2,e3]
27 Let defs e -> concatMap (extract' . snd) defs ++ extract' e
29 Case e cases -> concatMap (extract' . snd) cases
30 Data _ _ -> [toString expr]
32toString (Data "Cons" [Chr c, t]) = c : toString t
35makeLinks (a:b:[]) = linkify a b
38linkish s = not (isPrefixOf "<a" s) && all (/=' ') s && any (=='/') s
41 | linkish a = [ "<a href=\"" ++ a ++ "\">" ++ b ++ "</a>" ]
42 | linkish b = [ "<a href=\"" ++ b ++ "\">" ++ a ++ "</a>" ]
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