This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
ghci> runReader (runParserT (do a <- local (+1) ask; b <- ask; pure (a,b)) "" "") 0 | |
Right (1,0) |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
(rx-define do-rx | |
(and word-start | |
(or | |
;; today/tomorrow | |
(and (group-n 1 "tom") (optional "orrow")) | |
(or (and (group-n 1 "tod") (optional "ay"))) | |
;; next <thing> | |
(and "next " | |
(group-n 2 (or "week" "month" "year"))) | |
;; in x <duration> |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/usr/bin/env hell | |
-- How to run this: | |
-- | |
-- socat TCP-LISTEN:8081,fork,reuseaddr,max-children=20 EXEC:"./handler.hell" | |
main = do | |
line <- Text.getLine | |
let content = | |
Text.concat ["<h1>Hello, World!</h1><p>This is generated by Hell.</p><pre>", line, "</pre>"] |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
(defcustom albero-width 30 | |
"Width of the albero window.") | |
(defvar albero-expanded (make-hash-table :test 'equal)) | |
(defun albero-win-config-hook () | |
(let ((w (albero-window))) | |
(when w | |
(albero-adjust-win w)))) |
bash-3.2$ ghc T.hs && ./T
[1 of 2] Compiling Main ( T.hs, T.o ) [Source file changed]
[2 of 2] Linking T [Objects changed]
(a) -> (a)
Bool
Bool
Type error
CallStack (from HasCallStack):
error, called at T.hs:126:16 in main:Main
You need to enable dom.events.asyncClipboard.clipboardItem
for it to work, via about:config
.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
(define-derived-mode shoe-mode | |
fundamental-mode "Shoe" | |
"Auto-paging shell mode.. | |
\\{shoe-mode-map}" | |
(linum-mode -1)) | |
(defconst shoe-dir "~/.shoe") | |
(defvar shoe-shell-program "/bin/bash") |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
{-# LANGUAGE GADTs #-} | |
{-# LANGUAGE OverloadedRecordDot #-} | |
{-# LANGUAGE UndecidableInstances #-} | |
module Brossa.Authorization where | |
-- brossa-specific | |
import qualified Brossa.DB.Rel8 as BrossaRel8 | |
import qualified Brossa.DB.Hasql as BrossaHasql |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
-- original from <https://www.cs.ox.ac.uk/projects/gip/school/tc.hs> but URLs don't last long in academia | |
-- | |
{-# LANGUAGE ExistentialQuantification,GADTs,TypeOperators #-} | |
-- This typechecker, written by Stephanie Weirich at Dagstuhl (Sept 04) | |
-- demonstrates that it's possible to write functions of type | |
-- tc :: String -> Term a | |
-- where Term a is our strongly-typed GADT. | |
-- That is, generate a typed term from an untyped source; Lennart | |
-- Augustsson set this as a challenge. |