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 DerivingVia #-} | |
{-# LANGUAGE FunctionalDependencies #-} | |
{-# OPTIONS_GHC -Wall #-} | |
module FileSystem where | |
import Control.Applicative | |
import Control.Monad | |
import Control.Monad.State | |
import Data.Bifunctor |
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
-- Based on "Infinite sets that admit fast exhaustive search" by Martín Escardó | |
-- | |
-- | |
-- | |
-- | |
-- | |
-- | |
-- | |
-- | |
-- |
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 -fno-warn-orphans -fno-warn-unused-top-binds -fno-warn-name-shadowing #-} | |
{-# LANGUAGE FunctionalDependencies, OverloadedStrings #-} | |
import Data.List hiding (singleton) | |
import Data.Map | |
import Data.Semigroup | |
import Data.String | |
import GHC.Num.Integer qualified | |
import GHC.Real qualified | |
import Numeric.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 TypeFamilies, QuasiQuotes, MultiParamTypeClasses, TemplateHaskell, OverloadedStrings #-} | |
import Yesod | |
import Yesod.Core.Handler | |
data HelloWorld = HelloWorld | |
mkYesod "HelloWorld" [parseRoutes| | |
/ HomeR GET | |
|] |
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 Yolo.App where | |
import Yolo.Capabilities | |
app :: (Console, Database, Exception, Logging) => IO () | |
app = do | |
x1 <- loggingDivision 6 2 | |
x2 <- loggingDivision 5 0 | |
x3 <- consoleDivision |
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 DerivingVia #-} | |
-- | Basic memoization. | |
-- | |
-- Functions yielded by 'memoize' and 'memoizeRec' may continue to allocate | |
-- memory without bound as long as they remain in scope. That is, you can keep | |
-- them around in a single short-lived thread, such as responding to an HTTP | |
-- request, but if kept at top-level will cause memory leaks. Use 'runMemRec' | |
-- to free memory as soon as the result is computed (i.e. forced). | |
module Memoize (Mem, memoize, MemRec, memoizeRec, runMemRec) 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.Semigroup | |
data Fib = | |
Fib Integer Integer Integer | |
instance Semigroup Fib where | |
Fib a1 b1 c1 <> Fib a2 b2 c2 = | |
Fib (a1*a2 + b1*b2) (a1*b2 + b1*c2) (b1*b2 + c1*c2) | |
stimes = |
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
#!/bin/sh | |
# iterm_open_with - open a URL, file from CWD, full path, or path with linenumber in default app or Sublime Text if text file | |
# For usage with iTerm2: | |
# In iTerm's Preferences > Profiles > Default > Advanced > Semantic History, | |
# choose "Run command..." and enter "/your/path/to/iterm_open_with \5 \1 \2". | |
# Usage: iterm_open_with $(pwd) filename [linenumber] | |
# $(pwd) = current working directory (either use `pwd` or $PWD) | |
# filename = filename to open | |
# lineno = line number | |
pwd=$1 |
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
public final class Visitor { | |
/** Shape | |
* | |
* We wish to define a data type with exactly two variants: Circle and Rectangle. | |
* | |
* In particular, we do not want Shape to be open to extension by | |
* new kinds of variants (as would be the case with an abstract class). | |
* The reason we do not want the variants of Shape to be open to extension | |
* is because this will grant us the ability to extend the operations |
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 ExplicitForAll #-} | |
{-# LANGUAGE FlexibleInstances #-} | |
{-# LANGUAGE FunctionalDependencies #-} | |
{-# LANGUAGE NoStarIsType #-} | |
{-# LANGUAGE PolyKinds #-} | |
{-# LANGUAGE TypeFamilies #-} | |
{-# LANGUAGE TypeOperators #-} | |
{-# LANGUAGE UndecidableInstances #-} | |
module Main where |
NewerOlder