This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
{-# LANGUAGE DataKinds #-} | |
{-# LANGUAGE GADTs #-} | |
{-# LANGUAGE StandaloneDeriving #-} | |
{-# LANGUAGE TypeOperators #-} | |
-- https://stackoverflow.com/questions/27831223/simply-typed-lambda-calculus-with-failure-in-haskell | |
-- https://www.youtube.com/watch?v=6snteFntvjM | |
module General where |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
{-# LANGUAGE DataKinds #-} | |
{-# LANGUAGE GADTs #-} | |
{-# LANGUAGE RankNTypes #-} | |
{-# LANGUAGE StandaloneDeriving #-} | |
{-# LANGUAGE TypeOperators #-} | |
-- https://stackoverflow.com/questions/27831223/simply-typed-lambda-calculus-with-failure-in-haskell | |
-- https://www.youtube.com/watch?v=6snteFntvjM | |
-- https://github.com/goldfirere/glambda/blob/master/src/Language/Glambda/Type.hs | |
-- https://github.com/goldfirere/glambda/blob/master/src/Language/Glambda/Check.hs |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
module Tree where | |
-- https://crypto.stanford.edu/~blynn/lambda/hm.html | |
-- http://hackage.haskell.org/package/base-4.12.0.0/docs/src/Control.Arrow.html#Arrow | |
import Control.Arrow ((***)) | |
import Control.Monad (join) | |
import Control.Monad.State | |
import Text.Parsec hiding (State) | |
import Text.Parsec.String (Parser) |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
module Infer where | |
-- https://crypto.stanford.edu/~blynn/lambda/hm.html | |
import Control.Monad.Reader | |
import Control.Monad.State | |
import Data.List (elemIndex) | |
import Safe (atMay) |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
-- This doesn't work correctly. | |
{-# LANGUAGE BlockArguments #-} | |
{-# LANGUAGE DeriveFoldable #-} | |
{-# LANGUAGE DeriveFunctor #-} | |
{-# LANGUAGE DeriveTraversable #-} | |
{-# LANGUAGE FlexibleInstances #-} | |
{-# LANGUAGE LambdaCase #-} | |
{-# LANGUAGE StandaloneDeriving #-} | |
{-# LANGUAGE TypeSynonymInstances #-} |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
:set prompt "\x03bb> " | |
:set prompt-cont " " | |
:set -Wall | |
:set -Wcompat | |
:set -Wincomplete-record-updates | |
:set -Wincomplete-uni-patterns | |
:set -Wno-name-shadowing | |
:set -Wredundant-constraints |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
{-# LANGUAGE DeriveAnyClass #-} | |
{-# LANGUAGE DeriveFunctor #-} | |
{-# LANGUAGE DeriveGeneric #-} | |
{-# LANGUAGE DeriveTraversable #-} | |
{-# LANGUAGE FlexibleInstances #-} | |
{-# LANGUAGE MultiParamTypeClasses #-} | |
module Librarian where | |
import Control.Monad.Except |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
-- https://crypto.stanford.edu/~blynn/lambda/pcf.html | |
-- http://dev.stephendiehl.com/fun/006_hindley_milner.html | |
-- https://en.wikipedia.org/wiki/Hindley–Milner_type_system#Free_type_variables | |
-- https://en.wikipedia.org/wiki/Hindley–Milner_type_system#Algorithm_J | |
module Let where | |
import Control.Monad.Except | |
import Control.Monad.Reader | |
import Control.Monad.State |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
module Math where | |
import Text.Parsec | |
import Text.Parsec.String | |
data Expr | |
= Num Integer | |
| Op Op Expr Expr | |
deriving Show |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
-- https://www.youtube.com/watch?v=AT4JJm_ujRg | |
-- https://en.wikiversity.org/wiki/Foundations_of_Functional_Programming/Pure_type_systems | |
module Hal where | |
import Control.Monad | |
import Data.Set | |
type Name = String |