Skip to content

Instantly share code, notes, and snippets.

Avatar

Oskar Wickström owickstrom

View GitHub Profile
@owickstrom
owickstrom / cla.md
Last active August 22, 2020 05:28
Quickstrom CLA
View cla.md

Contributor Agreement

Individual Contributor exclusive License Agreement

(including the Traditional Patent License OPTION)

Thank you for your interest in contributing to Oskar Wickström's Quickstrom ("We" or "Us").

The purpose of this contributor agreement ("Agreement") is to clarify and document the rights granted by contributors to Us.

@owickstrom
owickstrom / selective.md
Created July 4, 2020 20:04
Questions regarding selective applicative functors and WebCheck's DOM query restrictions
View selective.md

Selective Applicative Functors in WebCheck

WebCheck uses a version of PureScript for specifications in testing web applications, which I'll refer to as "the language" in this document.

A specification includes a top-level definition called proposition, which must be a pure expression of type Boolean. The interpreter of the language does not allow effects (the Effect type in PureScript, formerly known as Eff). But there are a few built-in constructs that are at least backed by non-pure computations:

@owickstrom
owickstrom / TodoMVC.spec.purs
Last active March 12, 2021 01:19
TodoMVC Showdown Specification
View TodoMVC.spec.purs
module WebCheck.PureScript.TodoMVC where
import WebCheck.DSL
import Data.Array (filter, foldMap, head, last, zip)
import Data.Foldable (length)
import Data.Int as Int
import Data.Maybe (Maybe(..), fromMaybe)
import Data.String (Pattern(..), split, trim)
import Data.Tuple (Tuple(..))
View ThoughtLeaderTom.hs
{-# OPTIONS_GHC -Wno-missing-methods #-}
{-# LANGUAGE FlexibleContexts #-}
{-# LANGUAGE FlexibleInstances #-}
{-# LANGUAGE FunctionalDependencies #-}
{-# LANGUAGE ScopedTypeVariables #-}
{-# LANGUAGE TypeFamilies #-}
{-# LANGUAGE UndecidableInstances #-}
module ThoughtLeaderTom where
import Control.Monad ((>=>))
@owickstrom
owickstrom / HiggledyHedgehog.hs
Created July 1, 2019 19:37
Defining overridable default generators for Hedgehog using Higgledy
View HiggledyHedgehog.hs
{-# LANGUAGE DataKinds #-}
{-# LANGUAGE DeriveGeneric #-}
{-# LANGUAGE NamedFieldPuns #-}
{-# LANGUAGE TypeApplications #-}
module HiggledyHedgehog where
import Control.Lens
import Data.Generic.HKD
import GHC.Generics (Generic)
import Hedgehog
View TypeFamilyConstraintsTuple.hs
-- | This shows a way of computing a recursive type, and applying
-- constraints to individual types within it, using a type family.
-- I've commented the different parts, and the file ends with some
-- questions.
{-# LANGUAGE ConstraintKinds #-}
{-# LANGUAGE DataKinds #-}
{-# LANGUAGE GADTs #-}
{-# LANGUAGE KindSignatures #-}
{-# LANGUAGE RankNTypes #-}
@owickstrom
owickstrom / .gitignore
Last active September 4, 2017 04:43
Compile-time checking globally loaded scripts for Yesod
View .gitignore
.stack-work
@owickstrom
owickstrom / README.md
Last active May 20, 2017 15:49
Servant-like routing in PureScript without ordering requirements
View README.md

Servant-like routing in PureScript without ordering requirements

With Servant-style routing, the ordering of endpoints in types must line up with handlers on the value level. Destructuring clients and link structures derived from a routing type cannot be done without introducing coupling to the ordering of the routing type.

This experiment tries to remove that ordering issue, by using named resources and methods on the type level, in combination with PureScript's records (constrained by RowCons) at the value level. The ordering no longer matter when we give handlers in a record. We could also implement link or client deriving functions that would extract specific clients based on a given name. All name checks are done at compile time.

@owickstrom
owickstrom / SafeForm.purs
Created February 28, 2017 19:06
Type-safe forms draft
View SafeForm.purs
module Examples.SafeForm where
import Control.IxMonad ((:*>))
import Control.Monad.Eff (Eff)
import Control.Monad.Eff.Console (CONSOLE)
import Control.Monad.Except (ExceptT)
import Data.Foldable (traverse_)
import Data.Maybe (Maybe(..), maybe)
import Data.MediaType.Common (textHTML)
import Data.Monoid (mempty)
@owickstrom
owickstrom / keybase.md
Created February 14, 2017 06:04
keybase.md
View keybase.md

Keybase proof

I hereby claim:

  • I am owickstrom on github.
  • I am owickstrom (https://keybase.io/owickstrom) on keybase.
  • I have a public key whose fingerprint is 571E 0B73 FDB5 B163 DD48 7576 CEDE 3357 E0C5 F53E

To claim this, I am signing this object: