Skip to content

Instantly share code, notes, and snippets.

Edmondo Pentangelo holoed

Block or report user

Report or block holoed

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
@holoed
holoed / bubbleSort.hs
Created Jul 27, 2017
A duality of sorts
View bubbleSort.hs
{-# LANGUAGE UndecidableInstances #-}
{-# LANGUAGE DeriveFunctor #-}
module Main where
-- Fix point
fix :: ((a -> b) -> (a -> b)) -> (a -> b)
fix f = f (fix f)
@holoed
holoed / LambdaLifting.hs
Last active Jun 1, 2016
Lambda Lifting as SLPJ - 1987 Book Page 227
View LambdaLifting.hs
{-# LANGUAGE FlexibleContexts #-}
{-# LANGUAGE UndecidableInstances #-}
{-# LANGUAGE DeriveFunctor #-}
module LambdaLifting where
import Control.Monad.Trans.Reader
import Control.Monad.Trans.Writer
import Control.Monad.State hiding (fix)
import Data.Char
View takeWhileApo.hs
{-#LANGUAGE DeriveFunctor#-}
module Main where
import Prelude hiding (takeWhile)
fix :: ((a -> b) -> a -> b) -> a -> b
fix f = f (fix f)
data Fix f = In { out :: f (Fix f) }
View ApomorphismShortcutRecursion.hs
{-#LANGUAGE DeriveFunctor#-}
module Main where
fix :: ((a -> b) -> a -> b) -> a -> b
fix f = f (fix f)
data Fix f = In { out :: f (Fix f) }
ana :: Functor f => (a -> f a) -> (a -> Fix f) -> a -> Fix f
View dropWhileCata.hs
{-#LANGUAGE DeriveFunctor#-}
module Main where
fix :: ((a -> b) -> a -> b) -> a -> b
fix f = f (fix f)
data Fix f = In { out :: f (Fix f) }
ana :: Functor f => (a -> f a) -> (a -> Fix f) -> a -> Fix f
@holoed
holoed / JsonParser.hs
Last active Mar 31, 2017
Json Parser Example
View JsonParser.hs
{-#LANGUAGE DeriveFunctor#-}
module Main where
fix :: ((a -> b) -> a -> b) -> a -> b
fix f = f (fix f)
newtype Fix f = In { out :: f (Fix f) }
type Algebra f a = f a -> a
@holoed
holoed / ParserAnamorphisms.hs
Created Mar 27, 2016
Monadic Parsers as Anamorphisms Co-Algebras
View ParserAnamorphisms.hs
{-#LANGUAGE DeriveFunctor#-}
module Main where
fix :: ((a -> b) -> a -> b) -> a -> b
fix f = f (fix f)
newtype Fix f = In { out :: f (Fix f) }
ana :: Functor f => (a -> f a) -> (a -> Fix f) -> a -> Fix f
@holoed
holoed / AnaCataFactorial.hs
Created Mar 27, 2016
Ana-Cata (Hylo) Factorial
View AnaCataFactorial.hs
{-#LANGUAGE DeriveFunctor#-}
module Main where
fix :: ((a -> b) -> a -> b) -> a -> b
fix f = f (fix f)
data Fix f = In { out :: f (Fix f) }
ana :: Functor f => (a -> f a) -> (a -> Fix f) -> a -> Fix f
@holoed
holoed / ExpTransform.hs
Last active Jan 27, 2016
Experiments in Generic Traversal of an AST
View ExpTransform.hs
{-# LANGUAGE DeriveFunctor #-}
module Compiler.Transformations.Experiments where
import Control.Monad.State
import Text.Printf
data ExpF a = Var String
| Lam [String] a
| App a a deriving (Functor)
@holoed
holoed / Cata.hs
Created Dec 20, 2015
Experiments in Cata
View Cata.hs
{-# LANGUAGE DeriveFunctor #-}
{-# LANGUAGE DeriveFoldable #-}
{-# LANGUAGE DeriveTraversable #-}
module Program where
import Data.Foldable
import Data.Traversable
import Prelude hiding (lookup)
import Control.Monad.State
You can’t perform that action at this time.