This file contains 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
--- StackTraced.hs | |
module StackTraced | |
(StackTraced.head) | |
where | |
import Debug.Trace | |
import Control.Exception | |
import System.IO.Unsafe | |
stackTrace ::SomeException -> IO a | |
stackTrace e = traceStack (show e) $ error "empty head" | |
head :: [a] -> a |
This file contains 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
kill ((x:y:ys), zs) = kill (ys, zs ++ [x]) | |
kill ([x], (_:zs)) = kill (zs, [x]) | |
kill ([x], []) = x | |
kill ([], zs) = kill (zs, []) | |
run = kill ([1..100], []) | |
> run | |
73 |
This file contains 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 TypeFamilies, UndecidableInstances #-} | |
data A = A | |
data B = B | |
data Found a = Found a | |
data NotFound = NotFound | |
type family F x | |
type instance F A = Found (Int -> Int) | |
type family FindF x where | |
FindF f = CheckFoundF (F f) | |
type family CheckFoundF res where |
This file contains 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
[1 of 1] Compiling Main ( src/Examples/table-sort.hs, dist/build/table-sort/table-sort-tmp/Main.o ) | |
*** Parser: | |
*** Renamer/typechecker: | |
*** Desugar: | |
Result size of Desugar (after optimization) | |
= {terms: 24,591, types: 551,63, coercions: 5,5} | |
src/Examples/table-sort.hs:89:17: Warning: | |
This binding for `isSelected' shadows the existing binding | |
imported from `Graphics.UI.FLTK.LowLevel.FLTKHS' at src/Examples/table-sort.hs:7:1-39 |
This file contains 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
;; Neat way of getting all Emacs functionality in Evil's insert mode | |
(defun with-evil-mode (mode key-behavior-pairs) | |
(mapcar #'(lambda (pair) | |
(define-key | |
mode | |
(car pair) | |
(cdr pair))) | |
key-behavior-pairs)) |
This file contains 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, UndecidableInstances, MultiParamTypeClasses, FunctionalDependencies, FlexibleInstances, FlexibleContexts, ScopedTypeVariables, OverlappingInstances, EmptyDataDecls #-} | |
data A a | |
data B a | |
data C a | |
data D a | |
data E a | |
data F a | |
type AToF = |
This file contains 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
import Control.Monad | |
import Text.Parsec | |
testString = unlines [ | |
"foo {", | |
" contents of foo", | |
" a stray }", | |
"}", | |
"bar {", | |
"}" |
This file contains 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, MultiParamTypeClasses, FunctionalDependencies, FlexibleInstances, UndecidableInstances, FlexibleContexts, OverlappingInstances, ScopedTypeVariables #-} | |
-- The goal of the code below is to emulate OO method dispatch. | |
-- | |
-- The use-case is binding to a C++ GUI framework that is heavily OO and | |
-- providing the user with a familiar experience. | |
-- | |
-- This scheme sketched out below emulates not only OO style method dispatch | |
-- but also allows users to "sub-class", "override" and even arbitrarily | |
-- change the type signature of overridden methods, all without touching the | |
-- original library code. |
This file contains 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
(datatype natnum | |
if (integer? X) | |
if (> X -1) | |
________________ | |
X : (natnum X); | |
(let A (+ X 1)); | |
X : (natnum X); | |
__________ |
This file contains 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
name: fltkhs | |
version: 0.1.0.0 | |
synopsis: FLTK bindings | |
description: | |
Low level bindings for the FLTK GUI toolkit. | |
license: MIT | |
license-file: LICENSEmc | |
category: UI | |
build-type: Configure | |
cabal-version: >=1.8 |
OlderNewer