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 GADTs #-} | |
{-# LANGUAGE GeneralizedNewtypeDeriving #-} | |
{-# LANGUAGE ScopedTypeVariables #-} | |
module Data.Relation where | |
import Control.Lens.Fold | |
import Prelude hiding (id, Num(..)) | |
import qualified Prelude as P | |
import Data.Foldable (foldlM) |
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
(??) :: b -> b -> Bool -> b | |
a ?? b = \x -> if x then a else b | |
andM :: (Monad m) => m Bool -> m Bool -> m Bool | |
andM a b = a >>= \x -> (b ?? pure x) x | |
shortCircuitOnFalse :: (Foldable t, Monad m) => t (m Bool) -> m Bool | |
shortCircuitOnFalse = foldr andM (pure True) |
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 KindSignatures #-} | |
{-# LANGUAGE PolyKinds #-} | |
class Semiring a where | |
zero :: a | |
one :: a | |
plus :: a -> a -> a | |
times :: a -> a -> a | |
class SemiringForall (f :: k -> *) 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 PolyKinds #-} | |
{-# LANGUAGE TypeOperators #-} | |
{-# LANGUAGE TypeFamilies #-} | |
module ComposeN where | |
type family FunctionType (as :: [k]) (r :: k) :: k where | |
FunctionType '[] r = r | |
FunctionType (a ': as) r = a -> FunctionType as r |
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
class (Bifunctor f) => Biapplicative f where | |
bipure :: a -> b -> f a b | |
biap :: f (a -> b) (c -> d) -> f a c -> f b d | |
class (Bifunctor l, Bifunctor r) => Bimonad l r where | |
bireturnl :: a -> l a b | |
bireturnr :: b -> r a b | |
bijoinl :: l (l a b) (r a b) -> l a b | |
bijoinr :: r (l a b) (r a b) -> r a b |
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 BangPatterns #-} | |
{-# LANGUAGE MagicHash #-} | |
{-# OPTIONS_GHC -O2 #-} | |
{-# OPTIONS_GHC -funbox-strict-fields #-} | |
{-# OPTIONS_GHC -Wall #-} | |
{-# OPTIONS_GHC -fno-warn-unused-top-binds #-} | |
module Prime (primeFast) 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
{-# OPTIONS_GHC -Wall #-} | |
module Theseus.Parser where | |
import Theseus.Lexer | |
import Theseus.Syntax | |
import Data.List as List | |
import Data.Char as Char |
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 BangPatterns #-} | |
{-# language DataKinds #-} | |
{-# language GADTs #-} | |
{-# language KindSignatures #-} | |
{-# language MagicHash #-} | |
{-# language NoImplicitPrelude #-} | |
{-# language ScopedTypeVariables #-} | |
{-# language StandaloneDeriving #-} | |
{-# language TypeFamilies #-} | |
{-# language TypeOperators #-} |
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 NoImplicitPrelude #-} | |
{-# LANGUAGE PolyKinds #-} | |
{-# LANGUAGE TypeFamilies #-} | |
module Data.Type.Ord | |
( Compare | |
, OrdCase | |
, IsEQ | |
, IsLT |
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
{ package ? "interface" , test ? false, frontend ? false }: | |
let fetchNixpkgs = import ./fetchNixpkgs.nix; | |
nixpkgs = fetchNixpkgs { | |
rev = "eb857611378576f96022867a9fd15a7a841e518c"; | |
sha256 = "0gnlxsmc7gi06dqlij1bgmcias83isldrvydw4688qpm8h4wdf44"; | |
}; | |
pkgs = import nixpkgs { config = {}; }; | |
fetch-github-json = owner: repo: path: | |
let commit = builtins.fromJSON (builtins.readFile path); |