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
-- packages "free" and "transformers" assumed | |
{-# LANGUAGE DeriveFunctor #-} | |
module Main where | |
import Control.Monad.Trans.Free | |
import Control.Monad.Trans.Class | |
data CoroutineF a = Yield a |
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 FlexibleInstances #-} | |
{-# LANGUAGE LambdaCase #-} | |
{-# LANGUAGE MultiParamTypeClasses #-} | |
{-# LANGUAGE TypeFamilies #-} | |
{-# LANGUAGE TypeOperators #-} | |
{-# LANGUAGE TypeSynonymInstances #-} | |
module Main 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
module Utils.Concurrent (mkPipeline, launchNukes) where | |
import Control.Concurrent (threadDelay) | |
import Control.Concurrent.Async (Async, async, cancel, wait) | |
import Control.Concurrent.STM (TBQueue, atomically, newTBQueueIO, | |
readTBQueue, writeTBQueue) | |
import Control.Monad (forever, void) | |
import Control.Monad.IO.Class (MonadIO, liftIO) | |
import GHC.Natural (Natural) |
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 TypeApplications, DataKinds, KindSignatures, TypeFamilies, MultiParamTypeClasses, FunctionalDependencies, UndecidableInstances #-} | |
module Main where | |
import Data.Functor.Compose | |
import Data.Functor.Identity | |
import Data.Coerce | |
data Nat = Zero | Succ Nat |
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 { createContext, useContext, useReducer } from "react"; | |
import * as React from "react"; | |
import { render } from "react-dom"; | |
// <LibraryCode> | |
const StateContext: React.Context<[any, React.Dispatch<any>]> = createContext( | |
undefined | |
); | |
function StateProvider<S, A>({ |
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 Main where | |
-- from "monoidal-containers" package | |
import qualified Data.IntMap.Monoidal.Strict as M | |
-- The thing with this IntMap is that whenever | |
-- its elements form a semigroup, the IntMaps | |
-- containing those elements themselves form | |
-- a monoid that works "pointwise" | |
-- Just type synonyms |
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 RecordWildCards #-} | |
module Server (talk, newServer, Server) where | |
import Control.Concurrent.Async | |
import Control.Concurrent.STM | |
import Control.Exception | |
import Control.Monad | |
import Data.Foldable (traverse_) | |
import Data.Functor (void) |
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 UndecidableInstances #-} | |
{-# LANGUAGE FlexibleInstances #-} | |
{-# LANGUAGE TypeOperators #-} | |
{-# LANGUAGE DataKinds #-} | |
{-# LANGUAGE KindSignatures #-} | |
{-# LANGUAGE RankNTypes #-} | |
{-# LANGUAGE TemplateHaskell #-} | |
{-# LANGUAGE PolyKinds #-} | |
{-# LANGUAGE GADTs #-} | |
{-# LANGUAGE ConstraintKinds #-} |
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
{ nixpkgs ? import ./nix/nixpkgs-2020-09.nix | |
, hls ? true | |
, hoogle ? true | |
}: | |
let | |
packageName = "template"; | |
overlay = self: super: { | |
myHaskellPackages = |
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.Void | |
import Text.Megaparsec | |
import Text.Megaparsec.Char | |
type Parser = Parsec Void String | |
main :: IO () | |
main = case runParser p "bruh" "\"123\", \"321\" , ," of | |
Left err -> print err | |
Right res -> print res |