Skip to content

Instantly share code, notes, and snippets.

@hdgarrood
hdgarrood / Main.purs
Created Jul 18, 2020
Code accompanying Generics post
View Main.purs
module Main where
import Prelude
import Control.Alt ((<|>))
import Data.Array as Array
import Data.Generic.Rep as G
import Data.Int as Int
import Data.Maybe (Maybe(..))
import Data.Symbol (class IsSymbol, reflectSymbol, SProxy(..))
View load-from-cwd-or-npm@3.0.2.js
'use strict';
const {dirname, isAbsolute, join, resolve} = require('path');
const {existsSync} = require('fs');
const {PassThrough} = require('stream');
const inspectWithKind = require('inspect-with-kind');
const npmCliDir = require('npm-cli-dir');
const optional = require('optional');
const resolveFromNpm = require('resolve-from-npm');
View release-notes.md

Bug Fixes

  • Update incremental build cache information properly on IDE rebuilds (#3789, @kritzcreek)

    Fixes a bug where triggering a rebuild via the IDE would not update the output/cache-db.json file, which in certain situations could lead to unnecessary rebuilds, as well as modules not being rebuilt when they should have been.

  • Don't include compiler-internal declarations in IDE completions (#3850, @kritzcreek)

@hdgarrood
hdgarrood / Main.purs
Created May 20, 2020
Required and optional fields example
View Main.purs
module Main where
import Prelude
import Effect (Effect)
import Data.Foldable (fold)
import TryPureScript (h1, h2, p, text, list, indent, link, render, code)
import Prim.Row (class Union, class Nub)
import Type.Row (type (+))
import Record as Record
@hdgarrood
hdgarrood / Main.html
Created May 8, 2020
polykinds HTML docs example
View Main.html
<!DOCTYPE HTML>
<html><head><meta charset="utf-8"><meta http-equiv="X-UA-Compatible" content="IE=edge"><meta name="viewport" content="width=device-width, initial-scale=1"><title>PureScript: Main</title><link href="https://fonts.googleapis.com/css?family=Roboto+Mono|Roboto:300,400,400i,700,700i" type="text/css" rel="stylesheet"><style type="text/css">/*! normalize.css v3.0.2 | MIT License | git.io/normalize */
/**
* 1. Set default font family to sans-serif.
* 2. Prevent iOS text size adjust after orientation change, without disabling
* user zoom.
*/
html {
@hdgarrood
hdgarrood / Main.purs
Last active Apr 4, 2020
Ring laws are too weak
View Main.purs
module Main where
import Prelude
import Control.Monad.Eff (Eff)
import Data.Foldable (fold)
import TryPureScript (DOM, h1, p, text, render)
main :: Eff (dom :: DOM) Unit
main =
View malicious-code-purescript-npm-installer.md
View large-haskell-projects-on-travis.md

Haskell projects with lots of dependencies on Travis CI

If your Haskell project has lots of dependencies, you can find yourself reaching the timeout while compiling them - the free service has a timeout of 50 minutes. How do we address this?

First, a quick reminder of build statuses in Travis CI:

All builds finish with one of four possible statuses: succeeded, failed, errored, or (manually) cancelled. The difference between a failed and errored

@hdgarrood
hdgarrood / cookies.hs
Last active Feb 9, 2018
Scotty cookies example
View cookies.hs
{-# LANGUAGE OverloadedStrings #-}
import Control.Monad (forM_)
import Data.Text.Lazy (Text)
import qualified Data.Text.Lazy as T
import qualified Data.Text.Lazy.Encoding as T
import qualified Data.ByteString as BS
import qualified Data.ByteString.Lazy as BSL
import qualified Blaze.ByteString.Builder as B
View DataTypes.purs
module DataTypes where
data Foo = Foo
mkFoo = Foo
data Bar = Bar
data Baz = Baz1 | Baz2
You can’t perform that action at this time.