This file contains 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
# BQN syntax highlighting using ANSI for Discord | |
# functions | |
fsyms ← "+-×÷⋆√⌊⌈∧∨¬|≤<>≥=≠≡≢⊣⊢⥊∾≍⋈↑↓↕«»⌽⍉/⍋⍒⊏⊑⊐⊒∊⍷⊔!𝕎𝕏𝔽𝔾𝕊" | |
# constants | |
csyms ← "·¯π∞" ∾ '0'+↕10 | |
# 1-modifiers | |
omsyms ← "˙˜˘¨⌜⁼´˝`𝕣" | |
# 2-modifiers | |
tmsyms ← "∘○⊸⟜⌾⊘◶⎊⎉⚇⍟" | |
# special symbols |
This file contains 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 LambdaCase #-} | |
module MoleculeToAtoms (parseMolecule) where | |
import Control.Applicative (Alternative (..), liftA2, optional) | |
import Control.Lens.Internal.Level (Deepening (runDeepening)) | |
import Control.Monad ((>=>)) | |
import Data.Char (isDigit, isLower, isUpper) | |
import Data.Either.Combinators (maybeToRight) | |
import Data.HashMap.Strict.InsOrd qualified as Map |
This file contains 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
||| An implementation of an extensible effect system based on freer monads | |
||| which leverages dependent types to enforce invariants in a type safe manner. | |
||| Sources: | |
||| - https://okmij.org/ftp/Haskell/extensible/more.pdf | |
||| - https://hackage.haskell.org/package/freer-simple-1.2.1.2 | |
module Eff | |
%default total | |
||| A proof that the type constructor `f` is a member of the |
This file contains 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 InstanceSigs #-} | |
module Comonad where | |
import Data.Map (Map) | |
import qualified Data.Map as M | |
import Data.List.NonEmpty (NonEmpty (..)) | |
import qualified Data.List.NonEmpty as NE |
This file contains 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
||| Calculating Dependently-Typed Compilers | |
||| Sources: | |
||| - https://dl.acm.org/doi/pdf/10.1145/3473587 | |
||| - https://www.youtube.com/watch?v=4GkGNPXOmC8 | |
||| - https://cs.nott.ac.uk/~psymp4/files/dependently-typed-compilers.zip | |
import Data.Nat | |
%default total |
This file contains 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 : Graphics.SDL.Internal.Interact | |
License : GNU GPL, version 3 or above | |
Maintainer : skykanin <3789764+skykanin@users.noreply.github.com> | |
Stability : alpha | |
Portability : portable | |
Module for the internal rendering loop logic | |
-} | |
module Graphics.SDL.Internal.Interact (interact) where |
This file contains 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 NoImplicitPrelude #-} | |
module Rings where | |
import Data.Bool ((||)) | |
import Data.Int (Int) | |
import Data.Eq (Eq, (==)) | |
import Data.Ord (Ord, (>=)) | |
-- | For types that support an addition and multiplication operation | |
class Semiring a where |
This file contains 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
import Data.Nat | |
import Prelude | |
%hide reverse | |
reverse : List a -> List a | |
reverse [] = [] | |
reverse (x :: xs) = reverse xs ++ [x] | |
testRev1 : reverse (reverse [1, 2, 3]) = [1, 2, 3] |
This file contains 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
interface Semigroup<M> { | |
fun binary(a: M, b: M): M | |
} | |
interface Monoid<M>: Semigroup<M> { | |
val neutral: M | |
} | |
fun <A, M> foldMap(m: Monoid<M>, f: (A) -> M, list: List<A>): M = | |
list.map(f).fold(m.neutral, m::binary) |
This file contains 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
interface Semigroup<A> { | |
binary: (a: A, b: A) => A | |
} | |
interface Monoid<A> extends Semigroup<A> { | |
neutral: A | |
} | |
function foldMap<A, M>(m: Monoid<M>, f: (a: A) => M, list: A[]): M { | |
return list.map(f).reduce(m.binary, m.neutral) |
NewerOlder