This file contains hidden or 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 FlexibleInstances #-} | |
| {-# LANGUAGE FunctionalDependencies #-} | |
| {-# LANGUAGE GADTs #-} | |
| {-# LANGUAGE GeneralizedNewtypeDeriving #-} | |
| {-# LANGUAGE LambdaCase #-} | |
| {-# LANGUAGE MultiParamTypeClasses #-} | |
| {-# LANGUAGE PolyKinds #-} | |
| {-# LANGUAGE ScopedTypeVariables #-} | |
| {-# LANGUAGE TypeFamilies #-} |
This file contains hidden or 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
| runStoryApp :: Comonad w => StoryApp a -> CoStoryAppT w b -> (a, b) | |
| runStoryApp = pairEffect (,) | |
| runStory :: Comonad w => Story a -> CoStoryT w b -> (a, b) | |
| runStory = pairEffect (,) | |
| mkCoStoryApp :: Comonad w | |
| => w b | |
| -> (w b -> Character -> ChangeType -> w b) | |
| -> (forall x y . (forall a. Story a -> b) |
This file contains hidden or 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
| type family Apply g a b :: * where | |
| Apply (->) a b = a -> b | |
| Apply Snd a b = b | |
| data StoryF g a = Change Character ChangeType (Apply g ChangeResult a) | |
| | forall x x'. Interrupt (Free (StoryF g) x') | |
| (Free (StoryF g) x) | |
| (Apply g x a) | |
| | Macguffin (Apply g Desirable a) |
This file contains hidden or 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 RPG.Data.StoryImpl | |
| ( runStory | |
| , dopestory | |
| , mkCoStory | |
| ) where | |
| import Control.Comonad | |
| import Control.Comonad.Trans.Cofree | |
| import Control.Monad (void) | |
| import Control.Monad.IO.Class |
This file contains hidden or 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 Components.KeySelector where | |
| import Graphics.Input exposing (button) | |
| keySelector : (Note -> a) -> Signal.Address a -> Element | |
| keySelector f address = flow right | |
| << flip List.map noteEnum.elems | |
| <| \note -> | |
| button (Signal.message address <| f note) | |
| <| toString note |
This file contains hidden or 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 Test where | |
| import Control.Concurrent.MVar | |
| import Control.Monad.IO.Class | |
| import Control.Monad (join) | |
| -- Memoize an IO result | |
| memoIO :: MonadIO m => m a -> m (m a) | |
| memoIO action = do | |
| ref <- liftIO $ newMVar Nothing |
This file contains hidden or 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 Prelude hiding (mod) | |
| import Control.Monad (when, liftM2) | |
| import System.Environment (getArgs) | |
| import System.IO | |
| import XMonad | |
| import XMonad.Actions.DynamicWorkspaces | |
| import XMonad.Actions.WindowGo | |
| import XMonad.Layout.Fullscreen |
This file contains hidden or 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 ScopedTypeVariables #-} | |
| module Main where | |
| type Inventory = (Game, Int) | |
| type UserRank = (User, (Game, Int)) | |
| unwrapPair :: Monad m => (a, m b) -> m (a, b) |
This file contains hidden or 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
| type App = ReaderT (AcidState Database) (ServerPartT IO) | |
| processForm :: App Response | |
| processForm = | |
| do method POST | |
| db <- ask | |
| (games, _) <- query db (GetState) ----- this part explodes | |
| prefs <- sequence $ map (runText . fst) prefMap | |
| ok $ template "form" $ H.p "success!" |
This file contains hidden or 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
| package juicy.source.ast | |
| trait Expression extends Visitable | |
| trait Statement extends Visitable | |
| trait BinOp extends Expression { | |
| val lhs: Expression | |
| val rhs: Expression | |
| protected def rewriter[T <: BinOp] |