Why use monad transfomers? Well, we can take code that looks like this:
contentTypesProvided = do
macM <- HM.lookup "mac" <$> params
case macM of
(Just aMac) -> do| {-# LANGUAGE GADTs, InstanceSigs, MultiParamTypeClasses, TypeApplications, TypeFamilies, TupleSections #-} | |
| module Moore where | |
| import Control.Comonad | |
| import Control.Monad.Zip | |
| import Control.Monad.Reader | |
| import Data.Copointed | |
| import Data.Distributive | |
| import Data.Machine.Plan |
| {-# LANGUAGE GADTs, LambdaCase #-} | |
| -- I haven't compiled this and wrote it before any coffee | |
| -- so please don't laugh at me if it doesn't compile lol | |
| module Turtle ( Turtle, left, right, forward, backward) where | |
| import Graphics.Gloss | |
| import Control.Monad.State | |
| import Control.Lens |
| # Append to a history file (~/.zhistory) | |
| setopt appendhistory | |
| # Auto-cd to directories if the only input provided is a directory. | |
| setopt autocd | |
| # Auto-expand substitution strings in the prompt | |
| setopt prompt_subst | |
| # Enable auto push/pop tracking, a la a browser | |
| setopt auto_pushd | |
| # Set up the vcs_info module to work with git, svn, and git-svn |
| #!/usr/bin/env stack | |
| -- stack --resolver=lts-8.2 runghc --package text | |
| {-# LANGUAGE OverloadedStrings #-} | |
| -- example usage: | |
| -- $ clapper "I wrote this to troll @peterb" | |
| -- yields | |
| -- I 👏 wrote 👏 this 👏 to 👏 troll 👏 peterb 👏 | |
| import Data.List (intersperse) |
| {- | |
| Given a file at /tmp/lol.xml | |
| <!DOCTYPE html> | |
| <body> | |
| lol! | |
| </body> | |
| -} |
| #### | |
| #### | |
| #### | |
| #### | |
| ###### | |
| ########### | |
| ################ | |
| #################### | |
| #### | |
| #### | |
| #### | |
| #### | |
| ###### | |
| ########### | |
| ################ | |
| #################### | |
| GNU gdb (GDB) 7.6.1 | |
| Copyright (C) 2013 Free Software Foundation, Inc. | |
| License GPLv3+: GNU GPL version 3 or later <http://gnu.org/licenses/gpl.html> | |
| This is free software: you are free to change and redistribute it. | |
| There is NO WARRANTY, to the extent permitted by law. Type "show copying" | |
| and "show warranty" for details. | |
| This GDB was configured as "x86_64-sun-solaris2.11". | |
| For bug reporting instructions, please see: | |
| <http://www.gnu.org/software/gdb/bugs/>... | |
| Reading symbols from /root/snapboard-5c24579/snapboard...done. |
| execve("snapboard", 0xFFFFFD7FFFDFFB78, 0xFFFFFD7FFFDFFB98) argc = 3 | |
| sysinfo(SI_MACHINE, "i86pc", 257) = 6 | |
| mmap(0x00000000, 56, PROT_READ|PROT_WRITE|PROT_EXEC, MAP_PRIVATE|MAP_ANON, 4294967295, 0) = 0xFFFFFD7FFF390000 | |
| mmap(0x00000000, 4096, PROT_READ|PROT_WRITE|PROT_EXEC, MAP_PRIVATE|MAP_ANON, 4294967295, 0) = 0xFFFFFD7FFF380000 | |
| mmap(0x00000000, 4096, PROT_READ|PROT_WRITE, MAP_PRIVATE|MAP_ANON, 4294967295, 0) = 0xFFFFFD7FFF370000 | |
| mmap(0x00000000, 4096, PROT_READ|PROT_WRITE, MAP_PRIVATE|MAP_ANON, 4294967295, 0) = 0xFFFFFD7FFF360000 | |
| memcntl(0xFFFFFD7FFF398000, 96992, MC_ADVISE, MADV_WILLNEED, 0, 0) = 0 | |
| mmap(0x00000000, 4096, PROT_READ|PROT_WRITE|PROT_EXEC, MAP_PRIVATE|MAP_ANON, 4294967295, 0) = 0xFFFFFD7FFF350000 | |
| memcntl(0x00400000, 16885696, MC_ADVISE, MADV_WILLNEED, 0, 0) = 0 | |
| resolvepath("/usr/lib/amd64/ld.so.1", "/lib/amd64/ld.so.1", 1023) = 18 |