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 Text.Lexer.Bikeshedding | |
{- | |
Other choices include: | |
-:, $: | |
!=>, $=> | |
:>, :$> | |
#^, *! -- not really |
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
||| Utilities functions for contitionally delaying values. | |
module Control.Delayed | |
%default total | |
||| Type-level function for a conditionally infinite type. | |
public export | |
inf : Bool -> Type -> Type | |
inf True a = Inf a | |
inf False a = a |
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
||| Recognises JSON string literals. | |
module Language.JSON.String | |
import Data.String.Extra | |
import Text.Lexer | |
import Text.Lexer.Util | |
import Text.Parser | |
%default total | |
%access private |
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 Data.String.Extra | |
%access public export | |
%default total | |
||| Remove the first `n` characters from a string. Returns the empty string if | |
||| the input string is too short. | |
drop : (n : Nat) -> (input : String) -> String | |
drop n str = substr n (length str) str |
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 Control.ChainedComparison | |
%default total | |
%access export | |
public export | |
data Direction = Ascending | Descending | |
data ComparisonChain : Direction -> Type -> Type where | |
Vacuous : ComparisonChain d ty |
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 ComparisonChain | |
%access public export | |
infixl 6 |==|, |/=| | |
infixl 6 |<|, |<=|, |>=|, |>| | |
namespace Interfaces | |
interface ChainEq ty where | |
(|==|) : ty -> ty -> Bool |
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 InfixrBooleanOps | |
%default total | |
factorial : Nat -> Integer | |
factorial Z = 1 | |
factorial (S n) = (cast (S n)) * factorial n | |
infixr 4 &&>, ||> |
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 MyModule | |
import Text.Parser | |
%hide Prelude.Applicative.(<|>) | |
%rename Text.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 NotElem | |
import Data.Vect | |
%default Total | |
NotElem : (x : a) -> Vect n a -> Type | |
NotElem x ys = Not (Elem x ys) | |
notElem : DecEq a => (x : a) -> (ys : Vect n a) -> Dec (NotElem x ys) |
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 Triv | |
import Data.Vect | |
%default total | |
triv : {x : a} -> a | |
triv {x} = x | |
oneTwoThree : (n ** Vect n Nat) |