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 NoImplicitPrelude #-} | |
{-# LANGUAGE OverloadedStrings #-} | |
module Fizz where | |
import Protolude | |
fizzBuzz :: IO () | |
fizzBuzz = run fizzBuzzRules |
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
data MessageType | |
= Info | |
| Warning | |
| Error Int | |
deriving (Eq, Show) | |
type TimeStamp = Int | |
type LogMessage = Either String Message |
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 Fx | |
-- Just playing around with implementing my own free effects system in Iris | |
-- while watching https://www.youtube.com/watch?v=kIwd1D9m1gE | |
import Data.IORef | |
-- ================================================================ -- | |
-- CrapMap | |
-- ================================================================ -- |
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
main :: IO () | |
main = mapM_ putStrLn beerLines | |
where | |
beerLines = concatMap genLines [99, 98..1] | |
genLines n = | |
[ firstLine n | |
, "Take one down, pass it around, " ++ suffix n | |
] |
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 ExistentialQuantification #-} | |
{-# LANGUAGE FlexibleContexts #-} | |
{-# LANGUAGE GADTs #-} | |
{-# LANGUAGE KindSignatures #-} | |
{-# LANGUAGE LambdaCase #-} | |
{-# LANGUAGE NoImplicitPrelude #-} | |
{-# LANGUAGE OverloadedStrings #-} | |
{-# LANGUAGE RankNTypes #-} | |
{-# LANGUAGE ScopedTypeVariables #-} |
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
data Suit = Spades | Hearts | Clubs | Diamonds | |
deriving Show | |
data Rank = Ace | Two | Three | Four | Five | Six | Seven | |
| Eight | Nine | Ten | Jack | Queen | King | |
deriving Show | |
data Card = Card | |
{ rank :: Rank |
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 STMRace where | |
import Control.Concurrent ( threadDelay ) | |
import Control.Concurrent.Async ( Async | |
, async | |
, cancel | |
, wait | |
) | |
import Control.Concurrent.MVar ( MVar | |
, newMVar |
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 STMRace where | |
import Control.Concurrent ( threadDelay ) | |
import Control.Concurrent.Async ( async | |
, cancel | |
, wait | |
) | |
import Control.Concurrent.MVar ( MVar | |
, newMVar | |
, withMVar |
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 DeriveGeneric #-} | |
{-# LANGUAGE DeriveAnyClass #-} | |
{-# LANGUAGE DataKinds #-} | |
{-# LANGUAGE GADTs #-} | |
{-# LANGUAGE TypeApplications #-} | |
{-# LANGUAGE OverloadedStrings #-} | |
{-# OPTIONS_GHC -fno-warn-unused-imports #-} | |
{-# OPTIONS_GHC -fno-warn-name-shadowing #-} | |
{-# OPTIONS_GHC -fno-warn-unused-matches #-} |
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 FlexibleContexts #-} | |
{-# LANGUAGE OverloadedStrings #-} | |
{-# LANGUAGE TemplateHaskell #-} | |
module Wcs2 where | |
import qualified Streaming.Prelude as S | |
import Control.Lens ( (+~) | |
, (^.) |