MARK P. JONES
Pacific Software Research Center
Department of Computer Science and Engineering
Oregon Graduate Institute of Science and Technology
-- Compile with | |
-- | |
-- ghc --make Status.hs -o ~/.cabal/bin/projects -O2 -threaded | |
-- | |
-- Or run with: | |
-- | |
-- runhaskell Status.hs | |
-- | |
import Control.Applicative |
import Data.Conduit.Shell | |
import qualified Data.Conduit.Shell.Segments as SH | |
main = | |
run (do hsenv | |
cur:_ <- SH.strings latestStackage | |
sed ("s/remote-repo:.*/remote-repo: stackage:http:\\/\\/www.stackage.org\\/stackage\\/" ++ | |
cur ++ "/") | |
".hsenv/cabal/config" | |
"-i" |
-- Simple keylogger | |
-- | |
-- Compile & install | |
-- | |
-- ghc --make Keylog.hs -O2 -threaded -o xinput-keylogger | |
-- sudo mv xinput-keylogger /usr/local/bin | |
-- | |
-- Storage (for security) | |
-- | |
-- $ sudo useradd xinput |
foo = [Extender moduleHead,Extender exportList] | |
-- everything after is messed up | |
indentSpaces = putStrLn = "Hello!" |
;;; kmacro.el --- Enhancement to kmacro recording. | |
;; Copyright (c) 2014 Chris Done. All rights reserved. | |
;; This file is free software; you can redistribute it and/or modify | |
;; it under the terms of the GNU General Public License as published by | |
;; the Free Software Foundation; either version 3, or (at your option) | |
;; any later version. | |
;; This file is distributed in the hope that it will be useful, |
Basic unit type:
λ> replTy "()"
() :: ()
Basic functions:
import Data.Conduit.Shell | |
import qualified Data.Conduit.Shell.Segments as SH | |
import System.Environment | |
main = | |
do args <- getArgs | |
case args of | |
[user] -> | |
do pos:_ <- run (SH.strings (posConduit user)) | |
putStrLn pos |
{-# LANGUAGE FlexibleInstances #-} | |
-- | Monoids with holes. The 'HoleyMonoid' allows building monoidal values of which certain components are to be filled in later. For example: | |
-- | |
-- > > let holey = now "x = " | |
-- > . later show | |
-- > . now ", y = " | |
-- > . later show | |
-- > > run holey 3 5 | |
-- > "x = 3, y = 5" | |
-- |
It's common for Haskellers to have combining functions where the
arguments to each combinator changes the overall type. Writing out
combine x (combine y z)
gets old, and the heterogenous types means
that we can't use a simple foldr
/foldl
, so we invent e.g. x % y % z
. The problem with this for me is that it introduces its own
redundancy and viewing/editing overhead.