Skip to content

Instantly share code, notes, and snippets.

This file contains any messages produced by compilers while
running configure, to aid debugging if configure makes a mistake.
It was created by The Glorious Glasgow Haskell Compilation System configure 8.7, which was
generated by GNU Autoconf 2.69. Invocation command line was
$ ./configure --target=aarch64-unknown-linux-gnu
## --------- ##
## Platform. ##
Up to date
]0;Starting...| Run Cc FindCDependencies Stage1: rts/Linker.c => _build/stage1/rts/build/c/Linker.debug_dyn_o.d
| Run Cc FindCDependencies Stage1: rts/RaiseAsync.c => _build/stage1/rts/build/c/RaiseAsync.thr_o.d
| Run Cc FindCDependencies Stage1: rts/WSDeque.c => _build/stage1/rts/build/c/WSDeque.dyn_o.d
| Run Cc FindCDependencies Stage1: rts/sm/Scav_thr.c => _build/stage1/rts/build/c/sm/Scav_thr.thr_debug_o.d
| Run Cc FindCDependencies Stage1: rts/linker/elf_plt_aarch64.c => _build/stage1/rts/build/c/linker/elf_plt_aarch64.thr_dyn_o.d
| Run Cc FindCDependencies Stage1: rts/sm/Storage.c => _build/stage1/rts/build/c/sm/Storage.l_dyn_o.d
| Run Cc FindCDependencies Stage1: rts/Timer.c => _build/stage1/rts/build/c/Timer.thr_dyn_o.d
| Run Cc FindCDependencies Stage1: rts/Hash.c => _build/stage1/rts/build/c/Hash.thr_o.d
| Run Cc FindCDependencies Stage1: rts/RtsFlags.c => _build/stage1/rts/build/c/RtsFlags.o.d
{-# LANGUAGE RankNTypes #-}
{-# LANGUAGE RecursiveDo #-}
{-# LANGUAGE DeriveFunctor #-}
{-# LANGUAGE GeneralizedNewtypeDeriving #-}
-- | A simple graph library
module Graph
( -- * Creating graphs
runGraph
, newGraph
, node
{ pkgs ? import <nixpkgs> {}
, compiler ? "ghc822"
}:
with pkgs;
let
ghc = haskell.packages.${compiler}.ghcWithPackages (ps: with ps; [ cabal-install ]);
in
---
title: Why is servant a type-level DSL?
author: Alp Mestanogullari
date: 2018-07-43 20:00
toc: true
---
---
This post is an attempt at explaining servant's design as an embedded domain
@alpmestan
alpmestan / servant-flatten.hs
Created January 8, 2018 10:55
Flatten servant API types
{-# LANGUAGE DataKinds #-}
{-# LANGUAGE PolyKinds #-}
{-# LANGUAGE TypeFamilies #-}
{-# LANGUAGE TypeOperators #-}
{-# LANGUAGE FlexibleContexts #-}
{-# LANGUAGE UndecidableInstances #-}
import Data.Proxy
import GHC.TypeLits
import Servant.API
type Flat api = Reassoc (Flatten api)
-- | Completely flattens an API type by applying a few simple transformations.
-- The goal is to end up with an aPI type where things like @a :> (b :<|> c)@
-- are rewritten to @a :> b :<|> a :> c@, so as to have client with very simple
-- types, instead of "nested clients".
type family Flatten (api :: k) :: k where
Flatten ((a :: k) :> (b :<|> c)) = a :> Flatten b :<|> Flatten (a :> c)
Flatten ((a :<|> b) :> c) = a :> Flatten c :<|> (Flatten (b :> c))
Flatten ((a :: k) :> b) = Redex b (Flatten b) a
@alpmestan
alpmestan / config.nix
Created November 6, 2017 13:54
To put in ~/.config/nixpkgs/
{
packageOverrides = ps: rec {
haskell.compiler = ps.haskell.compiler // {
myghc = ps.haskell.compiler.ghcHEAD.overrideDerivation (p: {
src = fetchgit {
url = "git://git.haskell.org/ghc.git";
rev = "commit hash here";
sha256 = "sha that nix computes for this";
};
});
@alpmestan
alpmestan / servant-valuelevel.hs
Last active January 2, 2019 23:08
Anonymous """value-level""" servant API type definition
{-# LANGUAGE DataKinds #-}
{-# LANGUAGE RankNTypes #-}
{-# LANGUAGE TypeOperators #-}
import Data.Proxy
import GHC.TypeLits
import Servant.API
infixr 9 >:>
infixr 8 <||>
@alpmestan
alpmestan / redirect.hs
Created October 17, 2017 12:10
servant redirects, new generation
{-
$ curl -X POST localhost:9876/dog -v
* Connected to localhost (127.0.0.1) port 9876 (#0)
> POST /dog HTTP/1.1
> Host: localhost:9876
> User-Agent: curl/7.55.1
> Accept: */*
>
< HTTP/1.1 301 Moved Permanently
< Transfer-Encoding: chunked