Deprecated: The each() function is deprecated. This message will be suppressed on further calls in /home/zhenxiangba/zhenxiangba.com/public_html/phproxy-improved-master/index.php on line 456
h4sh
[go: Go Back, main page]

h4sh

About

h4sh provides a set of Haskell List functions as normal unix shell commands. This allows us to use Haskell in shell scripts transparently.

Each program is generated from the function's type. The following types are supported:

    a     -> a
    a     -> [a]
    [a]   -> a
    [a]   -> Int
    [a]   -> [a]
    [[a]] -> [a]
    a     -> [a]  -> [a]
    a     -> [a]  -> [Int]
    Int   -> [a]  -> [a]
    [a]   -> [a]  -> [a]
    (a -> a)      -> a   -> a
    (a -> a)      -> a   -> [a]
    (a -> a)      -> [a] -> [a]
    (a -> a)      -> [a] -> a
    (a -> Bool)   -> [a] -> [a]
    (a -> a -> a) -> [a] -> a
    (a -> Maybe (a, a))  -> a -> [a]

The supported functions include: (!!) ($) (++) (:) (\\) concat concatMap cycle delete drop dropWhile elemIndices filter foldl foldr group head id init insert intersect intersperse iterate last length map maximum minimum nub repeat reverse show sort tail take takeWhile transpose unfoldr union words zip

Higher order functions use runtime evaluation, allowing arbitrary Haskell code to be passed to, e.g. map and filter.


Example

cons "str" f | take 4 | map sort.reverse | hd | i | filter '== "str"'

Howto

A list of handy one liners for h4sh.

Get h4sh

  • h4sh 0.2
    • darcs get --partial --set-scripts-executable http://www.cse.unsw.edu.au/~dons/code/h4sh
  • Source by web here

Project Activity