Skip to content

Instantly share code, notes, and snippets.

View bristermitten's full-sized avatar

Alexander Wood bristermitten

View GitHub Profile
{-# LANGUAGE
DataKinds,
DeriveGeneric,
PolyKinds,
StandaloneDeriving,
TypeFamilies,
UndecidableInstances #-}
module T where
import Data.Kind (Constraint, Type)
@mrange
mrange / parser.fs
Last active March 18, 2021 09:40
F# simple and slow parser combinators
// Inspired by: http://www.cs.nott.ac.uk/~pszgmh/monparsing.pdf
// A Parser is a function that given a string and an index into that string
// produces a parsed value and the index of the first unparsed character in the string
type Parser<'T> = P of (string -> int -> ('T*int) option)
module Parser =
open System
// Runs the parser on a string
@luc-tielen
luc-tielen / Bad.hs
Created June 16, 2019 11:41
MultiRec in combination with "Trees That Grow" approach
{-# LANGUAGE TemplateHaskell #-}
{-# LANGUAGE GADTs #-}
{-# LANGUAGE TypeFamilies #-}
{-# LANGUAGE MultiParamTypeClasses #-}
module Bad where
import Prelude
import Data.Kind ( Type )
import Generics.MultiRec.TH