Use the template haskell (abbreviated to "TH") extension in a module with:
{-# LANGUAGE TemplateHaskell #-}There are a few key pieces of syntax:
| {-# OPTIONS_GHC -fno-warn-type-defaults #-} | |
| {-# LANGUAGE TypeFamilies #-} | |
| {-# LANGUAGE GADTs #-} | |
| {-# LANGUAGE ExtendedDefaultRules #-} | |
| {-# LANGUAGE LambdaCase #-} | |
| {-# LANGUAGE OverloadedStrings #-} | |
| {-# LANGUAGE TypeApplications #-} | |
| {-# LANGUAGE TypeOperators #-} | |
| {-# LANGUAGE ScopedTypeVariables #-} | |
| {-# LANGUAGE StandaloneDeriving #-} |
| $ stack exec maintainer | |
| Downloading https://api.github.com/user/repos?per_page=100&page=1 | |
| Downloading https://api.github.com/user/repos?per_page=100&page=2 | |
| Downloading https://api.github.com/user/repos?per_page=100&page=3 | |
| Downloading https://api.github.com/user/repos?per_page=100&page=4 | |
| Downloading https://api.github.com/user/repos?per_page=100&page=5 | |
| Downloading https://api.github.com/repos/haskell-perf/checklist/issues?state=open&sort=updated&direction=asc&per_page=100&page=1 | |
| Downloading https://api.github.com/repos/fpco/halogen-form/issues?state=open&sort=updated&direction=asc&per_page=100&page=1 | |
| Downloading https://api.github.com/repos/fpco/haskell.fpcomplete.com/issues?state=open&sort=updated&direction=asc&per_page=100&page=1 | |
| Downloading https://api.github.com/repos/fpco/odbc/issues?state=open&sort=updated&direction=asc&per_page=100&page=1 |
| (defvar server) | |
| (progn | |
| (delete-process server) | |
| (let ((coding-system-for-read 'binary)) | |
| (setq server | |
| (make-network-process | |
| :name "image-server" | |
| :buffer "*image-server*" | |
| :family 'ipv4 | |
| :service 9009 |
| (defvar server) | |
| (progn | |
| (delete-process server) | |
| (let ((coding-system-for-read 'binary)) | |
| (setq server | |
| (make-network-process | |
| :name "image-server" | |
| :buffer "*image-server*" | |
| :family 'ipv4 | |
| :service 9009 |
| {-# LANGUAGE BangPatterns #-} | |
| module Test (it) where | |
| it :: Int | |
| it = fibs Test.!! 49 | |
| fibs :: [Int] | |
| fibs = 1 : 1 : zipWith (+) fibs (tail fibs) |
| chris@precision:~/Work/chrisdone/prana/test-project$ stack build | |
| array-0.5.2.0: configure | |
| array-0.5.2.0: build | |
| array-0.5.2.0: copy/register | |
| test-project-0: configure (lib) | |
| Configuring test-project-0... | |
| test-project-0: build (lib) | |
| Preprocessing library for test-project-0.. | |
| Building library for test-project-0.. | |
| [1 of 1] Compiling Test ( Test.hs, .stack-work/dist/x86_64-linux/Cabal-2.2.0.1/build/Test.o ) |
| chris@precision:~$ docker run --rm -it --network host --name graphqcurl -v`pwd`:`pwd` -w`pwd`/server/ hasura/graphql-engine-console-builder:20190515 sh | |
| # npm install -g graphqurl | |
| npm ERR! write after end | |
| npm ERR! A complete log of this run can be found in: | |
| npm ERR! /root/.npm/_logs/2019-05-28T10_27_09_410Z-debug.log | |
| # | |
| chris@precision:~$ docker run --rm -it --network host --name graphqcurl -v`p`pwd` -w`pwd`/server/ hasura/graphql-engine-console-builder:20190515 sh | |
| # npm install -g graphqurl | |
| npm ERR! write after end |
| chris@precision:~/Work/chrisdone/prana$ time sh prana-ghc/regenerate.sh | |
| + stack build --test --no-run-tests | |
| prana-interpreter-0: Test running disabled by --no-run-tests flag. | |
| Log files have been written to: /home/chris/Work/chrisdone/prana/.stack-work/logs/ | |
| + rm -r /home/chris/Work/chrisdone/prana/prana-dir/ | |
| + mkdir -p /home/chris/Work/chrisdone/prana/prana-dir/packages/ | |
| + cd /home/chris/Work/chrisdone/prana/ghc-8.4/libraries/ghc-prim/ | |
| + PRANA_DIR=/home/chris/Work/chrisdone/prana/prana-dir/ PRANA_MODE=INSTALL time -p -- ./Setup build --ghc-options=-O0 | |
| Preprocessing library for ghc-prim-0.5.2.0.. |
| {-# LANGUAGE MagicHash, UnboxedTuples #-} | |
| -- | Test some of the ops for Array# and MutableArray#. | |
| module ArrayTest where | |
| import GHC.Exts | |
| import GHC.Types (IO(..)) | |
| it :: IO (Char, Int, Char) |