Skip to content

Instantly share code, notes, and snippets.

@chrisdone
Created May 28, 2019 14:56
Show Gist options
  • Save chrisdone/a04caedf89ad19dacf5771078a846ff7 to your computer and use it in GitHub Desktop.
Save chrisdone/a04caedf89ad19dacf5771078a846ff7 to your computer and use it in GitHub Desktop.
resolver: ghc-8.4.3
compiler: ghc-8.4.3
name: prana-8.4.3
# Packages to build with prana
packages:
- bytestring-0.10.8.2
- unix-2.7.2.2
- time-1.8.0.2
- hpc-0.6.0.3
- filepath-1.4.2
- process-1.6.3.0
- array-0.5.2.0
- containers-0.5.11.0
- binary-0.8.5.1
- terminfo-0.4.1.1
- transformers-0.5.5.0
- deepseq-1.4.3.0
- pretty-1.1.3.6
- directory-1.3.1.5
drop-packages:
# Packages never to build with prana
# - rts-1.0
# - ghc-prim-0.5.2.0
# - integer-gmp-1.0.2.0
# - base-4.11.1.0
# - ghci-8.4.3
# - ghc-boot-8.4.3
# - ghc-boot-th-8.4.3
# - ghc-8.4.3
# - template-haskell-2.13.0.0
# Packages to build with prana
- bytestring
- unix
- time
- hpc
- filepath
- process
- array
- containers
- binary
- terminfo
- transformers
- deepseq
- pretty
- directory
resolver: prana-8.4.3.yaml
system-ghc: true
skip-ghc-check: true
extra-path:
- /home/chris/Work/chrisdone/prana/.stack-work/install/x86_64-linux/lts-12.12/8.4.3/bin-prana/
- /home/chris/.stack/programs/x86_64-linux/ghc-8.4.3/bin/
Name: test-project
Version: 0
Copyright: XXX
License: BSD3
Category: Development
build-type: Simple
cabal-version: >=1.10
library
default-language:
Haskell2010
exposed-modules:
Test
build-depends:
base
, bytestring
, unix
, time
, hpc
, filepath
, process
, array
, containers
, binary
, terminfo
, transformers
, deepseq
, pretty
, directory
{-# LANGUAGE BangPatterns #-}
module Test (it) where
it :: Int
it = fibs Test.!! 49
fibs :: [Int]
fibs = 1 : 1 : zipWith (+) fibs (tail fibs)
-- | We implement our own Integer-based !! to force use of
-- MultiValAlts -- using unboxed tuples for a loop. The regular
-- Prelude.!! works fine, but tests less of the interpreter than this
-- implementation.
(!!) :: [p] -> Integer -> p
xs !! n
| otherwise =
foldr
(\x r k ->
case k of
0 -> x
_ -> r (k - 1))
(error "too large")
xs
n
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment