ScalaCheck 1.14.0 was just released with support for deterministic testing using seeds. Some folks have asked for examples, so I wanted to produce a Gist to help people use this feature.
These examples will assume the following imports:
{-# LANGUAGE DataKinds #-} | |
{-# LANGUAGE KindSignatures #-} | |
{-# LANGUAGE TypeFamilies #-} | |
{-# LANGUAGE UndecidableInstances #-} | |
{-# LANGUAGE GADTs #-} | |
{-# OPTIONS_GHC -Wall #-} | |
module Main where |
import shapeless._, record._ | |
import io.circe._ | |
import io.circe.syntax._ | |
import io.circe.generic.encoding._ | |
case class Person(name: String, age: Int) | |
object Person { | |
implicit val encodePerson: Encoder[Person] = | |
ReprObjectEncoder.deriveReprObjectEncoder.contramap { person => |
To use media keys on the Ducky One 2 Skyline, you must record a macro to bind the media function to a hotkey combination, i.e. Fn
plus some key.
Important: In the instructions below, "Press X+Y+Z
" means press and hold key X
, press and hold key Y
, press and hold key Z
in that order, and then release all three.
As an example, to bind Fn+PgUp
to the play/pause media function:
In PureScript there are types of different kinds. Kinds are types for types. For example Int
has kind Type
, and we write it as Int :: Type
. You can ask for the kind of a type in purs psci
> :k Int
Type
Type constructors take types to other types. For example Array
(which still needs another type to form a type a value could have, like Array Int
):
# GIT heart FZF | |
# ------------- | |
is_in_git_repo() { | |
git rev-parse HEAD > /dev/null 2>&1 | |
} | |
fzf-down() { | |
fzf --height 50% --min-height 20 --border --bind ctrl-/:toggle-preview "$@" | |
} |
package com.dvMENTALmadness | |
import akka.actor.ActorSystem | |
import akka.stream.ActorMaterializer | |
import akka.http.scaladsl.Http | |
import akka.http.scaladsl.model._ | |
import scala.concurrent.Await | |
import scala.concurrent.ExecutionContext.Implicits.global | |
import scala.concurrent.duration._ |
'use strict'; | |
// Usage | |
// node check-markdown-links.js path/to/markdown/file.md | |
// What it does: | |
// - Warns when `[ref][]` or `[title][ref]` style links don't have references defined on a page | |
// - Warns when `[ref]: URL` reference is not used anywhere | |
// - Warns when two `[ref]: URL` references point to same `URL` | |
// - Warns when `[ref]: URL` reference is defined in non-lexical order |
This is material to go along with a 2014 Boston Haskell talk.
We are going to look at a series of type signatures in Haskell and explore how parametricity (or lack thereof) lets us constrain what a function is allowed to do.
Let's start with a decidedly non-generic function signature. What are the possible implementations of this function which typecheck?
wrangle :: Int -> Int