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 Control.Monad (ap, forM_) | |
import qualified Data.Map as M | |
-- The Collapse Monad | |
-- ------------------ | |
-- The Collapse Monad allows collapsing a value with labelled superpositions | |
-- into a flat list of superposition-free values. It is like the List Monad, | |
-- except that, instead of always doing a cartesian product, it will perform | |
-- pairwise merges of distant parts of your program that are "entangled" | |
-- under the same label. Examples: |
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
public class TransactionExample { | |
public static void main(String[] args) { | |
Transactor<IO<?>, Unit, String> transactor = new Transactor<>() { | |
@Override | |
public <A> IO<Either<String, A>> runTransactional(Transactional<IO<?>, String, Unit, A> transactional) { | |
Unit connection = UNIT; | |
return IO.io(() -> System.out.println("Starting Transaction")) | |
.discardL(transactional.run(connection) | |
.<IO<Either<String, A>>>coerce() | |
.flatMap(e -> e.match(s -> IO.io(() -> System.err.printf("Rolling back transaction due to %s%n", s)), |
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 RankNTypes #-} | |
{-# LANGUAGE TypeApplications #-} | |
{-# LANGUAGE ImpredicativeTypes #-} | |
{-# LANGUAGE ScopedTypeVariables #-} | |
module IOHCC where | |
import Unsafe.Coerce | |
u = unsafeCoerce |
- Red area is a result of the upfront, fixed cost of learning Haskell vs Java.
- The company pays this for each new hire.
- Yellow area is the developer's productivity gain once they're "over the hump."
- The company can benefit from this, but it must first reach a break-even point vs the cost of learning.
- If average employee tenure is less than this break-even point, the company is taking an absolute loss on each employee.
- For Haskell to truly be worth it from a business perspective, the average tenure must not just eclipse the break-even point, but it must go further to account for the opportunity cost of better productivity during that learning period.
- However, employees always benefit from this regardless of turnover - they get to take the productivity gain with them. This - in my opinion - naturally results in some tension.
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!
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 Utils.Concurrent (mkPipeline, launchNukes) where | |
import Control.Concurrent (threadDelay) | |
import Control.Concurrent.Async (Async, async, cancel, wait) | |
import Control.Concurrent.STM (TBQueue, atomically, newTBQueueIO, | |
readTBQueue, writeTBQueue) | |
import Control.Monad (forever, void) | |
import Control.Monad.IO.Class (MonadIO, liftIO) | |
import GHC.Natural (Natural) |
Article topics:
Для haskell есть haskell ide engine (далее hie).Это приблуда которая поддерживает Language Server Protocol и благодаря этому может интегрироваться со множеством редакторов (neovim, atom, emacs, sublime, vs code).
Описана здесь . С помощью одной простой комманды вы можете установить HIE:
nix-env -iA selection --arg selector 'p: { inherit (p) ghc864 ghc863 ghc843; }' -f https://github.com/infinisil/all-hies/tarball/master
NewerOlder