Basic unit type:
λ> replTy "()"
() :: ()
Basic functions:
Basic unit type:
λ> replTy "()"
() :: ()
Basic functions:
# Has your OS/FS/disk lost your data? | |
# cd to the directory containing your project repositories and run the command | |
# below. (It's long; make sure you get it all.) It finds all of your git repos | |
# and runs paranoid fscks in them to check their integrity. | |
(set -e && find . -type d -and -iname '.git' | while read p; do (cd "$(dirname "$p")" && (set -x && git fsck --full --strict)); done) && echo "OK" | |
# I have 81 git repos in my ~/proj directory and had no errors. |
codio@saturn-granite:~/workspace$ cabal test | |
Running 2 test suites... | |
Test suite spec: RUNNING... | |
Test suite spec: PASS | |
Test suite logged to: dist/test/unit-test-example-0.0.0-spec.log | |
Test suite doctest: RUNNING... | |
### Failure in Codec/Base64.hs:14: expression `decode (encode xs) == xs' | |
<interactive>:37:3: | |
Not in scope: ‘polyQu |
sealed trait Angle { val degrees: Int } | |
private final case object Perpendicular extends Angle { val degrees = 90 } | |
private final case object Straight extends Angle { val degrees = 180 } | |
private final case class Acute(degrees: Int) extends Angle | |
private final case class Obtuse(degrees: Int) extends Angle | |
private final case class Reflex(degrees: Int) extends Angle | |
object Angle { | |
def apply(degrees: Int): Either[String,Angle] = degrees match { | |
case _ if degrees == 90 ⇒ | |
Right(Perpendicular) |
-- A port of: http://semantic-domain.blogspot.com/2015/03/abstract-binding-trees.html | |
{-# LANGUAGE DeriveFunctor #-} | |
module ABT where | |
import qualified Data.Foldable as Foldable | |
import Data.Foldable (Foldable) | |
import Data.Set (Set) | |
import qualified Data.Set as Set |
Every application ever written can be viewed as some sort of transformation on data. Data can come from different sources, such as a network or a file or user input or the Large Hadron Collider. It can come from many sources all at once to be merged and aggregated in interesting ways, and it can be produced into many different output sinks, such as a network or files or graphical user interfaces. You might produce your output all at once, as a big data dump at the end of the world (right before your program shuts down), or you might produce it more incrementally. Every application fits into this model.
The scalaz-stream project is an attempt to make it easy to construct, test and scale programs that fit within this model (which is to say, everything). It does this by providing an abstraction around a "stream" of data, which is really just this notion of some number of data being sequentially pulled out of some unspecified data source. On top of this abstraction, sca
module SendMoreMoney where | |
import Data.SBV | |
-- | | |
-- >>> sendMoreMoney | |
-- Solution #1: | |
-- s = 9 :: Integer | |
-- e = 5 :: Integer | |
-- n = 6 :: Integer |
{-# LANGUAGE DataKinds #-} | |
{-# LANGUAGE TypeFamilies #-} | |
{-# LANGUAGE TypeOperators #-} | |
{-# LANGUAGE FlexibleInstances #-} | |
{-# LANGUAGE ScopedTypeVariables #-} | |
{-# LANGUAGE TypeSynonymInstances #-} | |
module Files where | |
import Control.Monad.IO.Class | |
import Control.Monad.Trans.Either |
module type CELL = sig | |
type 'a cell | |
type 'a exp | |
val return : 'a -> 'a exp | |
val (>>=) : 'a exp -> ('a -> 'b exp) -> 'b exp | |
val cell : 'a exp -> 'a cell exp | |
val get : 'a cell -> 'a exp |
module Main where | |
import StartApp | |
import String | |
import Html | |
import Html.Events as Html | |
import Html.Attributes as Html | |
import Html.Shorthand exposing (..) | |
import Bootstrap.Html exposing (..) | |
import Html exposing (blockquote) |