Skip to content

Instantly share code, notes, and snippets.

View moodmosaic's full-sized avatar

Nikos Baxevanis moodmosaic

View GitHub Profile
@moodmosaic
moodmosaic / Main.hs
Created May 25, 2017 03:21
Servant example from "Write a client library for any web API in 5 minutes" https://haskell-servant.github.io/client-in-5-minutes.html
{-# 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
We couldn’t find that file to show.
module SumProduct (
KnownColor (..)
, RGB (..)
, redColor
, magenta
, red
) where
@moodmosaic
moodmosaic / TH.hs
Last active April 30, 2018 12:30
Parametrised unit tests and Template Haskell
{-# 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
@moodmosaic
moodmosaic / stack.yaml
Last active November 1, 2018 13:32
Semigroup Laws
resolver:
lts-11.22
extra-deps:
- hedgehog-0.6.1
@moodmosaic
moodmosaic / sup_test.ts
Last active March 16, 2022 10:43
Clarity contracts can be property-based tested
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 / clarinet-fuzz-dsl.ts
Created August 10, 2023 21:27
A DSL for turning concrete tests into prop/fuzz tests on top of Clarinet.test
Clarinet.test({
name: "ascii-to-buff",
runs: 1000,
logs: true,
data: {
text: {
minLength: 0,
maxLength: 127,
}
},