All of the profunctor optics kind have the same, very simple, pattern:
type AnOptic p s t a b = p a b -> p s t
type Optic c s t a b = forall p. c p => AnOptic p s t a b
type Iso s t a b = Optic Profunctor s t a b| Benchmark bench-trans-speed: RUNNING... | |
| benchmarking 1/20 modify/pure/2000 | |
| time 1.033 ฮผs (1.022 ฮผs .. 1.052 ฮผs) | |
| 0.991 Rยฒ (0.981 Rยฒ .. 0.997 Rยฒ) | |
| mean 1.130 ฮผs (1.084 ฮผs .. 1.207 ฮผs) | |
| std dev 182.7 ns (129.1 ns .. 265.3 ns) | |
| variance introduced by outliers: 95% (severely inflated) | |
| benchmarking 1/20 modify/ParserT State/2000 | |
| time 1.250 ฮผs (1.236 ฮผs .. 1.264 ฮผs) |
| {-# OPTIONS_GHC -Wall #-} | |
| {-# LANGUAGE RankNTypes #-} | |
| {-# LANGUAGE ConstraintKinds #-} | |
| {-# LANGUAGE MultiParamTypeClasses #-} | |
| {-# LANGUAGE FlexibleInstances #-} | |
| import Control.Monad | |
| import Data.Bifunctor | |
| type AnOptic p s t a b = p a b -> p s t |
| {-# LANGUAGE TypeFamilies #-} | |
| {-# LANGUAGE AllowAmbiguousTypes #-} | |
| {-# LANGUAGE TypeApplications #-} | |
| {-# LANGUAGE ScopedTypeVariables #-} | |
| {-# LANGUAGE RankNTypes #-} | |
| {-# LANGUAGE MultiParamTypeClasses #-} | |
| {-# LANGUAGE FlexibleContexts #-} | |
| {-# LANGUAGE FlexibleInstances #-} | |
| {-# LANGUAGE InstanceSigs #-} |
| \documentclass{beamer} | |
| \usepackage{lipsum} | |
| % Paragraph spacing | |
| \setlength{\parskip}{1ex} | |
| \makeatletter | |
| \def\@listi{\leftmargin\leftmargini | |
| \topsep 0pt % Space before/after list | |
| \parsep 0pt % Space between paragraphs within an item | |
| \itemsep 0pt} % Space between separate items |
| {-# LANGUAGE RankNTypes #-} | |
| {-# LANGUAGE NoFieldSelectors #-} | |
| {-# LANGUAGE NamedFieldPuns #-} | |
| {-# LANGUAGE DeriveFunctor #-} | |
| module Main where | |
| import Control.Lens | |
| testRec :: Rec (Int, String) |
| {-# LANGUAGE FlexibleInstances #-} | |
| {-# LANGUAGE LambdaCase #-} | |
| {-# LANGUAGE OverloadedStrings #-} | |
| module Lam where | |
| import Control.Applicative | |
| import qualified Control.Monad.Combinators.Expr as Expr | |
| import qualified Data.Char as Char | |
| import qualified Data.List.NonEmpty as NE |
| git config --global alias.logt 'log --graph --pretty=oneline --abbrev-commit --all --decorate' |