Skip to content

Instantly share code, notes, and snippets.

View lgastako's full-sized avatar

John lgastako

  • Francon & Heyer
  • Milky Way Galaxy, Third Rock from the Sun
View GitHub Profile
{-# LANGUAGE NoImplicitPrelude #-}
{-# LANGUAGE OverloadedStrings #-}
module Fizz where
import Protolude
fizzBuzz :: IO ()
fizzBuzz = run fizzBuzzRules
data MessageType
= Info
| Warning
| Error Int
deriving (Eq, Show)
type TimeStamp = Int
type LogMessage = Either String Message
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
-- ================================================================ --
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
]
@lgastako
lgastako / Poker.hs
Last active January 19, 2020 00:14
{-# LANGUAGE DataKinds #-}
{-# LANGUAGE ExistentialQuantification #-}
{-# LANGUAGE FlexibleContexts #-}
{-# LANGUAGE GADTs #-}
{-# LANGUAGE KindSignatures #-}
{-# LANGUAGE LambdaCase #-}
{-# LANGUAGE NoImplicitPrelude #-}
{-# LANGUAGE OverloadedStrings #-}
{-# LANGUAGE RankNTypes #-}
{-# LANGUAGE ScopedTypeVariables #-}
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
module STMRace where
import Control.Concurrent ( threadDelay )
import Control.Concurrent.Async ( Async
, async
, cancel
, wait
)
import Control.Concurrent.MVar ( MVar
, newMVar
module STMRace where
import Control.Concurrent ( threadDelay )
import Control.Concurrent.Async ( async
, cancel
, wait
)
import Control.Concurrent.MVar ( MVar
, newMVar
, withMVar
{-# 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 #-}
{-# LANGUAGE FlexibleContexts #-}
{-# LANGUAGE OverloadedStrings #-}
{-# LANGUAGE TemplateHaskell #-}
module Wcs2 where
import qualified Streaming.Prelude as S
import Control.Lens ( (+~)
, (^.)