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 Main where | |
| import Data.Monoid | |
| import Control.Monad | |
| import Control.Applicative | |
| import Control.Arrow | |
| import Control.Arrow.Transformer | |
| import Control.Arrow.Transformer.Static | |
| type SteppedIO a b = StaticArrow ((,) (Sum Int)) (Kleisli IO) 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
| module Main where | |
| import Data.Monoid | |
| import Control.Applicative | |
| import Data.Functor.Compose | |
| type SteppedIO a = Compose ((,) (Sum Int)) IO a | |
| step :: IO a -> SteppedIO a | |
| step cmd = Compose (Sum 1, cmd) |
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 Main where | |
| import Data.Monoid | |
| import Control.Applicative | |
| import Data.Functor.Compose | |
| import Control.Monad | |
| import Control.Monad.Trans.State.Strict | |
| type SteppedIO a = Compose ((,) (Sum Int)) (Compose IO (State Int)) 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 Main where | |
| import Data.Monoid | |
| import Control.Applicative | |
| import Control.Monad.State | |
| import Data.Functor.Compose | |
| import Data.Functor.Compose | |
| import Pipes | |
| import Pipes.Lift |
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
| # http://www.haskell.org/ghc/docs/7.6.3/html/users_guide/ghci-invocation.html#idp32890000 | |
| # http://www.haskell.org/ghc/docs/7.0.3/html/users_guide/runghc.html | |
| runghc -- -package --ghc-arg=shelly Script.hs |
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
| Aaaa $A \in \mathcal{C}$ bbb | |
| $(F\downarrow U)$ | |
| $F(\star)=M$ | |
| $\bullet \longleftarrow \bullet \longrightarrow\bullet$ | |
| $\left(.\downarrow .\right): Cat^{\rightarrow\leftarrow} \longrightarrow Cat$ |
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
| test-suite Tests | |
| hs-source-dirs: test | |
| ghc-options: -Wall | |
| main-is: Test.hs | |
| Type: exitcode-stdio-1.0 | |
| default-language: Haskell2010 | |
| build-depends: base ==4.6.*, Cabal >= 1.16.0 | |
| , nananiero | |
| , HUnit | |
| , QuickCheck |
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 TemplateHaskell #-} | |
| {-# LANGUAGE FlexibleInstances #-} | |
| {-# LANGUAGE MultiParamTypeClasses #-} | |
| import Control.Lens | |
| data Foo a = Foo { unFoo :: (Int,a) } deriving Show | |
| $(makeWrapped ''Foo) |
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
| ghci> at 1 ?~ "hello" $ M.empty | |
| fromList [(1,"hello")] | |
| ghci> at 1 .~ (Just "hello") $ M.empty | |
| fromList [(1,"hello")] | |
| ghci> at 1 .~ Nothing $ M.fromList [(1,"blah")] | |
| fromList [] | |
| ghci> (%~) (at 2) (maybe (Just "b") (\x -> Just $ x ++ "bbb")) (M.fromList [(2,"a")]) | |
| fromList [(2,"abbb")] | |
| ghci> Nothing ^. non 0 |
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 DeriveDataTypeable #-} | |
| data HiddenException e = HiddenException e | |
| deriving (Show, Typeable) | |
| instance (Show e, Typeable e) => Exception (HiddenException e) | |
| elideError :: (Show e, Typeable e) => ErrorT e IO a -> IO a | |
| elideError action = do | |
| runErrorT action >>= either (throwIO.HiddenException) return |