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
-- monadstate-example.hs | |
-- | |
-- Load this program in GHCi: | |
-- | |
-- stack repl \ | |
-- --resolver nightly \ | |
-- --package transformers \ | |
-- --package mtl \ | |
-- monadstate-example.hs | |
-- |
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
-- ghcid -c'stack repl --resolver nightly --package time' haskell-time.hs --allow-eval | |
---- | |
-- # Haskell Time Crib Sheet | |
---- | |
-- Excellent sources for this small guide include: | |
-- | |
-- * https://two-wrongs.com/haskell-time-library-tutorial.html | |
-- * https://williamyaoh.com/posts/2019-09-16-time-cheatsheet.html |
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
var danielsLensTalk = { | |
recordId: 0, | |
creation: { | |
user: 'danielbrice@gmail.com', | |
moment: { | |
date: { | |
year: 2019, | |
month: 5, | |
day: 29 | |
}, |
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
-- Inspired by http://www.csis.pace.edu/~bergin/patterns/ppoop.html | |
-- and by Rob Pike's response: https://plus.google.com/+RobPikeTheHuman/posts/hoJdanihKwb | |
import System.Info (os) | |
import Data.Map (Map, findWithDefault, fromList) | |
class AbstractOsObject a where | |
getOsString :: a -> String | |
coerce :: a -> BaseOsObject |
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 System.Environment (getArgs) | |
myApp :: [String] -> IO () | |
myApp args = | |
case args of | |
[name] -> putStrLn ("Top of the morning to you, " ++ name) | |
_ -> putStrLn "I only know how to use one argument D:" | |
main :: IO () | |
main = do |
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
{-# 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
-- 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
{-# 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 |
NewerOlder