Skip to content

Instantly share code, notes, and snippets.

-- 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"
@chrisdone
chrisdone / Keylogger.hs
Last active August 29, 2015 14:08
Keylogger
-- 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!"
@chrisdone
chrisdone / kmacro-start-macro-resuming-recent.el
Last active August 29, 2015 14:08
Keyboard macros resumable after C-g
;;; 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,
@chrisdone
chrisdone / typing.md
Last active March 22, 2025 09:05
Typing Haskell in Haskell

Typing Haskell in Haskell

MARK P. JONES

Pacific Software Research Center

Department of Computer Science and Engineering

Oregon Graduate Institute of Science and Technology

@chrisdone
chrisdone / AnIntro.md
Last active October 29, 2024 15:34
Statically Typed Lisp

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
@chrisdone
chrisdone / HoleyMonoid.hs
Last active November 7, 2015 10:51
HoleyMonoid monoid!
{-# 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"
--
@chrisdone
chrisdone / InfixExpressions.md
Last active July 24, 2017 23:47
Proposal: InfixExpressions language extension

Proposal: InfixExpressions language extension

Motivation

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.