Skip to content

Instantly share code, notes, and snippets.

Avatar

Josh Cough joshcough

View GitHub Profile
View Test.hs
import Control.Monad.RWS.Lazy
data Action = Fail | Proceed
data Command = Command1 | Command2
newtype MyState = MyState Int
-- step function that might do some IO while processing Commands
-- such as going to the database before producing an Action and the next State
stepM :: Monad m => MyState -> Command -> m (Action, Maybe MyState)
stepM = undefined
View gist:2c0cc66fc63f856f70d71928d5834961
class Monad m => FilesDb m where
insertFile :: DbTeamId -> DbFolderId -> Text -> m (Entity DbFile)
insertFolder :: DbTeamId -> DbFolderId -> Text -> m (Key DbFolder)
getRootFolder :: DbTeamId -> m (Maybe (Folder (Entity DbFile)))
getFile :: DbFileId -> m (Maybe (Entity DbFile))
-- | Purposely doesn't fetch the children, because we don't want to use recursion right now.
getFolder :: DbFolderId -> m (Maybe (Folder (Entity DbFile)))
getFolderRecursive :: DbFolderId -> m (Maybe (Folder (Entity DbFile)))
deleteFile :: DbFileId -> m ()
deleteFolder :: DbFolderId -> m ()
View gist:9b9f755ecda8d0f3a722dd883dd476ac
path :: [Text] -> Traversal' Value Value
path = alaf Endo foldMap key
• Couldn't match type ‘Maybe Value’ with ‘Value’
Expected type: [Text] -> (Value -> f Value) -> Value -> f Value
Actual type: [Text]
-> Unwrapped (Endo (Maybe Value -> f (Maybe Value)))
• In the expression: alaf Endo foldMap key
In an equation for ‘path’: path = alaf Endo foldMap key
|
View ff-class-combos.json
{
"0": ["BB","BB","BB","BB"],
"1": ["BB","BB","BB","BM"],
"2": ["BB","BB","BB","F"],
"3": ["BB","BB","BB","RM"],
"4": ["BB","BB","BB","T"],
"5": ["BB","BB","BB","WM"],
"6": ["BB","BB","BM","BM"],
"7": ["BB","BB","BM","F"],
"8": ["BB","BB","BM","RM"],
View gist:2690abfc7b63e4f72e0147f3cb4bad34
Prelude> import Data.List
Prelude Data.List> let classes = ["WM", "BM", "RM", "F", "T", "N"]
Prelude Data.List> sort . nub . fmap sort $ do {a<-classes; b<-classes; c<-classes; d<-classes; return [a,b,c,d]}
[["BM","BM","BM","BM"],["BM","BM","BM","F"],["BM","BM","BM","N"],["BM","BM","BM","RM"],["BM","BM","BM","T"],["BM","BM","BM","WM"],["BM","BM","F","F"],["BM","BM","F","N"],["BM","BM","F","RM"],["BM","BM","F","T"],["BM","BM","F","WM"],["BM","BM","N","N"],["BM","BM","N","RM"],["BM","BM","N","T"],["BM","BM","N","WM"],["BM","BM","RM","RM"],["BM","BM","RM","T"],["BM","BM","RM","WM"],["BM","BM","T","T"],["BM","BM","T","WM"],["BM","BM","WM","WM"],["BM","F","F","F"],["BM","F","F","N"],["BM","F","F","RM"],["BM","F","F","T"],["BM","F","F","WM"],["BM","F","N","N"],["BM","F","N","RM"],["BM","F","N","T"],["BM","F","N","WM"],["BM","F","RM","RM"],["BM","F","RM","T"],["BM","F","RM","WM"],["BM","F","T","T"],["BM","F","T","WM"],["BM","F","WM","WM"],["BM","N","N","N"],["BM","N","N","RM"],["BM","N","N","T"],["BM","N","N","WM"],
View gist:30c23cf0956637c99f5b8a0a58ea5a78
object JNumber {
def apply(value: BigDecimal): JNumber = JNumber(value.toString)
def apply(value: BigInt): JNumber = JNumber(value.toString)
def apply(value: Byte): JNumber = JNumber(value.toString)
def apply(value: Double): JNumber = JNumber(value.toString)
def apply(value: Float): JNumber = JNumber(value.toString)
def apply(value: Int): JNumber = JNumber(value.toInt.toString)
def apply(value: Integer): JNumber = JNumber(value.toString)
def apply(value: Long): JNumber = JNumber(value.toString)
View BoolOp.hs
{-# LANGUAGE DeriveFunctor #-}
{-# LANGUAGE DeriveFoldable #-}
{-# LANGUAGE DeriveTraversable #-}
-- |
module Flare.AST.BoolOp where
import Control.Monad
import Control.Monad.Trans
import Data.List (intersperse)
View Board.hs.diff
diff --git a/src/Scrabble/Board/Board.hs b/src/Scrabble/Board/Board.hs
index 7741e22..a847ed1 100644
--- a/src/Scrabble/Board/Board.hs
+++ b/src/Scrabble/Board/Board.hs
@@ -25,30 +25,31 @@ module Scrabble.Board.Board
import Data.Aeson (ToJSON, FromJSON, toJSON, parseJSON, withArray)
import Data.Array (Array, listArray)
-import qualified Data.Array as A
+import Data.Bifunctor (second)
View boston-haskell-calendar.txt
April Talk 1: Austin Seipp
April Talk 2: ? (maybe lightning talks, or book someone else)
May Talk 1: Fere (François-René ÐVB Rideau)
May Talk 2: ? (maybe lightning talks, or book someone else)
June Talk 1: Maybe Nathan Howell (but possibly some other month, Ed needs to follow up)
June Talk 2 ?
Later:
View ip1.hs
{-# LANGUAGE GADTs, ConstraintKinds, Rank2Types, ImplicitParams #-}
data Rec fields where
Rec :: fields => Rec fields
infixr 1 ?
(?) :: Rec fields -> (fields => r) -> r
Rec ? e = e
record :: Rec (?a :: Int, ?b :: String)
You can’t perform that action at this time.