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 TypeFamilies #-} | |
{-# LANGUAGE BlockArguments #-} | |
{-# LANGUAGE QuantifiedConstraints #-} | |
{-# OPTIONS_GHC -Wall #-} | |
import Data.Reify ( reifyGraph, MuRef(..), Graph(..)) | |
import Data.Function (fix) | |
import Data.IntMap.Strict qualified as Map | |
import Data.Foldable ( Foldable(toList) ) | |
import Data.Bifunctor ( Bifunctor(second) ) |
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 OverloadedStrings #-} | |
{-# LANGUAGE ScopedTypeVariables #-} | |
{-# LANGUAGE GADTs #-} | |
{-# LANGUAGE StandaloneDeriving #-} | |
{-# LANGUAGE DeriveFunctor #-} | |
{-# LANGUAGE TypeFamilies #-} | |
{-# LANGUAGE InstanceSigs #-} | |
{-# LANGUAGE RankNTypes #-} | |
{-# LANGUAGE UndecidableInstances #-} | |
{-# LANGUAGE DerivingVia #-} |
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 ExplicitNamespaces #-} | |
{-# LANGUAGE GADTs #-} | |
import Control.Applicative | |
import Data.Type.Equality ( type (:~:)(..) ) | |
import Unsafe.Coerce ( unsafeEqualityProof, UnsafeEquality(UnsafeRefl) ) | |
import Control.Monad | |
newtype Name a = Name ID | |
type ID = Int |
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
{- | |
ORIGINAL LICENSE: | |
Copyright Stéphane Laurent (c) 2023 | |
All rights reserved. | |
Redistribution and use in source and binary forms, with or without | |
modification, are permitted provided that the following conditions are met: |
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 Control.Applicative | |
import Data.List (insert, group) | |
import Test.Tasty.Bench | |
import Control.DeepSeq | |
-- only works on infinite lists | |
-- op must be lazy in its second argument | |
foldb1 :: (a -> a -> a) -> [a] -> a | |
foldb1 op = foldb' where | |
pairwise ~(x:y:rest) = op x y : pairwise rest |
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 TypeOperators, MultiParamTypeClasses, FlexibleContexts, FlexibleInstances, LambdaCase, DeriveFunctor, DataKinds, GADTs, StandaloneDeriving, NoStarIsType, TypeFamilies, StandaloneKindSignatures, PolyKinds #-} | |
{-# OPTIONS_GHC -Wno-unticked-promoted-constructors #-} | |
module EffeGS where | |
-- TODO: | |
-- * Answer-type modification | |
-- * Higher order effects | |
-- * Cas: the sum/product duality is still asymmetric | |
-- solution: session types? |
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 TypeFamilies #-} | |
{-# LANGUAGE TypeFamilyDependencies #-} | |
{-# LANGUAGE CPP #-} | |
{-# LANGUAGE RoleAnnotations #-} | |
module All (test) where | |
import Data.Kind | |
import Control.Monad.ST | |
import Control.Monad.Primitive |
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
^[^-]*(-[^-]+)*(-|[^A-Za-z])either @[(A-Za-z][^@ )]*[ )] |
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 MagicHash #-} | |
{-# LANGUAGE UnboxedTuples #-} | |
module Main (main) where | |
import Test.Tasty.Bench | |
import qualified Data.ByteString as S | |
import qualified Data.ByteString.Internal as SI |
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
-- vi:syntax=haskell | |
{-# LANGUAGE UnboxedTuples, MagicHash, TypeFamilies, StandaloneKindSignatures, RankNTypes, AllowAmbiguousTypes, ConstraintKinds, UndecidableInstances #-} | |
unit primmonad-indef where | |
signature PrimMonad where | |
import Data.Kind | |
import GHC.Prim | |
type C :: (* -> *) -> * -> Constraint | |
type family C m s | |
type PrimMonad m s = (Monad m, C m s) | |
primitive :: PrimMonad m s => (State# s -> (# State# s, a #)) -> m a |