- much of what you already know about programming is useful in scala
- favour composition over inheritance
- single responsibility principle
- DRY when it makes sense
- don't leak abstractions
- program to an interface
package com.mfournier.pbp.example | |
class Example { | |
def square(x: Int): Int = x * x | |
} |
{-# LANGUAGE OverloadedStrings #-} | |
module Wrap where | |
import qualified Data.Text as T | |
import Prelude hiding (Word) | |
import Data.List | |
type LinePos = Int |
angular.module('counterApp', []); | |
angular.module('counterApp') | |
.controller('counterCtrl', function() { | |
var limit = 10; | |
this.reset = function() { | |
this.count = 0; | |
}; |
module Chapter8.GetURLTwo where | |
import Chapter8.MFGetURL | |
import Control.Concurrent | |
import qualified Data.ByteString as B | |
data Async a = Async (MVar a) | |
async' :: IO a -> IO (Async a) | |
async' action = do |
// edit : haskell must also have this problem but how does it solve it? | |
sealed trait Blah | |
// the names aren't important, just that Thing1-3 are all types of Blah and contain dif info (A/C/Z/etc) | |
case class Thing1(piece: A, otherPiece: C) extends Blah | |
case class Thing2(hierarchy: Z) extends Blah | |
case class Thing3(thinger: F) extends Blah | |
case cbject DefaultThing extends Blah |
- one consistent example showing a bunch of effects
- some of these effects short circuit
- give us back exceptions (option, either)
- some represent something happening async elsewhere (possible on another thread)
- e.g. waiting for something on a network
- e.g. Future/Task
- note: these also have some idea of short circuiting with failures
- some have nothing at all to do with failures and have no short circuiting
I cook tons. I have ~100 cookbooks, a 1HP meat grinder, a deep fryer, a 75,000 BTU outdoor wok, a mangal, many fermenting vessels, hell a fermenting chamber for koji, and way too many knives. Someone at work asked about cookbook recommendations by country so here it is. There are many omissions to this list. It aims to be "if I wanted to get into X cuisine, what is the first cookbook I should buy to get started'.
General italian - Zuni cafe cookbook is a standout. Everyone says to get a copy of Marcella Hazen's Essential Italian but meh, I reach to zuni cafe way more often. Hightly recommended. Maybe Molto Mario or Babbo for a second or third italian book, but get zuni cafe first.
just pasta: flour + water
thai: the first pok pok cookbook is great (not the drinking food of thailand, not pok pok noodles) and super easy to get into. If that hooks you, Thai Food by Thompson is the bible, but muc harder to approach. Night+Market is also a good second book. (edited)
title: Getting Func-ey author: Mathew Fournier patat: theme: syntaxHighlighting: decVal: [bold] images: backend: auto ...
package mf.refined | |
import eu.timepit.refined.auto._ | |
import eu.timepit.refined._ | |
import eu.timepit.refined.api.{Refined, RefType} | |
import eu.timepit.refined.collection._ | |
import eu.timepit.refined.numeric._ | |
import io.circe._, io.circe.generic.semiauto._ | |
import io.circe.syntax._ | |
import cats.implicits._ |