Skip to content

Instantly share code, notes, and snippets.

🦊
^_^

Dan Frumin co-dan

🦊
^_^
  • Nijmegen
Block or report user

Report or block co-dan

Hide content and notifications from this user.

Learn more about blocking users

Contact Support about this user’s behavior.

Learn more about reporting abuse

Report abuse
View GitHub Profile
@chrisdone
chrisdone / typing.md
Last active Jan 10, 2020
Typing Haskell in Haskell
View typing.md

Typing Haskell in Haskell

MARK P. JONES

Pacific Software Research Center

Department of Computer Science and Engineering

Oregon Graduate Institute of Science and Technology

@andrejbauer
andrejbauer / Bijection.md
Last active Jan 15, 2020
A bijection between numbers and pairs of numbers.
View Bijection.md

A bijection between numbers and pairs of numbers

Every once in a while I am faced with someone who denies that the rational numbers (or fractions, or pairs of integers) can be put into a bijective correspondence with natural numbers. To deal with the situation, I coded up the bijection. So now I can just say: "Really? Interesting. Please provide a pair of numbers (i,j) which is not enumerated by f, as defined in my gist." I am still waiting for a valid counter-example.

Anyhow, here is a demo of f and g at work. I am using the Python version, but a Haskell variant is included as well.

The 100-th pair is:

>>> f(100)
(10, 4)
View Main.hs
{-# LANGUAGE DataKinds, TemplateHaskell, TypeFamilies, QuasiQuotes #-}
import TICTACTOE
game :: ([tq| x o x
o o x
x |])
game = (?)
@simonmichael
simonmichael / gist:8390623
Created Jan 12, 2014
some aliases for ~/.gitconfig
View gist:8390623
[alias]
l = log -10 --pretty=tformat:'%C(yellow)%ad %Cred%h%C(bold blue)%d%Creset %s' --date=short
l2 = log -10 --pretty=tformat:'%C(yellow)%ad %Cred%h%C(bold blue)%d%Creset %s %Cgreen(%an)%Creset' --date=short
l3 = log -10 --pretty=tformat:'%Cred%h%C(bold blue)%d%Creset %s %C(yellow)%cr %Cgreen%an%Creset' --date=relative
l4 = log -10 --pretty=tformat:'%Cred%h %C(yellow)%ad %Cgreen%an%C(bold blue)%d %Creset%s' --date=short
lg = log -10 --graph --pretty=tformat:'%C(yellow)%ad %Cred%h%C(bold blue)%d%Creset %s' --date=short
lg2 = log -10 --graph --pretty=tformat:'%C(yellow)%ad %Cred%h%C(bold blue)%d%Creset %s %Cgreen(%an)%Creset' --date=short
lg3 = log -10 --graph --pretty=tformat:'%Cred%h%C(bold blue)%d%Creset %s %C(yellow)%cr %Cgreen%an%Creset' --date=relative
lg4 = log -10 --graph --pretty=tformat:'%Cred%h %C(yellow)%ad %Cgreen%an%C(bold blue)%d %Creset%s' --date=short
s = status -sb
@hdgarrood
hdgarrood / cookies.hs
Last active Feb 9, 2018
Scotty cookies example
View cookies.hs
{-# LANGUAGE OverloadedStrings #-}
import Control.Monad (forM_)
import Data.Text.Lazy (Text)
import qualified Data.Text.Lazy as T
import qualified Data.Text.Lazy.Encoding as T
import qualified Data.ByteString as BS
import qualified Data.ByteString.Lazy as BSL
import qualified Blaze.ByteString.Builder as B
@mzero
mzero / ghc-clang-wrapper
Created Oct 31, 2013
This wrapper script *should* enable GHC 7.* to work on systems with Xcode 5. To use it, drop this script somewhere, make it executable, and run.... Then follow the instructions it prints out. What it will do is, instruction you to put a copy in /usr/bin, then re-run it sudo. It will then find all your GHC 7 settings files, and patch them to make…
View ghc-clang-wrapper
#!/bin/sh
inPreprocessorMode () {
hasE=0
hasU=0
hasT=0
for arg in "$@"
do
if [ 'x-E' = "x$arg" ]; then hasE=1; fi
if [ 'x-undef' = "x$arg" ]; then hasU=1; fi
@cartazio
cartazio / xcode5-haskell-directions.md
Last active May 28, 2019
xcode 5 + OS X 10.9 mavericks GHC work around nuttiness
View xcode5-haskell-directions.md

PSA :

just use GHC for OSX https://ghcformacosx.github.io

the rest of these directions are preserved for historical purposes

TLDR version, if you have homebrew

xcode-select --install ; brew tap homebrew/versions ;   brew tap homebrew/dupes \
@kolen
kolen / gnit.geojson
Created Aug 8, 2013
Кладбища Йошкар-Олы
View gnit.geojson
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
@singpolyma
singpolyma / Cache.hs
Created Jul 18, 2013
Simple in-process key/value cache for Haskell
View Cache.hs
-- | Simple in-process key/value cache
--
-- Of course, for really simple stuff you could probably use unsafeInterleaveIO
module Cache (Cache, newCache, fromCache) where
import Control.Monad (void)
-- Could also use STM instead
import Control.Concurrent (forkIO, Chan, newChan, readChan, writeChan, MVar, newEmptyMVar, putMVar, takeMVar)
@MasseR
MasseR / endotemplates.hs
Created Feb 10, 2013
Using endo monoid, writer monad and blaze html combinators for creating a web page
View endotemplates.hs
{-# Language GeneralizedNewtypeDeriving #-}
{-# Language OverloadedStrings #-}
import Data.Monoid
import Text.Blaze.Html.Renderer.Text
import qualified Text.Blaze.Html5 as H
import qualified Text.Blaze.Html5.Attributes as A
import Text.Blaze.Html ((!), Html)
import Control.Monad.Writer
import Control.Monad.Identity
You can’t perform that action at this time.