Skip to content

Commit

Permalink
support ghc-9.10 (#1367)
Browse files Browse the repository at this point in the history
  • Loading branch information
larskuhtz authored Jul 4, 2024
1 parent 4c0acc5 commit 1be992a
Show file tree
Hide file tree
Showing 18 changed files with 280 additions and 73 deletions.
26 changes: 13 additions & 13 deletions .github/workflows/applications.yml
Original file line number Diff line number Diff line change
Expand Up @@ -18,15 +18,15 @@ jobs:
strategy:
fail-fast: false
matrix:
ghc: ['9.6']
cabal: ['3.10']
os: ['ubuntu-20.04', 'ubuntu-22.04', 'macos-latest', 'macos-14']
ghc: ['9.6.6', '9.8.2', '9.10.1']
cabal: ['3.12']
os: ['ubuntu-20.04', 'ubuntu-22.04', 'macos-14']
cabalcache: ['true']
flags: ['+build-tool']
include:
- os: 'ubuntu-20.04'
ghc: '9.6'
cabal: '3.10'
- os: 'ubuntu-22.04'
ghc: '9.8.2'
cabal: '3.12'
cabalcache: 'true'
flags: '-build-tool'
env:
Expand All @@ -40,7 +40,7 @@ jobs:

steps:
- name: Checkout repository
uses: actions/checkout@v3
uses: actions/checkout@v4

# Non Haskell dependencies

Expand Down Expand Up @@ -70,7 +70,7 @@ jobs:
- name: Print Z3 version
shell: bash
run: z3 -version

# Haskell Setup
- name: Set permissions for .ghcup (ubuntu)
if: startsWith(matrix.os, 'ubuntu-')
Expand Down Expand Up @@ -143,11 +143,11 @@ jobs:
cabal freeze
- name: Sync from cabal cache
if: matrix.cabalcache == 'true'
uses: larskuhtz/cabal-cache-action@018b7ae0c480ba3dc4fa0cfa3a0bc1f05b7724b3
uses: larskuhtz/cabal-cache-action@4b537195b33898fcd9adc62cee2a44986fd7b1b6
with:
bucket: "kadena-cabal-cache"
region: "us-east-1"
folder: "${{ matrix.os }}"
folder: "packages/${{ matrix.os }}"
aws_access_key_id: "${{ secrets.kadena_cabal_cache_aws_access_key_id }}"
aws_secret_access_key: "${{ secrets.kadena_cabal_cache_aws_secret_access_key }}"
- name: Build dependencies
Expand Down Expand Up @@ -219,8 +219,8 @@ jobs:
fail-fast: false
matrix:
include:
- ghc: "9.6"
os: "ubuntu-20.04"
- ghc: "9.6.6"
os: "ubuntu-22.04"
env:
OS: ${{ matrix.os }}
steps:
Expand All @@ -236,7 +236,7 @@ jobs:
FROM ubuntu:${OS#ubuntu-}
LABEL com.chainweb.docker.image.compiler="ghc-${{ matrix.ghc }}"
LABEL com.chainweb.docker.image.os="${{ matrix.os }}"
RUN apt-get update && apt-get install -y ca-certificates libgmp10 libssl1.1 zlib1g locales && rm -rf /var/lib/apt/lists/* && locale-gen en_US.UTF-8 && update-locale LC_ALL=en_US.UTF-8 LANG=en_US.UTF-8
RUN apt-get update && apt-get install -y ca-certificates libgmp10 libssl3 zlib1g locales && rm -rf /var/lib/apt/lists/* && locale-gen en_US.UTF-8 && update-locale LC_ALL=en_US.UTF-8 LANG=en_US.UTF-8
ENV LANG=en_US.UTF-8
WORKDIR /pact
COPY pact/pact .
Expand Down
8 changes: 4 additions & 4 deletions .github/workflows/nix.yml
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ on:

jobs:
build-and-cache-on-bigubuntu:
runs-on:
runs-on:
group: bigrunner
timeout-minutes: 740
strategy:
Expand All @@ -20,7 +20,7 @@ jobs:
uses: actions/checkout@v3

- name: Set up Nix with caching
uses: kadena-io/setup-nix-with-cache/by-root@v3.1
uses: kadena-io/setup-nix-with-cache/by-root@v3.2
with:
cache_url: s3://nixcache.chainweb.com?region=us-east-1
signing_private_key: ${{ secrets.NIX_CACHE_PRIVATE_KEY }}
Expand All @@ -43,7 +43,7 @@ jobs:
echo Build the recursive output
nix build .#recursive.allDerivations --log-lines 500 --show-trace
- name: Verify pact binary
run: |
echo Validating pact version
Expand Down Expand Up @@ -89,4 +89,4 @@ jobs:
run: |
echo Validating pact version
nix run pact --version
7 changes: 4 additions & 3 deletions cabal.project
Original file line number Diff line number Diff line change
Expand Up @@ -45,12 +45,13 @@ allow-newer: *:template-haskell
allow-newer: *:base
allow-newer: *:ghc-prim

-- Patch merged into master (upcoming verison 10.0). We are currently using 9.2
-- Patch merged into master (upcoming verison 10.0). We are currently using 9.2.
-- This fork contains additional fixes for using 9.2 with recent compilers.
source-repository-package
type: git
tag: 3946a0e94470d7403a855dd60f8e54687ecc2b1d
tag: 1f2d042718fcf9a140398bd3dedac77c207cce27
location: https://github.com/larskuhtz/sbv
--sha256: 1msbz6525nmsywpm910jh23siil4qgn3rpsm52m8j6877r7v5zw3
--sha256: sha256-Y2ZRU9lkrClYiNc8apwy4uO1TAvJ8JZEPKF73ZuGdlA=

-- Servant is notoriously forcing outdated upper bounds onto its users.
-- It is usually safe to just ignore those.
Expand Down
85 changes: 49 additions & 36 deletions flake.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

11 changes: 9 additions & 2 deletions flake.nix
Original file line number Diff line number Diff line change
Expand Up @@ -2,11 +2,18 @@
description = "Kadena's Pact smart contract language";

inputs = {
hs-nix-infra.url = "github:kadena-io/hs-nix-infra";
hackage = {
url = "github:input-output-hk/hackage.nix";
flake = false;
};
hs-nix-infra = {
url = "github:kadena-io/hs-nix-infra";
inputs.hackage.follows = "hackage";
};
flake-utils.url = "github:numtide/flake-utils";
};

outputs = { self, hs-nix-infra, flake-utils }:
outputs = { self, hs-nix-infra, flake-utils, ... }:
flake-utils.lib.eachSystem
[ "x86_64-linux" "x86_64-darwin"
"aarch64-linux" "aarch64-darwin" ] (system:
Expand Down
56 changes: 56 additions & 0 deletions lib/unsafe/src/Data/Foldable/Unsafe.hs
Original file line number Diff line number Diff line change
@@ -0,0 +1,56 @@
{-# LANGUAGE CPP #-}

#if MIN_VERSION_base(4,20,0)
{-# OPTIONS_GHC -Wno-x-partial #-}
#endif


-- |
-- Module: unsafe.Data.Foldable.Unsafe
-- Copyright: Copyright © 2024 Kadena LLC.
-- License: MIT
-- Maintainer: Pact Team
-- Stability: experimental
--
-- This module provides unsafe versions for all functions in "Data.Foldable"
-- that are either partial or return a 'Maybe' value.
--
module Data.Foldable.Unsafe
(
-- * Unsafe versions of partial functions
unsafeMaximum
, unsafeMaximumBy
, unsafeMinimum
, unsafeMinimumBy

-- * Unsafe versions of functions that return 'Maybe' values
, unsafeFind
) where

import Data.Foldable

import GHC.Stack

-- -------------------------------------------------------------------------- --
-- Unsafe versions of partial functions

unsafeMaximum :: HasCallStack => Foldable t => Ord a => t a -> a
unsafeMaximum = maximum

unsafeMaximumBy :: HasCallStack => Foldable t => (a -> a -> Ordering) -> t a -> a
unsafeMaximumBy = maximumBy

unsafeMinimum :: HasCallStack => (Foldable t, Ord a) => t a -> a
unsafeMinimum = minimum

unsafeMinimumBy :: HasCallStack => Foldable t => (a -> a -> Ordering) -> t a -> a
unsafeMinimumBy = minimumBy

-- -------------------------------------------------------------------------- --
-- Unsafe versions of functions that return Maybe

unsafeFind :: HasCallStack => Foldable t => (a -> Bool) -> t a -> a
unsafeFind a b = case find a b of
Nothing -> error "Data.List.Unsafe.unsafeFind: not found"
Just x -> x

Loading

0 comments on commit 1be992a

Please sign in to comment.