Skip to content

Instantly share code, notes, and snippets.

{-# LANGUAGE DeriveGeneric #-}
module Bar where
-- import Data.List
import qualified Data.Sequence as S
import GHC.Generics
import Data.Foldable
import Data.Monoid
import System.IO
import qualified Data.ByteString as B
@smurphy8
smurphy8 / haskell-modbus
Last active March 5, 2018 17:03
using haskell-modbus over network.
{-# LANGUAGE NoImplicitPrelude, OverloadedStrings, RankNTypes #-}
module ModTest where
import Data.Modbus
import Conduit
import CorePrelude hiding (ByteString)
-- import Control.Concurrent.Async (Concurrently (..))
import qualified Data.ByteString.Lazy as BL
import qualified Data.ByteString as B
import Data.Modbus
@smurphy8
smurphy8 / gist:025ddfc496b9118c159c
Created May 1, 2014 03:04
Indexed StateMonad Experiment
{-# LANGUAGE OverloadedStrings , NoImplicitPrelude #-}
module StateMachine where
import Control.Monad.Indexed
import CorePrelude
{- | This is my short example of creating an indexed state Monad
Indexed State Monad are different from the standard state Monad because the type of the
state is transformable. This is awesome and really nice for creating statemachines that
@smurphy8
smurphy8 / gist:b0c8040284d3b874e6c5
Last active April 13, 2018 01:18
Using IxMonad to create an IO StateMachine
@smurphy8
smurphy8 / gist:8e0eb2923a2784ea8acd
Created May 1, 2014 03:19
Raw Indexed Monad with Embedded IO
{-# LANGUAGE OverloadedStrings , NoImplicitPrelude #-}
module StateMachine where
import Control.Monad.Indexed
import CorePrelude
{- | This is my short example of creating an indexed state Monad
Indexed State Monad are different from the standard state Monad because the type of the
state is transformable. This is awesome and really nice for creating statemachines that
{-# LANGUAGE OverloadedStrings,TemplateHaskell, MultiParamTypeClasses
, FunctionalDependencies, FlexibleInstances, RecordWildCards #-}
module AlarmState.Lens where
import qualified Protocol.Mir3.Simple.Mir3SimpleTypes as M
import Alarm.DB.Types
import AlarmState.Types (AlarmRunner,AlarmParameters,People,Person,AlarmState
,AnyAlarm(..),AnyCall(..),AlarmCallout(..) ,InProgress(..)
,CallResponse(..),AnyCount(..),ValidCall(..))
@smurphy8
smurphy8 / betweens Haskell
Created May 23, 2014 16:49
get the subset in between two values
betweens i f s = let (lts, gts) = split i s
(rslt,_) = split f gts
in rslt
@smurphy8
smurphy8 / baseCode
Created June 23, 2014 15:03
munchkin battle code
var type = 'munchkin';
var go = true;
if (this.gold > 100 || this.flush) {
if (this.built.length % 6 === 1) {
type = 'thrower';
}
else if (this.built.length % 6 === 5 ){
type = 'shaman';
}
buildQuery (AlarmLogLookupId mlul mcll msll magl mgst msTime meTime) = let
lulQuery = (\lul -> [OnpingTagCombinedLocationId ==. lul]) <$> mlul
mcllQuery = (\cll -> [OnpingTagCombinedLocationId ==. cll]) <$> mcll
in concat $ catMaybes [lulQuery,mcllQuery]
someFunction = do
rslt <- buildQuery ...
runDB $ do
selectList rslt []
@smurphy8
smurphy8 / munckin-and-base
Last active August 29, 2015 14:02
Code Combat Munchkin and Base
// # Ogre Code Snippets
// ## 06/24/2014
// ### Base Code
// This is the code for my base
var type = 'munchkin';