Skip to content

Instantly share code, notes, and snippets.

Avatar

Nikos Baxevanis moodmosaic

View GitHub Profile
@moodmosaic
moodmosaic / sup_test.ts
Last active Mar 16, 2022
Clarity contracts can be property-based tested
View sup_test.ts
import { Clarinet, Tx, Chain, Account, types }
from 'https://deno.land/x/clarinet@v0.14.0/index.ts';
import { assert, assertEquals }
from 'https://deno.land/std@0.90.0/testing/asserts.ts';
import fc
from 'https://cdn.skypack.dev/fast-check';
Clarinet.test({
@moodmosaic
moodmosaic / stack.yaml
Last active Nov 1, 2018
Semigroup Laws
View stack.yaml
resolver:
lts-11.22
extra-deps:
- hedgehog-0.6.1
@moodmosaic
moodmosaic / TH.hs
Last active Apr 30, 2018
Parametrised unit tests and Template Haskell
View TH.hs
{-# LANGUAGE TemplateHaskell #-}
module Discordia.TH where
import Language.Haskell.Extract (functionExtractorMap)
import Language.Haskell.TH
import Test.Framework (defaultMain)
import Test.HUnit (Test(..))
discover :: ExpQ
View SumProduct.hs
module SumProduct (
KnownColor (..)
, RGB (..)
, redColor
, magenta
, red
) where
We couldn’t find that file to show.
@moodmosaic
moodmosaic / Main.hs
Created May 25, 2017
Servant example from "Write a client library for any web API in 5 minutes" https://haskell-servant.github.io/client-in-5-minutes.html
View Main.hs
{-# LANGUAGE DataKinds #-}
{-# LANGUAGE DeriveGeneric #-}
{-# LANGUAGE OverloadedStrings #-}
{-# LANGUAGE TypeOperators #-}
{-# OPTIONS_GHC -fno-warn-unused-imports #-}
import Control.Applicative
import Control.Monad
import Control.Monad.IO.Class
import Control.Monad.Trans.Except
import Data.Aeson
View Sort fsharpforfunandprofit.com
# Last checked
# $ date
# Mon Feb 27 23:59:15 EEST 2017
2017-02-17 https://fsharpforfunandprofit.com/cap/
2017-02-17 https://fsharpforfunandprofit.com/turtle/
2017-02-17 https://fsharpforfunandprofit.com/video/
2016-12-05 https://fsharpforfunandprofit.com/posts/dependency-injection-1
2016-08-01 https://fsharpforfunandprofit.com/installing-and-using/
2016-06-23 https://fsharpforfunandprofit.com/parser/
View Booking.cabal
name: Booking
version: 0.1.0.0
synopsis: Handling a reservation request in Haskell. Proof of concept
description: Please see README.md
homepage: https://gist.github.com/ploeh/c999e2ae2248bd44d775
license: MIT
license-file: LICENSE
author: Mark Seemann
maintainer: example@example.com
copyright: 2016 Mark Seemann
@moodmosaic
moodmosaic / LightCheck.fs
Last active Dec 13, 2020
LightCheck is a QuickCheck-based clone, written in F# for educational use.
View LightCheck.fs
// Port of Haskell
// - https://hackage.haskell.org/package/QuickCheck-1.2.0.1
// - https://hackage.haskell.org/package/random-1.1
namespace LightCheck
/// <summary>
/// This module deals with the common task of pseudo-random number generation.
/// It makes it possible to generate repeatable results, by starting with a
/// specified initial random number generator, or to get different results on
@moodmosaic
moodmosaic / gist:7fba17beae7cee92581a
Last active Aug 29, 2015
Feedback, related to an answer on Stack Overflow at: http://stackoverflow.com/a/28798955/467754
View gist:7fba17beae7cee92581a
type OddlySpelledWords =
static member String() =
["zZ"; "oO0Ò"; "eEê"]
|> List.map Gen.elements
|> Gen.sequence
|> Gen.map (List.map string >> List.reduce (+))
|> Arb.fromGen
[<Property(Arbitrary = [| typeof<OddlySpelledWords> |])>]
let ``Generate oddly spelled words`` s =