Database records and formlets and optionally populated records can be neatly all represented with the same data type when the fields are all indexed.
class Indexed i a where
type Index i (a :: *)| {-# LANGUAGE FlexibleInstances #-} | |
| {-# LANGUAGE TypeSynonymInstances #-} | |
| {-# LANGUAGE DeriveGeneric #-} | |
| {-# LANGUAGE MultiParamTypeClasses #-} | |
| {-# LANGUAGE ScopedTypeVariables #-} | |
| {-# LANGUAGE OverloadedStrings #-} | |
| {-# LANGUAGE DataKinds #-} | |
| {-# LANGUAGE TypeOperators #-} | |
| {-# OPTIONS_GHC -fno-warn-orphans #-} |
| #!/usr/bin/env stack | |
| -- stack --resolver lts-12.12 script | |
| {-# LANGUAGE OverloadedStrings #-} | |
| -- Just an API description, no service | |
| import Servant.API | |
| type MyAPI = EmptyAPI | |
| main = pure () |
| chris@precision:~/Work/chrisdone/prana/ghc-8.4/libraries/ghc-prim$ PRANA_DIR=~/Work/chrisdone/prana/prana-dir/ ./Setup build --ghc-options="-O0" | |
| Preprocessing library for ghc-prim-0.5.2.0.. | |
| Building library for ghc-prim-0.5.2.0.. | |
| [1 of 8] Compiling GHC.Types | |
| [2 of 8] Compiling GHC.IntWord64 | |
| [3 of 8] Compiling GHC.CString | |
| [4 of 8] Compiling GHC.Tuple | |
| [5 of 8] Compiling GHC.PrimopWrappers | |
| [6 of 8] Compiling GHC.Debug | |
| [7 of 8] Compiling GHC.Magic |
| #!/usr/bin/env stack | |
| -- stack --resolver lts-12.12 script | |
| import Options.Applicative.Simple | |
| import Data.Semigroup ((<>)) | |
| data Sample = | |
| Sample | |
| { sampleEnable :: Bool | |
| , sampleUrl :: String |
| {-# LANGUAGE OverloadedStrings #-} | |
| import qualified Spf | |
| main :: IO () | |
| main = do | |
| serv <- Spf.newSpfServer Spf.SPF_DNS_CACHE Spf.ModerateLevel | |
| result <- | |
| Spf.makeSpfRequest | |
| serv | |
| (Spf.SpfRequest | |
| { Spf.spfRequestIpV4 = "130.211.0.0" |
| import SimplStg | |
| import Control.Monad | |
| import Control.Monad.Trans | |
| import CorePrep | |
| import CoreSyn | |
| import CoreToStg | |
| import CostCentre | |
| import DynFlags | |
| import GHC | |
| import GHC.Paths (libdir) |
Detecting whether we should compile the whole module or just changed definitions within the module context:
| {-# LANGUAGE TemplateHaskellQuotes #-} | |
| {-# LANGUAGE LambdaCase, ViewPatterns #-} | |
| -- | Trace declarations or expression bindings. | |
| {- | |
| tracing [d| | |
| ... | |
| |] | |
| -} |
| {-# OPTIONS_GHC -fno-warn-orphans #-} | |
| {-# LANGUAGE FlexibleInstances #-} | |
| {-# LANGUAGE StandaloneDeriving #-} | |
| -- | Print STG in GHC 8.4.3. | |
| module Main where | |
| import Control.Monad.IO.Class (liftIO) | |
| import qualified CorePrep |