Skip to content

Instantly share code, notes, and snippets.

View buggymcbugfix's full-sized avatar

Vilem Liepelt buggymcbugfix

View GitHub Profile
@i-am-tom
i-am-tom / Commit.hs
Created March 22, 2019 21:55
Apply your function parameters in any order, for no reason other than that you can.
{-# lAnGuAgE DataKinds #-}
{-# LaNgUaGe FlexibleInstances #-}
{-# lAnGuAgE FunctionalDependencies #-}
{-# LaNgUaGe KindSignatures #-}
{-# lAnGuAgE TypeFamilies #-}
{-# LaNgUaGe TypeOperators #-}
{-# lAnGuAgE UndecidableInstances #-}
module Commit where
import Data.Kind (Constraint, Type)
{-# LANGUAGE DeriveAnyClass #-}
{-# LANGUAGE DeriveGeneric #-}
{-# LANGUAGE NamedFieldPuns #-}
import Data.SBV
import Data.SBV.Control
import GHC.Generics (Generic)
data SIntX = SIntX { isInf :: SBool
, xVal :: SInteger
@sjoerdvisscher
sjoerdvisscher / laws.hs
Last active July 24, 2018 08:16
First class checkable laws using the free-functors package
{-# LANGUAGE
TypeFamilies
, KindSignatures
, ScopedTypeVariables
, ConstraintKinds
, FlexibleInstances
, FlexibleContexts
, DeriveGeneric
, DeriveAnyClass
, TypeApplications
{-# LANGUAGE RecordWildCards #-}
{-# LANGUAGE ScopedTypeVariables #-}
module Main where
import Control.Monad.Random.Class
import Control.Monad.Reader
import Data.Foldable (for_)
import Graphics.Rendering.Cairo hiding (x, y)
import qualified Numeric.Noise.Perlin as P
import System.Random
@dorchard
dorchard / CBNLambdaEff.hs
Last active November 15, 2018 20:40
A Haskell implementation of the categorical semantics for the effectful CBN lambda calculus
{-# LANGUAGE GADTs, TypeFamilies, EmptyDataDecls #-}
{-
A Haskell-based implementation of the monadic semantics for the
simply-typed Call-By-Name computational lambda calculus, following
Moggi's 'Computational lambda-calculus and monads' (1989) (technical report version)
but for the typed calculus (rather than untyped as in this paper).
Category theory seminar, Programming Languages and Systems group,
@tfausak
tfausak / total.hs
Last active April 2, 2024 20:16
Sums numbers on the command line.
#! /usr/bin/env stack
-- stack --resolver lts-8.15 --install-ghc script --package base
-- Usage:
-- $ echo -e "1.2 3.4\n5.6 not-a-number" | ./total.hs
-- 10.2
import Data.Maybe (mapMaybe)
import Text.Read (readMaybe)
@henrytill
henrytill / landins_knot.ml
Created March 28, 2017 20:53
Landin's Knot
(** "Landin's Knot" - implements recursion by backpatching *)
let landins_knot f =
let r = ref (fun x -> assert false) in
let fixedpoint = f (fun x -> !r x) in
r := fixedpoint;
fixedpoint
let factorial =
let g f x =
if x = 0 then
@0xjac
0xjac / private_fork.md
Last active April 19, 2024 05:20
Create a private fork of a public repository

The repository for the assignment is public and Github does not allow the creation of private forks for public repositories.

The correct way of creating a private frok by duplicating the repo is documented here.

For this assignment the commands are:

  1. Create a bare clone of the repository. (This is temporary and will be removed so just do it wherever.)

git clone --bare git@github.com:usi-systems/easytrace.git

@efcasado
efcasado / eqc.md
Last active December 16, 2023 00:07
A gentle introduction to (Erlang) QuickCheck

Erlang QuickCheck

What is QuickCheck?

QuickCheck is a language for stating properties of programs.

?FORALL(X, nat(), X*X >= 0)