The following are appendices from Optics By Example, a comprehensive guide to optics from beginner to advanced! If you like the content below, there's plenty more where that came from; pick up the book!
import Data.Monoid | |
-- This code doesn't work... | |
-- How can you make a multi-parameter data type be Foldable? | |
-- foldMap over `a` so it can be converted to a Monoid | |
data BinaryTree3 a v | |
= Node3 a (BinaryTree3 a v) (BinaryTree3 a v) | |
| Leaf3 a v | |
deriving (Show) |
Our web applications are getting increasingly more complicated. They are becoming more distributed and increasingly powered by combinations of complex, constantly changing and large datasets. All while users are increasingly more connected and want the latest information instantly without any slow page loads or stale information.
To address this, developers have turned to layers of caching and single page applications so that there are layers of aggregated and preloaded state as close to the user as possible, to be immediately available when it is requested. This comes at a high cost: it is very difficult to invalidate or update those caches when the upstream information changes. This is especially problematic when the stale caches can accidentally cause real bugs rather than show stale data to users.
The big issue here is that we're not just caching expensive-to-compute static data. We are caching data that changes over time. There are a number of architectual patterns that can be applied, but to date, n
mount indicators- install air filter
install rear rackinstall braided fuel line- install headlight protector
mount spotlightsinstall windscreen- change oil filters
- install foam air filter
- adjust rear shock
Response to https://peerj.com/preprints/826v1/ | |
1. | |
The method is dubious with respect to the conclusion. | |
The researchers do not analyse the code using any formal | |
or even established reliable methods. Instead, the metric that is used is "look | |
to see if some *detected* bug, which was fixed *post-release*. |
Say more by saying less. Learn how parametric types, when used in conjunction with an adequately strong type system, help the programmer comprehend code by invalidating candidate programs. Parametricity helps the programmer by enabling deduction of theories about what a program cannot do, sometimes to the point of leaving no ambiguity.
import System.Environment | |
import System.IO | |
import Control.Monad (when) | |
matchGlob :: String -> String -> Bool | |
matchGlob = undefined | |
main :: IO () | |
main = do | |
args <- getArgs |
module Every where | |
import Control.Lens | |
import Control.Monad.Fix | |
-- | | |
-- | |
-- >>> everyN 2 [] | |
-- [] | |
-- |
hardCoreFunction a b c = | |
let z = a + b | |
k = b + c | |
in | |
error "todo" z + k -- this obviously type-checks |
object blah { | |
case class OptionT[F[_], A](x: F[Option[A]]) | |
trait Functor[F[_]] | |
object Functor { | |
implicit val OptionFunctor: Functor[Option] = | |
sys.error("todo") | |
} | |
object OptionT { | |
implicit def OptionTFunctor[F[_]: Functor]: Functor[({ type l[a] = OptionT[F, a] })#l] = |