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 BlockArguments #-} | |
{-# OPTIONS_GHC -Wall #-} | |
-- nix-shell -I nixpkgs=https://github.com/NixOS/nixpkgs/archive/bed08131cd29a85f19716d9351940bdc34834492.tar.gz -p 'haskellPackages.ghcWithPackages (p: [p.recursion-schemes])' | |
module Main where | |
import Control.Monad.Reader (Reader, asks, local, runReader) | |
import Data.Foldable (traverse_) | |
import Data.Functor.Base (TreeF (NodeF)) |
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
filtering :: | |
Applicative f => | |
(a -> f Bool) | |
-> List a | |
-> f (List a) | |
filtering p = | |
flip foldRight (pure Nil) $ \a fas -> | |
(\b as -> bool as (a :. as) b) <$> p a <*> fas |
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 | |
import Data.Foldable (traverse_) | |
import Data.Functor.Compose (Compose (Compose, getCompose)) | |
import Data.Map (Map) | |
import qualified Data.Map as Map | |
data Person = Person | |
{ id :: Int, | |
name :: String, |
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
{-# OPTIONS_GHC -Wall #-} | |
module Main where | |
import Control.Monad ((<=<)) | |
import Data.Maybe (listToMaybe) | |
import Numeric.Natural (Natural) | |
import System.Environment (getArgs) | |
import Text.Read (readMaybe) |
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
inputs |
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
{-# OPTIONS_GHC -Wall #-} | |
module Life where | |
import Data.Foldable (for_) | |
import Control.Comonad.Store (Comonad (..), Store, peek, peeks, store) | |
import Data.Array ((!), Array, array, bounds) | |
import Data.Bool (bool) | |
import Data.List (transpose) |
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 | |
import Control.Applicative ((<|>)) | |
import Data.Time (TimeZone, ZonedTime, utc, utcToZonedTime, zonedTimeToUTC) | |
import Data.Time.Format.ISO8601 (iso8601ParseM) | |
import System.Environment (getArgs) | |
inTimeZone :: TimeZone -> ZonedTime -> ZonedTime | |
inTimeZone timezone = utcToZonedTime timezone . zonedTimeToUTC |
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 DataKinds #-} | |
{-# LANGUAGE GeneralizedNewtypeDeriving #-} | |
{-# OPTIONS_GHC -Wall #-} | |
module IntervalSets where | |
import Control.Arrow ((&&&)) | |
import Control.Monad (filterM) | |
import Control.Monad.State (evalState, get, modify) | |
import Control.Monad.Trans.State (StateT (StateT), evalStateT) |
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 ViewComponent | |
module Styled | |
def self.included(base) | |
base.extend ClassMethods | |
end | |
module ClassMethods | |
def styled(static = [], &block) | |
@static_styles = static | |
@dynamic_styles = block |
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
<!DOCTYPE html> | |
<html> | |
<head> | |
<title>SRP</title> | |
<meta charset="utf8" /> | |
</head> | |
<body> | |
<script type="module"> | |
import { modPow } from "https://unpkg.com/[email protected]/src/main.js"; |