Skip to content

Instantly share code, notes, and snippets.

@projectivemotion
projectivemotion / Advanced Bash Usage CheatSheet.md
Last active August 25, 2018 16:28
Cheatsheet of advanced bash commands presented in Introduction to Advanced Bash Usage - James Pannacciulli. Youtube: https://youtu.be/uqHjc7hlqd0
@chpatrick
chpatrick / Bake.hs
Last active September 15, 2018 04:20
Baked-in Storable Vectors Mark II
{-# LANGUAGE MagicHash, TupleSections, TemplateHaskell #-}
module Data.Vector.Storable.Bake(bake, unsafeFromAddrLen) where
import Data.Typeable
import qualified Data.Vector.Storable as VS
import Foreign
import GHC.Prim
import GHC.Ptr
import Language.Haskell.TH
@3noch
3noch / .ghci
Last active October 29, 2018 09:49
Reflex-DOM Auto Reload Development with ghcid
:set prompt "> "
:set -isrc
:load Main
@yihuang
yihuang / observer.hs
Created August 6, 2012 14:55
observer pattern in haskell
{-# LANGUAGE ScopedTypeVariables #-}
import qualified Data.IntMap as M
import Data.IORef
import Data.Unique
{--
- listen :: Event a -> (a -> IO ()) -> IO ()
- fire :: Event a -> a -> IO ()
-}
@mrkgnao
mrkgnao / Eftee.hs
Last active September 23, 2019 15:43
An "optimized" version of ElvishJerricco's free arrow type
{-# LANGUAGE Arrows #-}
{-# LANGUAGE ConstraintKinds #-}
{-# LANGUAGE FlexibleContexts #-}
{-# LANGUAGE FlexibleInstances #-}
{-# LANGUAGE GADTs #-}
{-# LANGUAGE InstanceSigs #-}
{-# LANGUAGE LambdaCase #-}
{-# LANGUAGE MultiParamTypeClasses #-}
{-# LANGUAGE RankNTypes #-}
{-# LANGUAGE ScopedTypeVariables #-}
@dysinger
dysinger / packages.el
Last active January 16, 2021 19:30
Private spacemacs layer to try out Chris Done's Intero mode for haskell
;; 1. place this in ~/.emacs.d/private/intero/packages.el
;; 2. add intero, syntax-checking and auto-completion to your
;; ~/.spacemacs layer configuration & remove the haskell layer
;; if you were using that before
;; 3. make sure you have stack installed http://haskellstack.org
;; 4. fire up emacs & open up a stack project's source files
@CMCDragonkai
CMCDragonkai / haskell_numeric_typeclasses.md
Last active February 23, 2022 23:44
Haskell: Numeric Typeclasses - How numbers work!

Numeric Typeclasses - How numbers work!

Numbers in Haskell are typed of course. They also exist as instances of a numeric typeclass hierarchy. I was confused with converting and working with numbers of different types, and not being sure which functions were polymorphic and could work with different numeric types. So I created a little diagram. Do note that the typeclass hierarchy of Haskell actually does somewhat follow the hierarchy of numbers in Math.

@chrisdone
chrisdone / hoogle.md
Last active September 6, 2022 20:33
stack hoogle

Introducing the stack hoogle feature!

With the release of hoogle5, we can now hoogle all local packages.

This let us implement stack hoogle, which is on the master branch of stack, but is not yet on a stack release. We'd like you to try it out before we do!

To upgrade to the latest stack from git, use:

@Teggy
Teggy / four-solutions-to-a-trivial-problem.hs
Last active September 23, 2022 21:44
A Haskell "transcript" of Guy Steele's talk "Four Solutions to a Trivial Problem" (https://www.youtube.com/watch?v=ftcIcn8AmSY)
{-# LANGUAGE TypeSynonymInstances #-}
import Data.Monoid
import Data.Maybe
-- How much water does a "histogram" hold?
--
-- Inspired by Guy Steele's talk "Four Solutions to a Trivial Problem"
-- https://www.youtube.com/watch?v=ftcIcn8AmSY
@phadej
phadej / overlap.hs
Created July 1, 2016 09:56
OverlappingInstance workarounds
{-# LANGUAGE CPP #-}
{-# LANGUAGE ScopedTypeVariables #-}
{-# LANGUAGE FlexibleInstances, FlexibleContexts #-}
{-# LANGUAGE DataKinds, GADTs, KindSignatures, TypeOperators, UndecidableInstances #-}
#if __GLASGOW_HASKELL__ < 708
#error "requires GHC 7.10 or newer"
#endif
module Main (main) where