Skip to content
Snippets Groups Projects

Compare revisions

Changes are shown as if the source revision was being merged into the target revision. Learn more about comparing revisions.

Source

Select target project
No results found
Select Git revision
  • FinleyMcIlwaine-master-patch-27418
  • alex
  • bifunctors-5.5.8
  • ci-test
  • drop-9.2-support
  • extra
  • finley/hls-9.6-patches
  • finley/hls-9.6-patches-2
  • fix-1
  • foliage
  • ghc-bignum
  • ghc-from
  • hgeometry-deriveds
  • master
  • rts-stats
  • small-improvements
  • staging
  • sv/ghcide-findercache
  • teo/more-c-deps
  • upstream-testing
  • wip/T93
  • wip/aarch64-ci
  • wip/add-ihaskell
  • wip/atomic-counters
  • wip/benchmarks
  • wip/bgamari
  • wip/bifunctor
  • wip/broken-what34
  • wip/bump
  • wip/constraints
  • wip/docker-bump
  • wip/docker-env
  • wip/fix-ghc-lib-parser
  • wip/fix-repo
  • wip/fix-restricted-eval
  • wip/fix-upstream-url
  • wip/flake-aarch64
  • wip/foliage
  • wip/ghc-11112-b
  • wip/ghc-debug-bump
  • wip/ghc-debug-commit
  • wip/ghc-debug-tests
  • wip/ghc-exactprint
  • wip/ghc-tcplugins
  • wip/ghcide
  • wip/ghcide-2.9.0.0
  • wip/happy-1.20.0-GHC9.6
  • wip/liquidhaskell
  • wip/luite/fix-ghcide-910
  • wip/mi_globals_liquidhaskell_boot
  • wip/microstache
  • wip/monomorphic-list
  • wip/no-update-branch-on-mr
  • wip/parallel-builds
  • wip/pizza-rolls
  • wip/romes/extend
  • wip/romes/hpt-refactor
  • wip/sand-witch/revert-th-argpat
  • wip/separate-logs
  • wip/signal-9
  • wip/stackage-snapshots
  • wip/stackage-wip
  • wip/staged-pipeline
  • wip/teo/bump-ghc-debug
  • wip/teo/containers-0.8
  • wip/teo/linear-broken
  • wip/text-2.0
  • wip/update-doctest-patch
  • wip/vty-5.36
  • wip/windows
  • wip/zubin-stackage
71 results

Target

Select target project
  • ghc/head.hackage
  • RyanGlScott/head.hackage
  • vaibhavsagar/head.hackage
  • phadej/head.hackage
  • jessoune29/head.hackage
  • alanz/head.hackage
  • clint/head.hackage
  • osa1/head.hackage
  • supersven/head.hackage
  • fendor/head.hackage
  • hsyl20/head.hackage
  • adinapoli/head.hackage
  • alexbiehl/head.hackage
  • mimi.vx/head.hackage
  • Kleidukos/head.hackage
  • wz1000/head.hackage
  • alinab/head.hackage
  • teo/head.hackage
  • duog/head.hackage
  • sheaf/head.hackage
  • expipiplus1/head.hackage
  • drsooch/head.hackage
  • tobias/head.hackage
  • brandonchinn178/head.hackage
  • mpickering/hooks-setup-testing
  • Mikolaj/head.hackage
  • RandomMoonwalker/head.hackage
  • facundominguez/head.hackage
  • trac-fizzixnerd/head.hackage
  • neil.mayhew/head.hackage
  • jappeace/head.hackage
31 results
Select Git revision
  • build-constraints
  • core-lint
  • drop-old-patches
  • fix-1
  • fix-ci
  • ghc-from
  • gitlab-ci
  • gitlab-ci-nix
  • hackage-deploy
  • master
  • patch-1
  • patch-2
  • patch-3
  • patch-4
  • patch-5
  • patch-tool-fixes
16 results
Show changes
Showing
with 1859 additions and 859 deletions
diff --git a/.ghci b/.ghci
new file mode 100644
index 0000000..b729eb0
--- /dev/null
+++ b/.ghci
@@ -0,0 +1,28 @@
+:set -Wall -fno-warn-name-shadowing -Wcompat
+:set -Wincomplete-record-updates -Wincomplete-uni-patterns -Wredundant-constraints
+:set -Wunused-binds -Wunused-imports -Worphans
+
+:set -isrc
+:set -itest
+
+:set -XFlexibleContexts
+:set -XFlexibleInstances
+:set -XGeneralizedNewtypeDeriving
+:set -XScopedTypeVariables
+:set -XTupleSections
+:set -XTypeFamilies
+
+:load Main Algebra.Graph.Labelled.Example.Automaton Algebra.Graph.Labelled.Example.Network
+
+:set prompt "\x03BB> "
+:set prompt-cont "\x03BB| "
+:!cls
+
+:{
+:def alga \top -> return $ unlines $
+ [ ":set -XOverloadedLists"
+ , ":set -XOverloadedStrings"
+ , ":set -fno-warn-type-defaults"
+ , ":m Algebra.Graph" ++ (if null top then "" else ".") ++ top
+ , ":show imports" ]
+:}
diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml
new file mode 100644
index 0000000..dcce6e2
--- /dev/null
+++ b/.github/workflows/ci.yml
@@ -0,0 +1,42 @@
+on:
+ push:
+ pull_request:
+ schedule:
+ - cron: '0 3 * * 6' # 3am Saturday
+ workflow_dispatch:
+
+jobs:
+ test:
+ runs-on: ${{ matrix.os }}
+
+ strategy:
+ fail-fast: false
+ matrix:
+ os: [ubuntu-latest]
+ ghc: ['9.8.2', '9.6.3', '9.4.7', '9.2.8', '9.0.2', '8.10.7']
+ include:
+ - os: windows-latest
+ # Testing on MacOS is disabled until GitHub actions support 'allow-failure'
+ # - os: macOS-latest
+
+ steps:
+ - run: git config --global core.autocrlf false
+ - uses: actions/checkout@v4
+ - uses: haskell-actions/setup@v2
+ id: setup-haskell
+ with:
+ ghc-version: ${{ matrix.ghc }}
+ - name: Get GHC libdir
+ id: get-ghc-libdir
+ run: |
+ echo "name=libdir::$(ghc --print-libdir)" >> $GITHUB_OUTPUT
+ shell: bash
+ - run: cabal v2-freeze --enable-tests
+ - uses: actions/cache@v4
+ with:
+ path: ${{ steps.setup-haskell.outputs.cabal-store }}
+ key: ${{ runner.os }}-${{ matrix.ghc }}-${{ steps.get-ghc-libdir.outputs.libdir }}-${{ hashFiles('cabal.project.freeze') }}
+ - uses: snowleopard/neil@master
+ with:
+ github-user: snowleopard
+ hlint-arguments: src
diff --git a/.gitignore b/.gitignore
new file mode 100644
index 0000000..2684ce5
--- /dev/null
+++ b/.gitignore
@@ -0,0 +1,27 @@
+dist
+dist-*
+.ghc.environment.*
+cabal-dev
+*.o
+*.hi
+*.chi
+*.chs.h
+*.dyn_o
+*.dyn_hi
+.hpc
+.hsenv
+.cabal-sandbox/
+cabal.sandbox.config
+*.prof
+*.aux
+*.hp
+*.eventlog
+.stack-work/
+cabal.project.local
+ghcid.txt
+.vscode/
+*.swp
+*.swo
+*.swn
+.log
+stack.yaml.lock
diff --git a/.hlint.yaml b/.hlint.yaml
new file mode 100644
index 0000000..7c154f9
--- /dev/null
+++ b/.hlint.yaml
@@ -0,0 +1,67 @@
+# HLint configuration file
+# https://github.com/ndmitchell/hlint
+##########################
+
+# This file contains a template configuration file, which is typically
+# placed as .hlint.yaml in the root of your project
+
+# Specify additional command line arguments
+#
+# - arguments: [--color, --cpp-simple, -XQuasiQuotes]
+
+# Control which extensions/flags/modules/functions can be used
+#
+# - extensions:
+# - default: false # all extension are banned by default
+# - name: [PatternGuards, ViewPatterns] # only these listed extensions can be used
+# - {name: CPP, within: CrossPlatform} # CPP can only be used in a given module
+#
+# - flags:
+# - {name: -w, within: []} # -w is allowed nowhere
+#
+# - modules:
+# - {name: [Data.Set, Data.HashSet], as: Set} # if you import Data.Set qualified, it must be as 'Set'
+# - {name: Control.Arrow, within: []} # Certain modules are banned entirely
+#
+# - functions:
+# - {name: unsafePerformIO, within: []} # unsafePerformIO can only appear in no modules
+
+# Add custom hints for this project
+#
+# Will suggest replacing "wibbleMany [myvar]" with "wibbleOne myvar"
+# - error: {lhs: "wibbleMany [x]", rhs: wibbleOne x}
+
+# The hints are named by the string they display in warning messages.
+# For example, if you see a warning starting like
+#
+# Main.hs:116:51: Warning: Redundant ==
+#
+# You can refer to that hint with `{name: Redundant ==}` (see below).
+
+# Turn on hints that are off by default
+#
+# Ban "module X(module X) where", to require a real export list
+# - warn: {name: Use explicit module export list}
+#
+# Replace a $ b $ c with a . b $ c
+# - group: {name: dollar, enabled: true}
+#
+# Generalise map to fmap, ++ to <>
+# - group: {name: generalise, enabled: true}
+
+# Ignore some builtin hints
+# - ignore: {name: Use const, within: SpecialModule} # Only within certain modules
+
+- ignore:
+ name: Use if
+ within: Algebra.Graph.Bipartite.AdjacencyMap.Algorithm
+
+- ignore:
+ name: Avoid NonEmpty.unzip
+ within: Algebra.Graph.NonEmpty.AdjacencyMap
+
+# Define some custom infix operators
+# - fixity: infixr 3 ~^#^~
+
+# To generate a suitable file for HLint do:
+# $ hlint --default > .hlint.yaml
diff --git a/CHANGES.md b/CHANGES.md
index d391d4d..05209ba 100644
--- a/CHANGES.md
+++ b/CHANGES.md
@@ -1,5 +1,10 @@
# Change log
+## 0.8
+
+* #305, #312: Support GHC 9.4, GHC 9.6 and GHC 9.8.
+* #303, #314: Stop supporting GHC 8.4, GHC 8.6 and GHC 8.8.
+
## 0.7
* #294: Change the argument order of `bfs*`, `dfs*` and `reachable` algorithms.
diff --git a/LICENSE b/LICENSE
index 2a4d793..a876d01 100644
--- a/LICENSE
+++ b/LICENSE
@@ -1,6 +1,6 @@
MIT License
-Copyright (c) 2016-2022 Andrey Mokhov
+Copyright (c) 2016-2024 Andrey Mokhov
Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal
diff --git a/README.md b/README.md
index c92f8f7..ac78cf6 100644
--- a/README.md
+++ b/README.md
@@ -1,6 +1,6 @@
# Algebraic graphs
-[![Hackage version](https://img.shields.io/hackage/v/algebraic-graphs.svg?label=Hackage)](https://hackage.haskell.org/package/algebraic-graphs) [![Build status](https://img.shields.io/github/workflow/status/snowleopard/alga/ci/master.svg)](https://github.com/snowleopard/alga/actions)
+[![Hackage version](https://img.shields.io/hackage/v/algebraic-graphs.svg?label=Hackage)](https://hackage.haskell.org/package/algebraic-graphs) [![Build status](https://img.shields.io/github/actions/workflow/status/snowleopard/alga/ci.yml?branch=master)](https://github.com/snowleopard/alga/actions)
**Alga** is a library for algebraic construction and manipulation of graphs in Haskell. See
[this Haskell Symposium paper](https://github.com/snowleopard/alga-paper) and the
diff --git a/algebraic-graphs.cabal b/algebraic-graphs.cabal
index c180ffe..fb58b61 100644
--- a/algebraic-graphs.cabal
+++ b/algebraic-graphs.cabal
@@ -1,18 +1,18 @@
cabal-version: 2.2
name: algebraic-graphs
-version: 0.7
+version: 0.8
synopsis: A library for algebraic graph construction and transformation
license: MIT
license-file: LICENSE
author: Andrey Mokhov <andrey.mokhov@gmail.com>, github: @snowleopard
maintainer: Andrey Mokhov <andrey.mokhov@gmail.com>, github: @snowleopard,
Alexandre Moine <alexandre@moine.me>, github: @nobrakal
-copyright: Andrey Mokhov, 2016-2022
+copyright: Andrey Mokhov, 2016-2024
homepage: https://github.com/snowleopard/alga
bug-reports: https://github.com/snowleopard/alga/issues
category: Algebra, Algorithms, Data Structures, Graphs
build-type: Simple
-tested-with: GHC==9.2, GHC==9.0, GHC==8.10, GHC==8.8, GHC==8.6, GHC==8.4
+tested-with: GHC==9.8.2, GHC==9.6.3, GHC==9.4.7, GHC==9.2.8, GHC==9.0.2, GHC==8.10.7
description:
<https://github.com/snowleopard/alga Alga> is a library for algebraic construction and
manipulation of graphs in Haskell. See <https://github.com/snowleopard/alga-paper this paper>
@@ -68,10 +68,10 @@ source-repository head
common common-settings
build-depends: array >= 0.4 && < 0.6,
- base >= 4.11 && < 5,
- containers >= 0.5.5.1 && < 0.8,
- deepseq >= 1.3.0.1 && < 1.5,
- transformers >= 0.4 && < 0.6
+ base >= 4.12 && < 5,
+ containers >= 0.5.5.1 && < 0.9,
+ deepseq >= 1.3.0.1 && < 1.6,
+ transformers >= 0.4 && < 0.7
default-language: Haskell2010
default-extensions: ConstraintKinds
DeriveFunctor
@@ -86,6 +86,7 @@ common common-settings
TupleSections
TypeApplications
TypeFamilies
+ TypeOperators
other-extensions: CPP
OverloadedStrings
RecordWildCards
@@ -162,6 +163,6 @@ test-suite main
build-depends: algebraic-graphs,
extra >= 1.4 && < 2,
inspection-testing >= 0.4.2.2 && < 0.6,
- QuickCheck >= 2.14 && < 2.15
+ QuickCheck >= 2.14 && < 2.16
other-extensions: ConstrainedClassMethods
TemplateHaskell
diff --git a/src/Algebra/Graph.hs b/src/Algebra/Graph.hs
index 4ab0aaf..5a15900 100644
--- a/src/Algebra/Graph.hs
+++ b/src/Algebra/Graph.hs
@@ -1,7 +1,7 @@
-----------------------------------------------------------------------------
-- |
-- Module : Algebra.Graph
--- Copyright : (c) Andrey Mokhov 2016-2022
+-- Copyright : (c) Andrey Mokhov 2016-2024
-- License : MIT (see the file LICENSE)
-- Maintainer : andrey.mokhov@gmail.com
-- Stability : experimental
@@ -56,7 +56,7 @@ import Control.Monad.Trans.State (runState, get, put)
import Data.Foldable (toList)
import Data.Maybe (fromMaybe)
import Data.String
-import Data.Tree
+import Data.Tree (Tree(..), Forest)
import GHC.Generics
import Algebra.Graph.Internal
diff --git a/src/Algebra/Graph/Acyclic/AdjacencyMap.hs b/src/Algebra/Graph/Acyclic/AdjacencyMap.hs
index e46d9e9..65fb007 100644
--- a/src/Algebra/Graph/Acyclic/AdjacencyMap.hs
+++ b/src/Algebra/Graph/Acyclic/AdjacencyMap.hs
@@ -1,7 +1,7 @@
-----------------------------------------------------------------------------
-- |
-- Module : Algebra.Graph.Acyclic.AdjacencyMap
--- Copyright : (c) Andrey Mokhov 2016-2022
+-- Copyright : (c) Andrey Mokhov 2016-2024
-- License : MIT (see the file LICENSE)
-- Maintainer : andrey.mokhov@gmail.com
-- Stability : experimental
diff --git a/src/Algebra/Graph/AdjacencyIntMap.hs b/src/Algebra/Graph/AdjacencyIntMap.hs
index c90d2db..e351bd2 100644
--- a/src/Algebra/Graph/AdjacencyIntMap.hs
+++ b/src/Algebra/Graph/AdjacencyIntMap.hs
@@ -1,7 +1,7 @@
-----------------------------------------------------------------------------
-- |
-- Module : Algebra.Graph.AdjacencyIntMap
--- Copyright : (c) Andrey Mokhov 2016-2022
+-- Copyright : (c) Andrey Mokhov 2016-2024
-- License : MIT (see the file LICENSE)
-- Maintainer : andrey.mokhov@gmail.com
-- Stability : experimental
@@ -51,7 +51,7 @@ import Data.IntSet (IntSet)
import Data.List ((\\))
import Data.Monoid (Sum (..))
import Data.Set (Set)
-import Data.Tree
+import Data.Tree (Tree(..), Forest)
import GHC.Generics
import qualified Data.IntMap.Strict as IntMap
diff --git a/src/Algebra/Graph/AdjacencyIntMap/Algorithm.hs b/src/Algebra/Graph/AdjacencyIntMap/Algorithm.hs
index f27c023..cb86177 100644
--- a/src/Algebra/Graph/AdjacencyIntMap/Algorithm.hs
+++ b/src/Algebra/Graph/AdjacencyIntMap/Algorithm.hs
@@ -2,7 +2,7 @@
-----------------------------------------------------------------------------
-- |
-- Module : Algebra.Graph.AdjacencyIntMap.Algorithm
--- Copyright : (c) Andrey Mokhov 2016-2022
+-- Copyright : (c) Andrey Mokhov 2016-2024
-- License : MIT (see the file LICENSE)
-- Maintainer : andrey.mokhov@gmail.com
-- Stability : unstable
diff --git a/src/Algebra/Graph/AdjacencyMap.hs b/src/Algebra/Graph/AdjacencyMap.hs
index 6ef5333..a67d50b 100644
--- a/src/Algebra/Graph/AdjacencyMap.hs
+++ b/src/Algebra/Graph/AdjacencyMap.hs
@@ -1,7 +1,7 @@
-----------------------------------------------------------------------------
-- |
-- Module : Algebra.Graph.AdjacencyMap
--- Copyright : (c) Andrey Mokhov 2016-2022
+-- Copyright : (c) Andrey Mokhov 2016-2024
-- License : MIT (see the file LICENSE)
-- Maintainer : andrey.mokhov@gmail.com
-- Stability : experimental
@@ -55,12 +55,13 @@ import Data.Map.Strict (Map)
import Data.Monoid
import Data.Set (Set)
import Data.String
-import Data.Tree
import GHC.Generics
+import Data.Tree (Tree(..), Forest)
import qualified Data.Map.Strict as Map
import qualified Data.Maybe as Maybe
import qualified Data.Set as Set
+import qualified Data.Tree as Tree
{-| The 'AdjacencyMap' data type represents a graph by a map of vertices to
their adjacency sets. We define a 'Num' instance as a convenient notation for
diff --git a/src/Algebra/Graph/AdjacencyMap/Algorithm.hs b/src/Algebra/Graph/AdjacencyMap/Algorithm.hs
index 3fb9f95..c3df293 100644
--- a/src/Algebra/Graph/AdjacencyMap/Algorithm.hs
+++ b/src/Algebra/Graph/AdjacencyMap/Algorithm.hs
@@ -2,7 +2,7 @@
-----------------------------------------------------------------------------
-- |
-- Module : Algebra.Graph.AdjacencyMap.Algorithm
--- Copyright : (c) Andrey Mokhov 2016-2022
+-- Copyright : (c) Andrey Mokhov 2016-2024
-- License : MIT (see the file LICENSE)
-- Maintainer : andrey.mokhov@gmail.com
-- Stability : unstable
@@ -33,16 +33,16 @@ import Data.Foldable (for_)
import Data.Either
import Data.List.NonEmpty (NonEmpty(..), (<|))
import Data.Maybe
-import Data.Tree
+import Data.Tree (Tree(..), Forest)
import Algebra.Graph.AdjacencyMap
-import Algebra.Graph.Internal
import qualified Algebra.Graph.NonEmpty.AdjacencyMap as NonEmpty
import qualified Data.Array as Array
import qualified Data.List as List
import qualified Data.Map.Strict as Map
import qualified Data.Set as Set
+import qualified Data.Tree as Tree
-- | Compute the /breadth-first search/ forest of a graph, such that adjacent
-- vertices are explored in increasing order according to their 'Ord' instance.
@@ -76,7 +76,7 @@ import qualified Data.Set as Set
bfsForest :: Ord a => AdjacencyMap a -> [a] -> Forest a
bfsForest x vs = evalState (explore [ v | v <- vs, hasVertex v x ]) Set.empty
where
- explore = filterM discovered >=> unfoldForestM_BF walk
+ explore = filterM discovered >=> Tree.unfoldForestM_BF walk
walk v = (v,) <$> adjacentM v
adjacentM v = filterM discovered $ Set.toList (postSet v x)
discovered v = do new <- gets (not . Set.member v)
@@ -109,7 +109,7 @@ bfsForest x vs = evalState (explore [ v | v <- vs, hasVertex v x ]) Set.empty
-- 'map' 'concat' . 'List.transpose' . 'map' 'levels' . 'bfsForest' x == bfs x
-- @
bfs :: Ord a => AdjacencyMap a -> [a] -> [[a]]
-bfs x = map concat . List.transpose . map levels . bfsForest x
+bfs x = map concat . List.transpose . map Tree.levels . bfsForest x
dfsForestFromImpl :: Ord a => AdjacencyMap a -> [a] -> Forest a
dfsForestFromImpl g vs = evalState (explore vs) Set.empty
@@ -202,7 +202,7 @@ dfsForestFrom g vs = dfsForestFromImpl g [ v | v <- vs, hasVertex v g ]
-- dfs ('circuit' [1..5] + 'circuit' [5,4..1]) [3] == [3,2,1,5,4]
-- @
dfs :: Ord a => AdjacencyMap a -> [a] -> [a]
-dfs x = concatMap flatten . dfsForestFrom x
+dfs x = concatMap Tree.flatten . dfsForestFrom x
-- | Return the list of vertices /reachable/ from a source vertex in a graph.
-- The vertices in the resulting list appear in the /depth-first search order/.
@@ -381,23 +381,25 @@ gabowSCC g =
-- called when exiting vertex v. if v is the bottom of a scc
-- boundary, we add a new SCC, otherwise v is part of a larger scc
-- being constructed and we continue.
- exit v = do newComponent <- (v==).snd.head <$> gets boundaryStack
- when newComponent $ insertComponent v
- return newComponent
+ exit v = do boundaryStack <- gets boundaryStack
+ case boundaryStack of
+ (p_top, top) : newBoundaryStack | v == top -> do
+ insertComponent p_top top newBoundaryStack
+ return True
- insertComponent v = modify'
- (\(SCC pre scc bnd pth pres sccs gs es_i es_o) ->
+ _ -> return False
+
+ insertComponent p_v v newBoundaryStack = modify'
+ (\(SCC pre scc _oldBoundaryStack pth pres sccs gs es_i es_o) ->
let (curr,v_pth') = span (/=v) pth
- pth' = tail v_pth' -- Here we know that v_pth' starts with v
+ pth' = drop 1 v_pth' -- Here we know that v_pth' starts with v
(es,es_i') = span ((>=p_v).fst) es_i
g_i | null es = vertex v
| otherwise = edges (snd <$> es)
- p_v = fst $ head bnd
scc' = scc + 1
- bnd' = tail bnd
sccs' = List.foldl' (\sccs x -> Map.insert x scc sccs) sccs (v:curr)
gs' = g_i:gs
- in SCC pre scc' bnd' pth' pres sccs' gs' es_i' es_o)
+ in SCC pre scc' newBoundaryStack pth' pres sccs' gs' es_i' es_o)
inedge uv = modify'
(\(SCC pre scc bnd pth pres sccs gs es_i es_o) ->
diff --git a/src/Algebra/Graph/Bipartite/AdjacencyMap.hs b/src/Algebra/Graph/Bipartite/AdjacencyMap.hs
index a451946..daefe4f 100644
--- a/src/Algebra/Graph/Bipartite/AdjacencyMap.hs
+++ b/src/Algebra/Graph/Bipartite/AdjacencyMap.hs
@@ -1,7 +1,7 @@
----------------------------------------------------------------------------
-- |
-- Module : Algebra.Graph.Bipartite.AdjacencyMap
--- Copyright : (c) Andrey Mokhov 2016-2022
+-- Copyright : (c) Andrey Mokhov 2016-2024
-- License : MIT (see the file LICENSE)
-- Maintainer : andrey.mokhov@gmail.com
-- Stability : experimental
@@ -53,19 +53,13 @@ module Algebra.Graph.Bipartite.AdjacencyMap (
consistent
) where
-import Control.Monad
-import Control.Monad.Trans.Maybe
-import Control.Monad.Trans.State
import Data.Either
-import Data.Foldable (asum)
import Data.List ((\\), sort)
import Data.Map.Strict (Map)
-import Data.Maybe
import Data.Set (Set)
import GHC.Exts (IsList(..))
import GHC.Generics
-import qualified Algebra.Graph as G
import qualified Algebra.Graph.AdjacencyMap as AM
import qualified Data.Map.Strict as Map
diff --git a/src/Algebra/Graph/Bipartite/AdjacencyMap/Algorithm.hs b/src/Algebra/Graph/Bipartite/AdjacencyMap/Algorithm.hs
index f9ee73f..5c7b062 100644
--- a/src/Algebra/Graph/Bipartite/AdjacencyMap/Algorithm.hs
+++ b/src/Algebra/Graph/Bipartite/AdjacencyMap/Algorithm.hs
@@ -2,7 +2,7 @@
----------------------------------------------------------------------------
-- |
-- Module : Algebra.Graph.Bipartite.AdjacencyMap.Algorithm
--- Copyright : (c) Andrey Mokhov 2016-2022
+-- Copyright : (c) Andrey Mokhov 2016-2024
-- License : MIT (see the file LICENSE)
-- Maintainer : andrey.mokhov@gmail.com
-- Stability : experimental
diff --git a/src/Algebra/Graph/Class.hs b/src/Algebra/Graph/Class.hs
index 4f6f78e..e9c7f7b 100644
--- a/src/Algebra/Graph/Class.hs
+++ b/src/Algebra/Graph/Class.hs
@@ -1,7 +1,7 @@
-----------------------------------------------------------------------------
-- |
-- Module : Algebra.Graph.Class
--- Copyright : (c) Andrey Mokhov 2016-2022
+-- Copyright : (c) Andrey Mokhov 2016-2024
-- License : MIT (see the file LICENSE)
-- Maintainer : andrey.mokhov@gmail.com
-- Stability : experimental
@@ -46,7 +46,7 @@ module Algebra.Graph.Class (
path, circuit, clique, biclique, star, tree, forest
) where
-import Data.Tree
+import Data.Tree (Tree(..), Forest)
import Algebra.Graph.Label (Dioid, one)
diff --git a/src/Algebra/Graph/Example/Todo.hs b/src/Algebra/Graph/Example/Todo.hs
index 9bf274c..ea6924b 100644
--- a/src/Algebra/Graph/Example/Todo.hs
+++ b/src/Algebra/Graph/Example/Todo.hs
@@ -1,5 +1,13 @@
{-# LANGUAGE OverloadedStrings #-}
-module Algebra.Graph.Example.Todo (Todo, todo, low, high, (~*~), (>*<), priority) where
+module Algebra.Graph.Example.Todo (
+ -- * Creating and manipulating to-do lists
+ Todo, todo, low, high, (~*~), (>*<), priority,
+
+ -- * Examples
+ shopping, holiday
+ ) where
+
+-- Based on https://blogs.ncl.ac.uk/andreymokhov/graphs-in-disguise/
import Data.Map (Map)
import Data.String
@@ -13,10 +21,10 @@ import qualified Data.Map as Map
data Todo a = T (Map a Int) (AdjacencyMap a) deriving Show
instance Ord a => Eq (Todo a) where
- x == y = todo x == todo y
+ x == y = todo x == todo y
instance (IsString a, Ord a) => IsString (Todo a) where
- fromString = C.vertex . fromString
+ fromString = C.vertex . fromString
-- Lower the priority of items in a given todo list
low :: Todo a -> Todo a
@@ -39,8 +47,7 @@ x ~*~ y = low x `C.connect` high y
x >*< y = high x `C.connect` low y
todo :: forall a. Ord a => Todo a -> Maybe [a]
-todo (T p g) =
- case AM.topSort $ gmap prioritise g of
+todo (T p g) = case AM.topSort $ gmap prioritise g of
Left _ -> Nothing
Right xs -> Just $ map snd xs
where
@@ -48,16 +55,26 @@ todo (T p g) =
prioritise x = (negate $ Map.findWithDefault 0 x p, x)
instance (IsString a, Ord a) => Num (Todo a) where
- fromInteger i = fromString $ show (fromInteger i :: Integer)
- (+) = C.overlay
- (*) = C.connect
- signum = const C.empty
- abs = id
- negate = id
+ fromInteger i = fromString $ show (fromInteger i :: Integer)
+ (+) = C.overlay
+ (*) = C.connect
+ signum = const C.empty
+ abs = id
+ negate = id
instance Ord a => Graph (Todo a) where
- type Vertex (Todo a) = a
- empty = T Map.empty AM.empty
- vertex x = T (Map.singleton x 0) (C.vertex x)
- overlay (T p1 g1) (T p2 g2) = T (Map.unionWith (+) p1 p2) (C.overlay g1 g2)
- connect (T p1 g1) (T p2 g2) = T (Map.unionWith (+) p1 p2) (C.connect g1 g2)
+ type Vertex (Todo a) = a
+ empty = T Map.empty AM.empty
+ vertex x = T (Map.singleton x 0) (C.vertex x)
+ overlay (T p1 g1) (T p2 g2) = T (Map.unionWith (+) p1 p2) (C.overlay g1 g2)
+ connect (T p1 g1) (T p2 g2) = T (Map.unionWith (+) p1 p2) (C.connect g1 g2)
+
+-- λ> todo shopping
+-- Just ["coat","presents","phone wife","scarf"]
+shopping :: Todo String
+shopping = "presents" + "coat" + "phone wife" ~*~ "scarf"
+
+-- λ> todo holiday
+-- Just ["coat","presents","phone wife","scarf","pack","travel"]
+holiday :: Todo String
+holiday = shopping * "pack" * "travel"
diff --git a/src/Algebra/Graph/Export.hs b/src/Algebra/Graph/Export.hs
index f2e9b54..f7d7707 100644
--- a/src/Algebra/Graph/Export.hs
+++ b/src/Algebra/Graph/Export.hs
@@ -2,7 +2,7 @@
-----------------------------------------------------------------------------
-- |
-- Module : Algebra.Graph.Export
--- Copyright : (c) Andrey Mokhov 2016-2022
+-- Copyright : (c) Andrey Mokhov 2016-2024
-- License : MIT (see the file LICENSE)
-- Maintainer : andrey.mokhov@gmail.com
-- Stability : experimental
@@ -37,7 +37,7 @@ import Algebra.Graph.Internal
-- implementation uses difference lists). Here @s@ is the type of abstract
-- symbols or strings (text or binary). 'Doc' @s@ is a 'Monoid', therefore
-- 'mempty' corresponds to the /empty document/ and two documents can be
--- concatenated with 'mappend' (or operator 'Data.Monoid.<>'). Documents
+-- concatenated with 'mappend' (or operator 'Data.Semigroup.<>'). Documents
-- comprising a single symbol or string can be constructed using the function
-- 'literal'. Alternatively, you can construct documents as string literals,
-- e.g. simply as @"alga"@, by using the @OverloadedStrings@ GHC extension. To
@@ -91,7 +91,7 @@ isEmpty (Doc xs) = null xs
-- constructed directly from string literals (see the second example below).
--
-- @
--- literal "Hello, " 'Data.Monoid.<>' literal "World!" == literal "Hello, World!"
+-- literal "Hello, " 'Data.Semigroup.<>' literal "World!" == literal "Hello, World!"
-- literal "I am just a string literal" == "I am just a string literal"
-- 'render' . literal == 'id'
-- @
@@ -101,8 +101,8 @@ literal = Doc . pure
-- | Render the document as a single string. An inverse of the function 'literal'.
--
-- @
--- render ('literal' "al" 'Data.Monoid.<>' 'literal' "ga") :: ('IsString' s, 'Monoid' s) => s
--- render ('literal' "al" 'Data.Monoid.<>' 'literal' "ga") == "alga"
+-- render ('literal' "al" 'Data.Semigroup.<>' 'literal' "ga") :: ('IsString' s, 'Monoid' s) => s
+-- render ('literal' "al" 'Data.Semigroup.<>' 'literal' "ga") == "alga"
-- render 'mempty' == 'mempty'
-- render . 'literal' == 'id'
-- @
diff --git a/src/Algebra/Graph/Export/Dot.hs b/src/Algebra/Graph/Export/Dot.hs
index 4770a2c..22ae461 100644
--- a/src/Algebra/Graph/Export/Dot.hs
+++ b/src/Algebra/Graph/Export/Dot.hs
@@ -2,7 +2,7 @@
-----------------------------------------------------------------------------
-- |
-- Module : Algebra.Graph.Export.Dot
--- Copyright : (c) Andrey Mokhov 2016-2022
+-- Copyright : (c) Andrey Mokhov 2016-2024
-- License : MIT (see the file LICENSE)
-- Maintainer : andrey.mokhov@gmail.com
-- Stability : experimental
@@ -21,7 +21,7 @@ module Algebra.Graph.Export.Dot (
export, exportAsIs, exportViaShow
) where
-import Data.List (map, null, intersperse)
+import Data.List (intersperse)
import Data.Monoid
import Data.String hiding (unlines)
import Prelude hiding (unlines)
diff --git a/src/Algebra/Graph/HigherKinded/Class.hs b/src/Algebra/Graph/HigherKinded/Class.hs
index 3a4426b..dcf480f 100644
--- a/src/Algebra/Graph/HigherKinded/Class.hs
+++ b/src/Algebra/Graph/HigherKinded/Class.hs
@@ -1,7 +1,7 @@
-----------------------------------------------------------------------------
-- |
-- Module : Algebra.Graph.HigherKinded.Class
--- Copyright : (c) Andrey Mokhov 2016-2022
+-- Copyright : (c) Andrey Mokhov 2016-2024
-- License : MIT (see the file LICENSE)
-- Maintainer : andrey.mokhov@gmail.com
-- Stability : experimental
@@ -54,7 +54,7 @@ module Algebra.Graph.HigherKinded.Class (
import Control.Applicative (Alternative(empty, (<|>)))
import Control.Monad (MonadPlus, mfilter)
-import Data.Tree
+import Data.Tree (Tree(..), Forest)
import qualified Algebra.Graph as G
diff --git a/src/Algebra/Graph/Internal.hs b/src/Algebra/Graph/Internal.hs
index 309c23b..05dc739 100644
--- a/src/Algebra/Graph/Internal.hs
+++ b/src/Algebra/Graph/Internal.hs
@@ -1,7 +1,7 @@
-----------------------------------------------------------------------------
-- |
-- Module : Algebra.Graph.Internal
--- Copyright : (c) Andrey Mokhov 2016-2022
+-- Copyright : (c) Andrey Mokhov 2016-2024
-- License : MIT (see the file LICENSE)
-- Maintainer : andrey.mokhov@gmail.com
-- Stability : experimental
@@ -29,13 +29,11 @@ module Algebra.Graph.Internal (
import Data.Coerce
import Data.Foldable
-import Data.IntSet (IntSet)
import Data.Semigroup (Endo (..))
import Data.Set (Set)
-import qualified Data.IntSet as IntSet
-import qualified Data.Set as Set
-import qualified GHC.Exts as Exts
+import qualified Data.Set as Set
+import qualified GHC.Exts as Exts
-- | An abstract list data type with /O(1)/ time concatenation (the current
-- implementation uses difference lists). Here @a@ is the type of list elements.
diff --git a/src/Algebra/Graph/Label.hs b/src/Algebra/Graph/Label.hs
index c36dbb6..dc41588 100644
--- a/src/Algebra/Graph/Label.hs
+++ b/src/Algebra/Graph/Label.hs
@@ -1,7 +1,7 @@
-----------------------------------------------------------------------------
-- |
-- Module : Algebra.Graph.Label
--- Copyright : (c) Andrey Mokhov 2016-2022
+-- Copyright : (c) Andrey Mokhov 2016-2024
-- License : MIT (see the file LICENSE)
-- Maintainer : andrey.mokhov@gmail.com
-- Stability : experimental
@@ -22,17 +22,16 @@ module Algebra.Graph.Label (
NonNegative, finite, finiteWord, unsafeFinite, infinite, getFinite,
Distance, distance, getDistance, Capacity, capacity, getCapacity,
Count, count, getCount, PowerSet (..), Minimum, getMinimum, noMinimum,
- Path, Label, isZero, RegularExpression,
+ Path, Label, symbol, symbols, isZero, RegularExpression,
-- * Combining edge labels
Optimum (..), ShortestPath, AllShortestPaths, CountShortestPaths, WidestPath
) where
-import Control.Applicative
import Control.Monad
import Data.Coerce
import Data.Maybe
-import Data.Monoid (Any (..), Monoid (..), Sum (..))
+import Data.Monoid (Any (..), Sum (..))
import Data.Semigroup (Max (..), Min (..))
import Data.Set (Set)
import GHC.Exts (IsList (..))
@@ -72,7 +71,7 @@ Instances of this type class must satisfy the following semiring laws:
> x <.> (y <+> z) == x <.> y <+> x <.> z
> (x <+> y) <.> z == x <.> z <+> y <.> z
-}
-class (Monoid a, Semigroup a) => Semiring a where
+class Monoid a => Semiring a where
one :: a
(<.>) :: a -> a -> a
@@ -285,11 +284,11 @@ fromExtended Infinite = Nothing
instance (Num a, Eq a) => Num (Extended a) where
fromInteger = Finite . fromInteger
- (+) = liftA2 (+)
+ (+) = liftM2 (+)
Finite 0 * _ = Finite 0
_ * Finite 0 = Finite 0
- x * y = liftA2 (*) x y
+ x * y = liftM2 (*) x y
negate = fmap negate
signum = fmap signum
@@ -331,7 +330,7 @@ instance (Monoid a, Ord a) => Monoid (Minimum a) where
instance (Monoid a, Ord a) => Semiring (Minimum a) where
one = pure mempty
- (<.>) = liftA2 mappend
+ (<.>) = liftM2 mappend
instance (Monoid a, Ord a) => Dioid (Minimum a)
@@ -364,8 +363,8 @@ instance (Monoid a, Ord a) => Semiring (PowerSet a) where
instance (Monoid a, Ord a) => Dioid (PowerSet a) where
--- | The type of /free labels/ over the underlying set of symbols @a@. This data
--- type is an instance of classes 'StarSemiring' and 'Dioid'.
+-- | The type of /free labels/ over the underlying set of symbols @a@. 'Label' values
+-- can be manipulated via its 'Semigroup', 'Monoid' and 'StarSemiring' class instances.
data Label a = Zero
| One
| Symbol a
@@ -377,9 +376,17 @@ data Label a = Zero
infixl 6 :+:
infixl 7 :*:
+-- | Wrap a value into a 'Symbol' constructor
+symbol :: a -> Label a
+symbol = Symbol
+
+-- | Wrap a list of values into 'Symbol' constructors terminated by 'Zero'
+symbols :: Foldable t => t a -> Label a
+symbols = foldr ((<>) . Symbol) Zero
+
instance IsList (Label a) where
type Item (Label a) = a
- fromList = foldr ((<>) . Symbol) Zero
+ fromList = symbols
toList = error "Label.toList cannot be given a reasonable definition"
instance Show a => Show (Label a) where
diff --git a/src/Algebra/Graph/Labelled.hs b/src/Algebra/Graph/Labelled.hs
index adf9ab2..4e808cf 100644
--- a/src/Algebra/Graph/Labelled.hs
+++ b/src/Algebra/Graph/Labelled.hs
@@ -1,7 +1,7 @@
-----------------------------------------------------------------------------
-- |
-- Module : Algebra.Graph.Labelled
--- Copyright : (c) Andrey Mokhov 2016-2022
+-- Copyright : (c) Andrey Mokhov 2016-2024
-- License : MIT (see the file LICENSE)
-- Maintainer : andrey.mokhov@gmail.com
-- Stability : experimental
@@ -54,10 +54,9 @@ import Algebra.Graph.Label
import qualified Algebra.Graph.Labelled.AdjacencyMap as AM
import qualified Algebra.Graph.ToGraph as T
-import qualified Data.IntSet as IntSet
-import qualified Data.Set as Set
-import qualified Data.Map as Map
-import qualified GHC.Exts as Exts
+import qualified Data.Set as Set
+import qualified Data.Map as Map
+import qualified GHC.Exts as Exts
-- | Edge-labelled graphs, where the type variable @e@ stands for edge labels.
-- For example, 'Graph' @Bool@ @a@ is isomorphic to unlabelled graphs defined in
@@ -71,7 +70,7 @@ data Graph e a = Empty
instance (Eq e, Monoid e, Ord a) => Eq (Graph e a) where
x == y = toAdjacencyMap x == toAdjacencyMap y
-instance (Eq e, Monoid e, Ord a, Ord e) => Ord (Graph e a) where
+instance (Monoid e, Ord a, Ord e) => Ord (Graph e a) where
compare x y = compare (toAdjacencyMap x) (toAdjacencyMap y)
-- | __Note:__ this does not satisfy the usual ring laws; see 'Graph'
diff --git a/src/Algebra/Graph/Labelled/AdjacencyMap.hs b/src/Algebra/Graph/Labelled/AdjacencyMap.hs
index fa812fe..878e3ac 100644
--- a/src/Algebra/Graph/Labelled/AdjacencyMap.hs
+++ b/src/Algebra/Graph/Labelled/AdjacencyMap.hs
@@ -1,7 +1,7 @@
-----------------------------------------------------------------------------
-- |
-- Module : Algebra.Graph.Labelled.AdjacencyMap
--- Copyright : (c) Andrey Mokhov 2016-2022
+-- Copyright : (c) Andrey Mokhov 2016-2024
-- License : MIT (see the file LICENSE)
-- Maintainer : andrey.mokhov@gmail.com
-- Stability : experimental
diff --git a/src/Algebra/Graph/Labelled/Example/Automaton.hs b/src/Algebra/Graph/Labelled/Example/Automaton.hs
index 0e97dd4..35a6fb0 100644
--- a/src/Algebra/Graph/Labelled/Example/Automaton.hs
+++ b/src/Algebra/Graph/Labelled/Example/Automaton.hs
@@ -2,7 +2,7 @@
-----------------------------------------------------------------------------
-- |
-- Module : Algebra.Graph.Labelled.Example.Automaton
--- Copyright : (c) Andrey Mokhov 2016-2022
+-- Copyright : (c) Andrey Mokhov 2016-2024
-- License : MIT (see the file LICENSE)
-- Maintainer : andrey.mokhov@gmail.com
-- Stability : experimental
diff --git a/src/Algebra/Graph/Labelled/Example/Network.hs b/src/Algebra/Graph/Labelled/Example/Network.hs
index dd56d7c..37f0e03 100644
--- a/src/Algebra/Graph/Labelled/Example/Network.hs
+++ b/src/Algebra/Graph/Labelled/Example/Network.hs
@@ -2,7 +2,7 @@
-----------------------------------------------------------------------------
-- |
-- Module : Algebra.Graph.Labelled.Example.Network
--- Copyright : (c) Andrey Mokhov 2016-2022
+-- Copyright : (c) Andrey Mokhov 2016-2024
-- License : MIT (see the file LICENSE)
-- Maintainer : andrey.mokhov@gmail.com
-- Stability : experimental
diff --git a/src/Algebra/Graph/NonEmpty.hs b/src/Algebra/Graph/NonEmpty.hs
index 143b2fa..f7217d5 100644
--- a/src/Algebra/Graph/NonEmpty.hs
+++ b/src/Algebra/Graph/NonEmpty.hs
@@ -1,7 +1,7 @@
-----------------------------------------------------------------------------
-- |
-- Module : Algebra.Graph.NonEmpty
--- Copyright : (c) Andrey Mokhov 2016-2022
+-- Copyright : (c) Andrey Mokhov 2016-2024
-- License : MIT (see the file LICENSE)
-- Maintainer : andrey.mokhov@gmail.com
-- Stability : experimental
@@ -53,7 +53,6 @@ module Algebra.Graph.NonEmpty (
) where
import Control.DeepSeq
-import Control.Monad
import Control.Monad.Trans.State
import Data.List.NonEmpty (NonEmpty (..))
import Data.String
diff --git a/src/Algebra/Graph/NonEmpty/AdjacencyMap.hs b/src/Algebra/Graph/NonEmpty/AdjacencyMap.hs
index 73fc904..08421e5 100644
--- a/src/Algebra/Graph/NonEmpty/AdjacencyMap.hs
+++ b/src/Algebra/Graph/NonEmpty/AdjacencyMap.hs
@@ -1,7 +1,7 @@
-----------------------------------------------------------------------------
-- |
-- Module : Algebra.Graph.NonEmpty.AdjacencyMap
--- Copyright : (c) Andrey Mokhov 2016-2022
+-- Copyright : (c) Andrey Mokhov 2016-2024
-- License : MIT (see the file LICENSE)
-- Maintainer : andrey.mokhov@gmail.com
-- Stability : experimental
diff --git a/src/Algebra/Graph/Relation.hs b/src/Algebra/Graph/Relation.hs
index d7028d1..c176745 100644
--- a/src/Algebra/Graph/Relation.hs
+++ b/src/Algebra/Graph/Relation.hs
@@ -1,7 +1,7 @@
-----------------------------------------------------------------------------
-- |
-- Module : Algebra.Graph.Relation
--- Copyright : (c) Andrey Mokhov 2016-2022
+-- Copyright : (c) Andrey Mokhov 2016-2024
-- License : MIT (see the file LICENSE)
-- Maintainer : andrey.mokhov@gmail.com
-- Stability : experimental
@@ -46,7 +46,7 @@ import Control.DeepSeq
import Data.Bifunctor
import Data.Set (Set, union)
import Data.String
-import Data.Tree
+import Data.Tree (Tree(..), Forest)
import Data.Tuple
import qualified Data.IntSet as IntSet
@@ -54,8 +54,6 @@ import qualified Data.Maybe as Maybe
import qualified Data.Set as Set
import qualified Data.Tree as Tree
-import Algebra.Graph.Internal
-
import qualified Algebra.Graph as G
import qualified Algebra.Graph.AdjacencyIntMap as AIM
import qualified Algebra.Graph.AdjacencyMap as AM
diff --git a/src/Algebra/Graph/Relation/Preorder.hs b/src/Algebra/Graph/Relation/Preorder.hs
index db6ecd9..d55f7ee 100644
--- a/src/Algebra/Graph/Relation/Preorder.hs
+++ b/src/Algebra/Graph/Relation/Preorder.hs
@@ -1,7 +1,7 @@
-----------------------------------------------------------------------------
-- |
-- Module : Algebra.Graph.Relation.Preorder
--- Copyright : (c) Andrey Mokhov 2016-2022
+-- Copyright : (c) Andrey Mokhov 2016-2024
-- License : MIT (see the file LICENSE)
-- Maintainer : andrey.mokhov@gmail.com
-- Stability : experimental
diff --git a/src/Algebra/Graph/Relation/Reflexive.hs b/src/Algebra/Graph/Relation/Reflexive.hs
index 2f4f67a..c7aa09c 100644
--- a/src/Algebra/Graph/Relation/Reflexive.hs
+++ b/src/Algebra/Graph/Relation/Reflexive.hs
@@ -1,7 +1,7 @@
-----------------------------------------------------------------------------
-- |
-- Module : Algebra.Graph.Relation.Reflexive
--- Copyright : (c) Andrey Mokhov 2016-2022
+-- Copyright : (c) Andrey Mokhov 2016-2024
-- License : MIT (see the file LICENSE)
-- Maintainer : andrey.mokhov@gmail.com
-- Stability : experimental
diff --git a/src/Algebra/Graph/Relation/Symmetric.hs b/src/Algebra/Graph/Relation/Symmetric.hs
index dab207e..20d1ae7 100644
--- a/src/Algebra/Graph/Relation/Symmetric.hs
+++ b/src/Algebra/Graph/Relation/Symmetric.hs
@@ -1,7 +1,7 @@
-----------------------------------------------------------------------------
-- |
-- Module : Algebra.Graph.Relation.Symmetric
--- Copyright : (c) Andrey Mokhov 2016-2022
+-- Copyright : (c) Andrey Mokhov 2016-2024
-- License : MIT (see the file LICENSE)
-- Maintainer : andrey.mokhov@gmail.com
-- Stability : experimental
@@ -45,16 +45,13 @@ import Control.DeepSeq
import Data.Coerce
import Data.Set (Set)
import Data.String
-import Data.Tree
+import Data.Tree (Tree(..), Forest)
import qualified Data.IntSet as IntSet
import qualified Data.Set as Set
-import qualified Algebra.Graph as G
-import qualified Algebra.Graph.AdjacencyIntMap as AIM
-import qualified Algebra.Graph.AdjacencyMap as AM
-import qualified Algebra.Graph.ToGraph as T
-import qualified Algebra.Graph.Relation as R
+import qualified Algebra.Graph.ToGraph as T
+import qualified Algebra.Graph.Relation as R
{-| This data type represents a /symmetric binary relation/ over a set of
elements of type @a@. Symmetric relations satisfy all laws of the
diff --git a/src/Algebra/Graph/Relation/Transitive.hs b/src/Algebra/Graph/Relation/Transitive.hs
index dd9dcde..fa11a0e 100644
--- a/src/Algebra/Graph/Relation/Transitive.hs
+++ b/src/Algebra/Graph/Relation/Transitive.hs
@@ -1,7 +1,7 @@
-----------------------------------------------------------------------------
-- |
-- Module : Algebra.Graph.Relation.Transitive
--- Copyright : (c) Andrey Mokhov 2016-2022
+-- Copyright : (c) Andrey Mokhov 2016-2024
-- License : MIT (see the file LICENSE)
-- Maintainer : andrey.mokhov@gmail.com
-- Stability : experimental
diff --git a/src/Algebra/Graph/ToGraph.hs b/src/Algebra/Graph/ToGraph.hs
index af30e38..25e8b35 100644
--- a/src/Algebra/Graph/ToGraph.hs
+++ b/src/Algebra/Graph/ToGraph.hs
@@ -2,7 +2,7 @@
-----------------------------------------------------------------------------
-- |
-- Module : Algebra.Graph.ToGraph
--- Copyright : (c) Andrey Mokhov 2016-2022
+-- Copyright : (c) Andrey Mokhov 2016-2024
-- License : MIT (see the file LICENSE)
-- Maintainer : andrey.mokhov@gmail.com
-- Stability : experimental
diff --git a/src/Algebra/Graph/Undirected.hs b/src/Algebra/Graph/Undirected.hs
index 0a9ef11..5f3f0b9 100644
--- a/src/Algebra/Graph/Undirected.hs
+++ b/src/Algebra/Graph/Undirected.hs
@@ -1,7 +1,7 @@
-----------------------------------------------------------------------------
-- |
-- Module : Algebra.Graph.Undirected
--- Copyright : (c) Andrey Mokhov 2016-2022
+-- Copyright : (c) Andrey Mokhov 2016-2024
-- License : MIT (see the file LICENSE)
-- Maintainer : andrey.mokhov@gmail.com
-- Stability : experimental
diff --git a/src/Data/Graph/Typed.hs b/src/Data/Graph/Typed.hs
index a1e503d..c86770a 100644
--- a/src/Data/Graph/Typed.hs
+++ b/src/Data/Graph/Typed.hs
@@ -1,7 +1,7 @@
-----------------------------------------------------------------------------
-- |
-- Module : Data.Graph.Typed
--- Copyright : (c) Anton Lorenzen, Andrey Mokhov 2016-2022
+-- Copyright : (c) Anton Lorenzen, Andrey Mokhov 2016-2024
-- License : MIT (see the file LICENSE)
-- Maintainer : anfelor@posteo.de, andrey.mokhov@gmail.com
-- Stability : unstable
diff --git a/stack.yaml b/stack.yaml
new file mode 100644
index 0000000..cbe5e8d
--- /dev/null
+++ b/stack.yaml
@@ -0,0 +1,4 @@
+resolver: nightly-2024-03-01 # ghc-9.8.1
+
+ghc-options:
+ '$everything': -haddock
diff --git a/test/Algebra/Graph/Test.hs b/test/Algebra/Graph/Test.hs
index 7ca061d..fcc92a3 100644
--- a/test/Algebra/Graph/Test.hs
+++ b/test/Algebra/Graph/Test.hs
@@ -1,7 +1,7 @@
-----------------------------------------------------------------------------
-- |
-- Module : Algebra.Graph.Test
--- Copyright : (c) Andrey Mokhov 2016-2022
+-- Copyright : (c) Andrey Mokhov 2016-2024
-- License : MIT (see the file LICENSE)
-- Maintainer : andrey.mokhov@gmail.com
-- Stability : experimental
diff --git a/test/Algebra/Graph/Test/API.hs b/test/Algebra/Graph/Test/API.hs
index 11d67d8..c96edbd 100644
--- a/test/Algebra/Graph/Test/API.hs
+++ b/test/Algebra/Graph/Test/API.hs
@@ -3,7 +3,7 @@
-----------------------------------------------------------------------------
-- |
-- Module : Algebra.Graph.Test.API
--- Copyright : (c) Andrey Mokhov 2016-2022
+-- Copyright : (c) Andrey Mokhov 2016-2024
-- License : MIT (see the file LICENSE)
-- Maintainer : andrey.mokhov@gmail.com
-- Stability : experimental
diff --git a/test/Algebra/Graph/Test/Acyclic/AdjacencyMap.hs b/test/Algebra/Graph/Test/Acyclic/AdjacencyMap.hs
index adee4c7..9bfb0e2 100644
--- a/test/Algebra/Graph/Test/Acyclic/AdjacencyMap.hs
+++ b/test/Algebra/Graph/Test/Acyclic/AdjacencyMap.hs
@@ -2,7 +2,7 @@
-----------------------------------------------------------------------------
-- |
-- Module : Algebra.Graph.Test.Acyclic.AdjacencyMap
--- Copyright : (c) Andrey Mokhov 2016-2022
+-- Copyright : (c) Andrey Mokhov 2016-2024
-- License : MIT (see the file LICENSE)
-- Maintainer : andrey.mokhov@gmail.com
-- Stability : experimental
diff --git a/test/Algebra/Graph/Test/AdjacencyIntMap.hs b/test/Algebra/Graph/Test/AdjacencyIntMap.hs
index b1e25cb..981c5d3 100644
--- a/test/Algebra/Graph/Test/AdjacencyIntMap.hs
+++ b/test/Algebra/Graph/Test/AdjacencyIntMap.hs
@@ -1,7 +1,7 @@
-----------------------------------------------------------------------------
-- |
-- Module : Algebra.Graph.Test.AdjacencyIntMap
--- Copyright : (c) Andrey Mokhov 2016-2022
+-- Copyright : (c) Andrey Mokhov 2016-2024
-- License : MIT (see the file LICENSE)
-- Maintainer : andrey.mokhov@gmail.com
-- Stability : experimental
diff --git a/test/Algebra/Graph/Test/AdjacencyMap.hs b/test/Algebra/Graph/Test/AdjacencyMap.hs
index 2751a6f..c1b144e 100644
--- a/test/Algebra/Graph/Test/AdjacencyMap.hs
+++ b/test/Algebra/Graph/Test/AdjacencyMap.hs
@@ -2,7 +2,7 @@
-----------------------------------------------------------------------------
-- |
-- Module : Algebra.Graph.Test.AdjacencyMap
--- Copyright : (c) Andrey Mokhov 2016-2022
+-- Copyright : (c) Andrey Mokhov 2016-2024
-- License : MIT (see the file LICENSE)
-- Maintainer : andrey.mokhov@gmail.com
-- Stability : experimental
diff --git a/test/Algebra/Graph/Test/Arbitrary.hs b/test/Algebra/Graph/Test/Arbitrary.hs
index d6b0c7d..be37375 100644
--- a/test/Algebra/Graph/Test/Arbitrary.hs
+++ b/test/Algebra/Graph/Test/Arbitrary.hs
@@ -1,9 +1,8 @@
-{-# LANGUAGE CPP #-}
{-# OPTIONS_GHC -fno-warn-orphans #-}
-----------------------------------------------------------------------------
-- |
-- Module : Algebra.Graph.Test.Arbitrary
--- Copyright : (c) Andrey Mokhov 2016-2022
+-- Copyright : (c) Andrey Mokhov 2016-2024
-- License : MIT (see the file LICENSE)
-- Maintainer : andrey.mokhov@gmail.com
-- Stability : experimental
@@ -15,10 +14,8 @@ module Algebra.Graph.Test.Arbitrary (
arbitraryGraph, arbitraryRelation, arbitraryAdjacencyMap,
) where
-import Control.Monad
import Data.List.NonEmpty (NonEmpty (..), toList)
import Data.Maybe (catMaybes)
-import Data.Tree
import Test.QuickCheck
import Algebra.Graph
diff --git a/test/Algebra/Graph/Test/Bipartite/AdjacencyMap.hs b/test/Algebra/Graph/Test/Bipartite/AdjacencyMap.hs
index a0b7f29..7c26363 100644
--- a/test/Algebra/Graph/Test/Bipartite/AdjacencyMap.hs
+++ b/test/Algebra/Graph/Test/Bipartite/AdjacencyMap.hs
@@ -2,7 +2,7 @@
-----------------------------------------------------------------------------
-- |
-- Module : Algebra.Graph.Test.Bipartite.AdjacencyMap
--- Copyright : (c) Andrey Mokhov 2016-2022
+-- Copyright : (c) Andrey Mokhov 2016-2024
-- License : MIT (see the file LICENSE)
-- Maintainer : andrey.mokhov@gmail.com
-- Stability : experimental
@@ -20,7 +20,7 @@ import Algebra.Graph.Bipartite.AdjacencyMap.Algorithm
import Algebra.Graph.Test
import Data.Either
import Data.Either.Extra
-import Data.List (nub, sort)
+import Data.List (nub)
import Data.Map.Strict (Map)
import Data.Set (Set)
@@ -30,7 +30,6 @@ import qualified Data.Bifunctor as Bifunctor
import qualified Data.Map.Strict as Map
import qualified Data.Set as Set
import qualified Data.Tuple
-import qualified Algebra.Graph.Bipartite.AdjacencyMap as B
type AI = AM.AdjacencyMap Int
type AII = AM.AdjacencyMap (Either Int Int)
diff --git a/test/Algebra/Graph/Test/Export.hs b/test/Algebra/Graph/Test/Export.hs
index a036184..90e115a 100644
--- a/test/Algebra/Graph/Test/Export.hs
+++ b/test/Algebra/Graph/Test/Export.hs
@@ -2,7 +2,7 @@
-----------------------------------------------------------------------------
-- |
-- Module : Algebra.Graph.Test.Export
--- Copyright : (c) Andrey Mokhov 2016-2022
+-- Copyright : (c) Andrey Mokhov 2016-2024
-- License : MIT (see the file LICENSE)
-- Maintainer : andrey.mokhov@gmail.com
-- Stability : experimental
diff --git a/test/Algebra/Graph/Test/Generic.hs b/test/Algebra/Graph/Test/Generic.hs
index 62e7564..51f923e 100644
--- a/test/Algebra/Graph/Test/Generic.hs
+++ b/test/Algebra/Graph/Test/Generic.hs
@@ -2,7 +2,7 @@
-----------------------------------------------------------------------------
-- |
-- Module : Algebra.Graph.Test.Generic
--- Copyright : (c) Andrey Mokhov 2016-2022
+-- Copyright : (c) Andrey Mokhov 2016-2024
-- License : MIT (see the file LICENSE)
-- Maintainer : andrey.mokhov@gmail.com
-- Stability : experimental
@@ -13,7 +13,7 @@ module Algebra.Graph.Test.Generic where
import Control.Monad (when)
import Data.Either
-import Data.List (nub, sort)
+import Data.List (nub)
import Data.List.NonEmpty (NonEmpty (..))
import Data.Tree
import Data.Tuple
diff --git a/test/Algebra/Graph/Test/Graph.hs b/test/Algebra/Graph/Test/Graph.hs
index 6ecbeea..c34fc21 100644
--- a/test/Algebra/Graph/Test/Graph.hs
+++ b/test/Algebra/Graph/Test/Graph.hs
@@ -1,7 +1,7 @@
-----------------------------------------------------------------------------
-- |
-- Module : Algebra.Graph.Test.Graph
--- Copyright : (c) Andrey Mokhov 2016-2022
+-- Copyright : (c) Andrey Mokhov 2016-2024
-- License : MIT (see the file LICENSE)
-- Maintainer : andrey.mokhov@gmail.com
-- Stability : experimental
diff --git a/test/Algebra/Graph/Test/Internal.hs b/test/Algebra/Graph/Test/Internal.hs
index 680b9de..2016f8d 100644
--- a/test/Algebra/Graph/Test/Internal.hs
+++ b/test/Algebra/Graph/Test/Internal.hs
@@ -2,7 +2,7 @@
-----------------------------------------------------------------------------
-- |
-- Module : Algebra.Graph.Test.Internal
--- Copyright : (c) Andrey Mokhov 2016-2022
+-- Copyright : (c) Andrey Mokhov 2016-2024
-- License : MIT (see the file LICENSE)
-- Maintainer : andrey.mokhov@gmail.com
-- Stability : experimental
diff --git a/test/Algebra/Graph/Test/Label.hs b/test/Algebra/Graph/Test/Label.hs
index 34cf6ff..441a0a1 100644
--- a/test/Algebra/Graph/Test/Label.hs
+++ b/test/Algebra/Graph/Test/Label.hs
@@ -2,7 +2,7 @@
-----------------------------------------------------------------------------
-- |
-- Module : Algebra.Graph.Test.Label
--- Copyright : (c) Andrey Mokhov 2016-2022
+-- Copyright : (c) Andrey Mokhov 2016-2024
-- License : MIT (see the file LICENSE)
-- Maintainer : andrey.mokhov@gmail.com
-- Stability : experimental
diff --git a/test/Algebra/Graph/Test/Labelled/AdjacencyMap.hs b/test/Algebra/Graph/Test/Labelled/AdjacencyMap.hs
index 9ff4127..433ba4d 100644
--- a/test/Algebra/Graph/Test/Labelled/AdjacencyMap.hs
+++ b/test/Algebra/Graph/Test/Labelled/AdjacencyMap.hs
@@ -2,7 +2,7 @@
-----------------------------------------------------------------------------
-- |
-- Module : Algebra.Graph.Test.Labelled.AdjacencyMap
--- Copyright : (c) Andrey Mokhov 2016-2022
+-- Copyright : (c) Andrey Mokhov 2016-2024
-- License : MIT (see the file LICENSE)
-- Maintainer : andrey.mokhov@gmail.com
-- Stability : experimental
diff --git a/test/Algebra/Graph/Test/Labelled/Graph.hs b/test/Algebra/Graph/Test/Labelled/Graph.hs
index 4ecb63c..bd79978 100644
--- a/test/Algebra/Graph/Test/Labelled/Graph.hs
+++ b/test/Algebra/Graph/Test/Labelled/Graph.hs
@@ -2,7 +2,7 @@
-----------------------------------------------------------------------------
-- |
-- Module : Algebra.Graph.Test.Labelled.Graph
--- Copyright : (c) Andrey Mokhov 2016-2022
+-- Copyright : (c) Andrey Mokhov 2016-2024
-- License : MIT (see the file LICENSE)
-- Maintainer : andrey.mokhov@gmail.com
-- Stability : experimental
diff --git a/test/Algebra/Graph/Test/NonEmpty/AdjacencyMap.hs b/test/Algebra/Graph/Test/NonEmpty/AdjacencyMap.hs
index f94c46d..fe00928 100644
--- a/test/Algebra/Graph/Test/NonEmpty/AdjacencyMap.hs
+++ b/test/Algebra/Graph/Test/NonEmpty/AdjacencyMap.hs
@@ -2,7 +2,7 @@
-----------------------------------------------------------------------------
-- |
-- Module : Algebra.Graph.Test.NonEmpty.AdjacencyMap
--- Copyright : (c) Andrey Mokhov 2016-2022
+-- Copyright : (c) Andrey Mokhov 2016-2024
-- License : MIT (see the file LICENSE)
-- Maintainer : andrey.mokhov@gmail.com
-- Stability : experimental
diff --git a/test/Algebra/Graph/Test/NonEmpty/Graph.hs b/test/Algebra/Graph/Test/NonEmpty/Graph.hs
index 5d25970..0ebfdb3 100644
--- a/test/Algebra/Graph/Test/NonEmpty/Graph.hs
+++ b/test/Algebra/Graph/Test/NonEmpty/Graph.hs
@@ -2,7 +2,7 @@
-----------------------------------------------------------------------------
-- |
-- Module : Algebra.Graph.Test.NonEmpty.Graph
--- Copyright : (c) Andrey Mokhov 2016-2022
+-- Copyright : (c) Andrey Mokhov 2016-2024
-- License : MIT (see the file LICENSE)
-- Maintainer : andrey.mokhov@gmail.com
-- Stability : experimental
diff --git a/test/Algebra/Graph/Test/Relation.hs b/test/Algebra/Graph/Test/Relation.hs
index 431ac26..72af79f 100644
--- a/test/Algebra/Graph/Test/Relation.hs
+++ b/test/Algebra/Graph/Test/Relation.hs
@@ -1,7 +1,7 @@
-----------------------------------------------------------------------------
-- |
-- Module : Algebra.Graph.Test.Relation
--- Copyright : (c) Andrey Mokhov 2016-2022
+-- Copyright : (c) Andrey Mokhov 2016-2024
-- License : MIT (see the file LICENSE)
-- Maintainer : andrey.mokhov@gmail.com
-- Stability : experimental
diff --git a/test/Algebra/Graph/Test/Relation/Symmetric.hs b/test/Algebra/Graph/Test/Relation/Symmetric.hs
index 3bb12a9..d7b5f9c 100644
--- a/test/Algebra/Graph/Test/Relation/Symmetric.hs
+++ b/test/Algebra/Graph/Test/Relation/Symmetric.hs
@@ -1,7 +1,7 @@
-----------------------------------------------------------------------------
-- |
-- Module : Algebra.Graph.Test.Relation.Symmetric
--- Copyright : (c) Andrey Mokhov 2016-2022
+-- Copyright : (c) Andrey Mokhov 2016-2024
-- License : MIT (see the file LICENSE)
-- Maintainer : andrey.mokhov@gmail.com
-- Stability : experimental
diff --git a/test/Algebra/Graph/Test/RewriteRules.hs b/test/Algebra/Graph/Test/RewriteRules.hs
index 8b014a7..7a7a63e 100644
--- a/test/Algebra/Graph/Test/RewriteRules.hs
+++ b/test/Algebra/Graph/Test/RewriteRules.hs
@@ -2,7 +2,7 @@
-----------------------------------------------------------------------------
-- |
-- Module : Algebra.Graph.Test.RewriteRules
--- Copyright : (c) Andrey Mokhov 2016-2022
+-- Copyright : (c) Andrey Mokhov 2016-2024
-- License : MIT (see the file LICENSE)
-- Maintainer : andrey.mokhov@gmail.com
-- Stability : experimental
diff --git a/test/Algebra/Graph/Test/Undirected.hs b/test/Algebra/Graph/Test/Undirected.hs
index e4a6e1d..5d006cd 100644
--- a/test/Algebra/Graph/Test/Undirected.hs
+++ b/test/Algebra/Graph/Test/Undirected.hs
@@ -1,7 +1,7 @@
-----------------------------------------------------------------------------
-- |
-- Module : Algebra.Graph.Test.Undirected
--- Copyright : (c) Andrey Mokhov 2016-2022
+-- Copyright : (c) Andrey Mokhov 2016-2024
-- License : MIT (see the file LICENSE)
-- Maintainer : andrey.mokhov@gmail.com
-- Stability : experimental
diff --git a/test/Data/Graph/Test/Typed.hs b/test/Data/Graph/Test/Typed.hs
index 1a994d6..4403ae7 100644
--- a/test/Data/Graph/Test/Typed.hs
+++ b/test/Data/Graph/Test/Typed.hs
@@ -1,7 +1,7 @@
-----------------------------------------------------------------------------
-- |
-- Module : Data.Graph.Test.Typed
--- Copyright : (c) Andrey Mokhov 2016-2022
+-- Copyright : (c) Andrey Mokhov 2016-2024
-- License : MIT (see the file LICENSE)
-- Maintainer : anfelor@posteo.de, andrey.mokhov@gmail.com
-- Stability : experimental
@@ -20,7 +20,7 @@ import Algebra.Graph.AdjacencyMap ( forest, empty, vertex, edge, vertices
import Data.Array (array)
import Data.Graph.Typed
import Data.Tree
-import Data.List (nub, sort)
+import Data.List (nub)
import qualified Data.Graph as KL
import qualified Data.IntSet as IntSet
diff --git a/ansi-pretty.cabal b/ansi-pretty.cabal
index 37dffa2..b3eb075 100644
--- a/ansi-pretty.cabal
+++ b/ansi-pretty.cabal
@@ -1,10 +1,11 @@
name: ansi-pretty
version: 0.1.2.2
+x-revision: 1
synopsis: AnsiPretty for ansi-wl-pprint
description: 'AnsiPretty' type class, more colorful than 'Pretty'.
category: User Interfaces, Text
-homepage: https://github.com/futurice/haskell-ansi-pretty#readme
-bug-reports: https://github.com/futurice/haskell-ansi-pretty/issues
+homepage: https://github.com/phadej/haskell-ansi-pretty#readme
+bug-reports: https://github.com/phadej/haskell-ansi-pretty/issues
author: Oleg Grenrus <oleg.grenrus@iki.fi>
maintainer: Oleg Grenrus <oleg.grenrus@iki.fi>
license: BSD3
@@ -16,7 +17,8 @@ tested-with:
|| ==8.2.2
|| ==8.4.4
|| ==8.6.5
- || ==8.8.1
+ || ==8.8.4
+ || ==8.10.3
build-type: Simple
cabal-version: >=1.10
@@ -26,17 +28,17 @@ extra-source-files:
source-repository head
type: git
- location: https://github.com/futurice/haskell-ansi-pretty
+ location: https://github.com/phadej/haskell-ansi-pretty
library
default-language: Haskell2010
hs-source-dirs: src
ghc-options: -Wall
build-depends:
- aeson >=0.8 && <1.5
+ aeson >=0.8 && <2.3
, ansi-wl-pprint >=0.6 && <0.7
, array >=0.5 && <0.6
- , base >=4.7 && <4.14
+ , base >=4.7 && <4.15
, bytestring >=0.10 && <0.11
, containers >=0.5 && <0.7
, generics-sop >=0.1 && <0.6
@@ -47,7 +49,7 @@ library
, text >=1.2 && <1.3
, time >=1.4 && <1.10
, unordered-containers >=0.2 && <0.3
- , vector >=0.10 && <0.13
+ , vector >=0.10 && <0.14
exposed-modules:
Data.List.CommonPrefix
diff --git a/src/Text/PrettyPrint/ANSI/Leijen/AnsiPretty.hs b/src/Text/PrettyPrint/ANSI/Leijen/AnsiPretty.hs
index 2c8d89f..dcb3a14 100644
--- a/src/Text/PrettyPrint/ANSI/Leijen/AnsiPretty.hs
+++ b/src/Text/PrettyPrint/ANSI/Leijen/AnsiPretty.hs
@@ -77,6 +77,10 @@ import qualified Data.Time as Time
import qualified Data.Vector as V
import qualified Data.Vector.Storable as S
import qualified Data.Vector.Unboxed as U
+#if MIN_VERSION_aeson(2,0,0)
+import qualified Data.Aeson.Key as Key
+import qualified Data.Aeson.KeyMap as KeyMap
+#endif
#if !MIN_VERSION_generics_sop(0,2,0)
type SListI (a :: k) = SingI a
@@ -255,7 +259,12 @@ instance AnsiPretty a => AnsiPretty (CommonPrefix a)
instance AnsiPretty Aeson.Value where
ansiPretty (Aeson.Object o)
= encloseSep (dullgreen lbrace) (dullgreen rbrace) (dullgreen comma)
- $ fmap f $ HashMap.toList o
+ $ fmap f
+#if MIN_VERSION_aeson(2,0,0)
+ $ KeyMap.toList o
+#else
+ $ HashMap.toList o
+#endif
where
f (k, v) = dullwhite (ansiPretty k) L.<> blue colon <+> ansiPretty v
@@ -272,6 +281,10 @@ instance AnsiPretty Aeson.Value where
ansiPretty (Aeson.Bool False) = dullyellow $ string "false"
ansiPretty Aeson.Null = cyan (text "Null")
+#if MIN_VERSION_aeson(2,0,0)
+instance AnsiPretty Key.Key where ansiPretty = ansiPretty . Key.toText
+#endif
+
-- array
instance (AnsiPretty i, AnsiPretty e, Array.Ix i) => AnsiPretty (Array.Array i e) where ansiPretty = ansiPrettyMap "Array" . Array.assocs
instance (AnsiPretty i, AnsiPretty e, Array.Ix i, Array.IArray Array.UArray e) => AnsiPretty (Array.UArray i e) where ansiPretty = ansiPrettyMap "UArray" . Array.assocs
@@ -302,7 +315,9 @@ instance AnsiPretty Data.Semigroup.All
instance AnsiPretty Any
instance AnsiPretty a => AnsiPretty (Sum a)
instance AnsiPretty a => AnsiPretty (Product a)
+#if !(MIN_VERSION_base(4,16,0))
instance AnsiPretty a => AnsiPretty (Option a)
+#endif
instance (AnsiPretty a, AnsiPretty b) => AnsiPretty (Arg a b)
-- scientific
diff --git a/src/Data/ArithEncode/Basic.hs b/src/Data/ArithEncode/Basic.hs
index 31bc695..e6af8ff 100644
--- a/src/Data/ArithEncode/Basic.hs
+++ b/src/Data/ArithEncode/Basic.hs
@@ -130,7 +130,7 @@ import Control.Monad
import Data.Array.IArray(Array)
import Data.Bits
import Data.Hashable
-import Data.List hiding (elem, union)
+import qualified Data.List as L hiding (elem, union)
import Data.Maybe
import Data.Set(Set)
import Data.HashSet(HashSet)
@@ -354,7 +354,7 @@ wrap :: (a -> Maybe b)
-> Encoding b
-- ^ The inner encoding.
-> Encoding a
-wrap fwd rev enc @ Encoding { encEncode = encodefunc, encDecode = decodefunc,
+wrap fwd rev enc@Encoding { encEncode = encodefunc, encDecode = decodefunc,
encInDomain = indomainfunc } =
let
safefwd val =
@@ -412,7 +412,7 @@ mandatory Encoding { encEncode = encodefunc, encDecode = decodefunc,
-- @0@. It is also similar to @mandatory@, except that it does not
-- change the base type.
nonzero :: Encoding ty -> Encoding ty
-nonzero enc @ Encoding { encEncode = encodefunc, encDecode = decodefunc,
+nonzero enc@Encoding { encEncode = encodefunc, encDecode = decodefunc,
encSize = sizeval, encInDomain = indomainfunc } =
let
dec n = n - 1
@@ -483,14 +483,14 @@ exclude :: [ty]
-- ^ The base @Encoding@.
-> Encoding ty
exclude [] enc = enc
-exclude excludes enc @ Encoding { encEncode = encodefunc, encDecode = decodefunc,
+exclude excludes enc@Encoding { encEncode = encodefunc, encDecode = decodefunc,
encSize = sizeval, encInDomain = indomainfunc } =
let
forbidden = HashSet.fromList (map encodefunc excludes)
- sortedlist = sort (map encodefunc excludes)
+ sortedlist = L.sort (map encodefunc excludes)
fwdoffsets :: [(Integer, Integer)]
- (_, fwdoffsets) = mapAccumL (\offset v -> (offset + 1, (v, offset)))
+ (_, fwdoffsets) = L.mapAccumL (\offset v -> (offset + 1, (v, offset)))
1 sortedlist
fwdtree = toBinTree fwdoffsets
@@ -499,7 +499,7 @@ exclude excludes enc @ Encoding { encEncode = encodefunc, encDecode = decodefunc
let
foldfun :: [(Integer, Integer)] -> (Integer, Integer) ->
[(Integer, Integer)]
- foldfun accum @ ((v', _) : rest) elem @ (v, _)
+ foldfun accum@((v', _) : rest) elem@(v, _)
| v == v' = elem : rest
| otherwise = elem : accum
foldfun _ _ = error "Should not fold over an empty list"
@@ -641,7 +641,7 @@ union encodings =
sortpair (a, _) (b, _) = sortfunc a b
(sizes, sortedencodings) =
- unzip (sortBy sortpair (map (\enc -> (size enc, enc)) encodings))
+ unzip (L.sortBy sortpair (map (\enc -> (size enc, enc)) encodings))
-- Turn the sorted element encodings into an array for fast access
encodingarr :: Array.Array Int (Encoding ty)
encodingarr = Array.listArray (0, numelems - 1) sortedencodings
@@ -724,7 +724,7 @@ union encodings =
_ -> error "Internal error"
encodefunc val =
- case findIndex ((flip inDomain) val) sortedencodings of
+ case L.findIndex ((flip inDomain) val) sortedencodings of
Just encidx ->
let
enc = (Array.!) encodingarr encidx
@@ -813,8 +813,8 @@ mkPairCore Encoding { encEncode = encode1, encDecode = decode1,
-- | Take encodings for two datatypes A and B, and build an encoding
-- for a pair (A, B).
pair :: Encoding ty1 -> Encoding ty2 -> Encoding (ty1, ty2)
-pair enc1 @ Encoding { encInDomain = indomain1 }
- enc2 @ Encoding { encInDomain = indomain2 } =
+pair enc1@Encoding { encInDomain = indomain1 }
+ enc2@Encoding { encInDomain = indomain2 } =
let
(encodefunc, decodefunc, sizeval) = mkPairCore enc1 enc2
@@ -1237,7 +1237,7 @@ seqCore Encoding { encEncode = encodefunc, encDecode = decodefunc,
-- Note: This encoding can produce very large numbers for short
-- sequences.
seq :: Encoding ty -> Encoding [ty]
-seq enc @ Encoding { encInDomain = indomainfunc } =
+seq enc@Encoding { encInDomain = indomainfunc } =
let
(newEncode, newDecode) = seqCore enc
newInDomain = all indomainfunc
@@ -1281,7 +1281,7 @@ boundedSeqCore len Encoding { encEncode = encodefunc, encDecode = decodefunc,
in
(newencode, newdecode)
Just 0 -> (\[] -> 0, \0 -> [])
- Just 1 -> (genericLength, flip genericReplicate (decodefunc 0))
+ Just 1 -> (L.genericLength, flip L.genericReplicate (decodefunc 0))
Just finitesize ->
let
newencode [] = 0
@@ -1324,7 +1324,7 @@ boundedSeq :: Integer
-> Encoding ty
-- ^ The @Encoding@ for the sequence elements
-> Encoding [ty]
-boundedSeq len enc @ Encoding { encSize = sizeval, encInDomain = indomainfunc } =
+boundedSeq len enc@Encoding { encSize = sizeval, encInDomain = indomainfunc } =
let
(newencode, newdecode) = boundedSeqCore len enc
newsize = case len of
diff --git a/src/Data/ArithEncode/Util.hs b/src/Data/ArithEncode/Util.hs
index 85577ad..a07ef2e 100644
--- a/src/Data/ArithEncode/Util.hs
+++ b/src/Data/ArithEncode/Util.hs
@@ -61,7 +61,7 @@ module Data.ArithEncode.Util(
import Control.Exception
import Data.ArithEncode.Basic
import Data.Hashable
-import Data.List
+import qualified Data.List as L
import Data.Maybe
import Data.Set(Set)
import Data.HashMap.Lazy(HashMap)
@@ -174,7 +174,7 @@ function keyenc valenc =
(idx + 1,
Just val' : replicate (fromInteger (idx - count)) Nothing ++ accum)
- sorted = sortBy (\(a, _) (b, _) -> compare a b)
+ sorted = L.sortBy (\(a, _) (b, _) -> compare a b)
(map (\(key, val') -> (encode keyenc key, val'))
(Map.assocs val))
@@ -217,7 +217,7 @@ functionHashable keyenc valenc =
(idx + 1,
Just val' : replicate (fromInteger (idx - count)) Nothing ++ accum)
- sorted = sortBy (\(a, _) (b, _) -> compare a b)
+ sorted = L.sortBy (\(a, _) (b, _) -> compare a b)
(map (\(key, val') -> (encode keyenc key, val'))
(HashMap.toList val))
diff -ru asn1-encoding-0.9.5.orig/Data/ASN1/Get.hs asn1-encoding-0.9.5/Data/ASN1/Get.hs
--- asn1-encoding-0.9.5.orig/Data/ASN1/Get.hs 2016-06-07 00:53:07.000000000 -0400
+++ asn1-encoding-0.9.5/Data/ASN1/Get.hs 2019-03-16 09:34:51.248651835 -0400
@@ -15,6 +15,7 @@
-- The original code has been tailored and reduced to only cover the useful
-- case for asn1 and augmented by a position.
--
+{-# LANGUAGE CPP #-}
{-# LANGUAGE Rank2Types #-}
module Data.ASN1.Get
( Result(..)
@@ -29,6 +30,7 @@
import Control.Applicative (Applicative(..),Alternative(..))
import Control.Monad (ap,MonadPlus(..))
+import qualified Control.Monad.Fail as Fail
import Data.Maybe (fromMaybe)
import Foreign
@@ -103,6 +105,11 @@
let ks' s1 b1 m1 p1 a = unGet (g a) s1 b1 m1 p1 kf ks
in unGet m s0 b0 m0 p0 kf ks'
+#if !(MIN_VERSION_base(4,13,0))
+ fail = Fail.fail
+#endif
+
+instance Fail.MonadFail Get where
fail = failDesc
instance MonadPlus Get where
name: attoparsec
version: 0.13.2.2
x-revision: 2
license: BSD3
license-file: LICENSE
category: Text, Parsing
author: Bryan O'Sullivan <bos@serpentine.com>
maintainer: Bryan O'Sullivan <bos@serpentine.com>, Ben Gamari <ben@smart-cactus.org>
stability: experimental
tested-with: GHC == 7.0.4, GHC == 7.2.2, GHC == 7.4.2, GHC ==7.6.3, GHC ==7.8.4, GHC ==7.10.3, GHC ==8.0.2, GHC ==8.2.2
synopsis: Fast combinator parsing for bytestrings and text
cabal-version: >= 1.8
homepage: https://github.com/bos/attoparsec
bug-reports: https://github.com/bos/attoparsec/issues
build-type: Simple
description:
A fast parser combinator library, aimed particularly at dealing
efficiently with network protocols and complicated text/binary
file formats.
extra-source-files:
README.markdown
benchmarks/*.cabal
benchmarks/*.hs
benchmarks/*.txt
benchmarks/json-data/*.json
benchmarks/Makefile
benchmarks/med.txt.bz2
changelog.md
examples/*.c
examples/*.hs
examples/Makefile
tests/*.hs
tests/QC/*.hs
tests/QC/IPv6/*.hs
Flag developer
Description: Whether to build the library in development mode
Default: False
Manual: True
library
build-depends: array,
base >= 4.2 && < 5,
bytestring,
containers,
deepseq,
scientific >= 0.3.1 && < 0.4,
transformers >= 0.2 && (< 0.4 || >= 0.4.1.0) && < 0.6,
text >= 1.1.1.3
if impl(ghc < 7.4)
build-depends:
bytestring < 0.10.4.0
if !impl(ghc >= 8.0)
-- Data.Semigroup && Control.Monad.Fail are available in base-4.9+
build-depends: fail == 4.9.*,
semigroups >=0.16.1 && <0.19
exposed-modules: Data.Attoparsec
Data.Attoparsec.ByteString
Data.Attoparsec.ByteString.Char8
Data.Attoparsec.ByteString.Lazy
Data.Attoparsec.Char8
Data.Attoparsec.Combinator
Data.Attoparsec.Internal
Data.Attoparsec.Internal.Types
Data.Attoparsec.Lazy
Data.Attoparsec.Number
Data.Attoparsec.Text
Data.Attoparsec.Text.Lazy
Data.Attoparsec.Types
Data.Attoparsec.Zepto
other-modules: Data.Attoparsec.ByteString.Buffer
Data.Attoparsec.ByteString.FastSet
Data.Attoparsec.ByteString.Internal
Data.Attoparsec.Internal.Fhthagn
Data.Attoparsec.Text.Buffer
Data.Attoparsec.Text.FastSet
Data.Attoparsec.Text.Internal
ghc-options: -O2 -Wall
if flag(developer)
ghc-prof-options: -auto-all
ghc-options: -Werror
test-suite tests
type: exitcode-stdio-1.0
hs-source-dirs: tests .
main-is: QC.hs
other-modules: QC.Buffer
QC.ByteString
QC.Combinator
QC.Common
QC.IPv6.Internal
QC.IPv6.Types
QC.Rechunked
QC.Simple
QC.Text
QC.Text.FastSet
QC.Text.Regressions
other-modules: Data.Attoparsec.ByteString
Data.Attoparsec.ByteString.Buffer
Data.Attoparsec.ByteString.Char8
Data.Attoparsec.ByteString.FastSet
Data.Attoparsec.ByteString.Internal
Data.Attoparsec.ByteString.Lazy
Data.Attoparsec.Combinator
Data.Attoparsec.Internal
Data.Attoparsec.Internal.Fhthagn
Data.Attoparsec.Internal.Types
Data.Attoparsec.Number
Data.Attoparsec.Text
Data.Attoparsec.Text.Buffer
Data.Attoparsec.Text.FastSet
Data.Attoparsec.Text.Internal
Data.Attoparsec.Text.Lazy
Data.Attoparsec.Zepto
ghc-options:
-Wall -threaded -rtsopts
if flag(developer)
ghc-options: -Werror
build-depends:
array,
base >= 4 && < 5,
bytestring,
deepseq >= 1.1,
QuickCheck >= 2.7 && < 2.10,
quickcheck-unicode,
scientific,
tasty >= 0.11,
tasty-quickcheck >= 0.8,
text,
transformers >= 0.2 && (< 0.4 || >= 0.4.1.0) && < 0.6,
vector
if !impl(ghc >= 8.0)
-- Data.Semigroup && Control.Monad.Fail are available in base-4.9+
build-depends: fail == 4.9.*,
semigroups >=0.16.1 && <0.19
benchmark benchmarks
type: exitcode-stdio-1.0
hs-source-dirs: benchmarks benchmarks/warp-3.0.1.1 .
ghc-options: -O2 -Wall -rtsopts
main-is: Benchmarks.hs
other-modules:
Common
HeadersByteString
HeadersByteString.Atto
HeadersText
Links
Network.Wai.Handler.Warp.ReadInt
Network.Wai.Handler.Warp.RequestHeader
Numbers
Sets
TextFastSet
Warp
ghc-options: -O2 -Wall
if flag(developer)
ghc-options: -Werror
build-depends:
array,
base == 4.*,
bytestring >= 0.10.4.0,
case-insensitive,
containers,
criterion >= 1.0,
deepseq >= 1.1,
directory,
filepath,
ghc-prim,
http-types,
parsec >= 3.1.2,
scientific,
text >= 1.1.1.0,
transformers >= 0.2 && (< 0.4 || >= 0.4.1.0) && < 0.6,
unordered-containers,
vector
if !impl(ghc >= 8.0)
-- Data.Semigroup && Control.Monad.Fail are available in base-4.9+
build-depends: fail == 4.9.*,
semigroups >=0.16.1 && <0.19
source-repository head
type: git
location: https://github.com/bos/attoparsec
commit de0cf2890b9602021d6e18a2523ccdf39816d599
Author: Ryan Scott <ryan.gl.scott@gmail.com>
Date: Fri Mar 15 18:18:54 2019 -0400
Adapt to base-4.13.0.0
diff --git a/Data/Attoparsec/Internal/Types.hs b/Data/Attoparsec/Internal/Types.hs
index 7560f22..b848345 100644
--- a/Data/Attoparsec/Internal/Types.hs
+++ b/Data/Attoparsec/Internal/Types.hs
@@ -1,4 +1,4 @@
-{-# LANGUAGE BangPatterns, GeneralizedNewtypeDeriving, OverloadedStrings,
+{-# LANGUAGE CPP, BangPatterns, GeneralizedNewtypeDeriving, OverloadedStrings,
Rank2Types, RecordWildCards, TypeFamilies #-}
-- |
-- Module : Data.Attoparsec.Internal.Types
@@ -136,8 +136,10 @@ instance Mon.Monoid More where
mempty = Incomplete
instance Monad (Parser i) where
+#if !(MIN_VERSION_base(4,13,0))
fail = Fail.fail
{-# INLINE fail #-}
+#endif
return = App.pure
{-# INLINE return #-}
diff --git a/Data/Attoparsec/Zepto.hs b/Data/Attoparsec/Zepto.hs
index 5af5bb6..da2c244 100644
--- a/Data/Attoparsec/Zepto.hs
+++ b/Data/Attoparsec/Zepto.hs
@@ -92,8 +92,10 @@ instance Monad m => Monad (ZeptoT m) where
Fail err -> return (Fail err)
{-# INLINE (>>=) #-}
+#if !(MIN_VERSION_base(4,13,0))
fail = Fail.fail
{-# INLINE fail #-}
+#endif
instance Monad m => Fail.MonadFail (ZeptoT m) where
fail msg = Parser $ \_ -> return (Fail msg)
diff --git a/aur.cabal b/aur.cabal
index b7130e8..5acb75d 100644
--- a/aur.cabal
+++ b/aur.cabal
@@ -1,6 +1,7 @@
cabal-version: 2.2
name: aur
version: 7.0.7
+x-revision: 1
synopsis: Access metadata from the Arch Linux User Repository.
description:
Access package information from Arch Linux's AUR via its RPC interface. The
@@ -36,11 +37,11 @@ library
hs-source-dirs: lib
exposed-modules: Linux.Arch.Aur
build-depends:
- , aeson >=0.9 && <2.1
+ , aeson >=0.9 && <2.3
, bytestring
, hashable >= 1.2
, http-types ^>=0.12
- , text ^>=1.2
+ , text >=1.2
test-suite aur-test
import: commons
diff --git a/aura.cabal b/aura.cabal
index 937ba4e..1f51e64 100644
--- a/aura.cabal
+++ b/aura.cabal
@@ -43,14 +43,14 @@ common commons
, base >=4.12 && <5
, bytestring ^>=0.11
, containers ^>=0.6
- , megaparsec >=7 && <10
+ , megaparsec >=7
, rio ^>=0.1.17
, text >=1.2 && < 1.3 || ^>= 2.0
, versions ^>=6.0.3
common libexec
build-depends:
- , aeson >=2.1 && < 2.3
+ , aeson >=2.1
, aur ^>=7.0.5
, http-client >=0.5 && <0.8
, prettyprinter >=1.2 && <1.8
@@ -58,7 +58,7 @@ common libexec
, scheduler >=1.1 && <2.1
, transformers ^>=0.5
, typed-process ^>=0.2
- , unix ^>=2.7.2.2
+ , unix >=2.7.2.2
library
import: commons, libexec
@@ -90,14 +90,14 @@ library
Aura.Utils
build-depends:
- , algebraic-graphs >=0.1 && <0.8
- , filepath ^>=1.4
+ , algebraic-graphs >=0.1
+ , filepath >=1.4
, hashable ^>=1.4
, http-types >=0.9 && <0.13
- , language-bash >=0.8 && <0.10
+ , language-bash >=0.8
, network-uri ^>=2.6
, stm ^>=2.5
- , time >=1.8 && <1.13
+ , time >=1.8
executable aura
import: commons, libexec
diff --git a/src/Barbies/TH.hs b/src/Barbies/TH.hs
index b1b4622..1199ae7 100644
--- a/src/Barbies/TH.hs
+++ b/src/Barbies/TH.hs
@@ -258,7 +258,7 @@ declareBareBWith DeclareBareBConfig{..} decsQ = do
[ (strat, pure t) | (_, DerivClause strat preds) <- classes', t <- preds ]
return $ DataD [] dataName
#if MIN_VERSION_template_haskell(2,17,0)
- (tvbs ++ [PlainTV nSwitch (), KindedTV nWrap () (AppT (AppT ArrowT StarT) StarT)])
+ (tvbs ++ [PlainTV nSwitch bndrReq, KindedTV nWrap bndrReq (AppT (AppT ArrowT StarT) StarT)])
#else
(tvbs ++ [PlainTV nSwitch, KindedTV nWrap (AppT (AppT ArrowT StarT) StarT)])
#endif
@@ -270,6 +270,12 @@ declareBareBWith DeclareBareBConfig{..} decsQ = do
++ [ TySynD (mkName name) tvbs coveredType | name <- maybeToList $ coveredName $ nameBase dataName0]
go _ d = pure [d]
+-- TODO (int-index): Use MIN_VERSION_template_haskell(2,21,0)
+#if __GLASGOW_HASKELL__ < 907
+bndrReq :: ()
+bndrReq = ()
+#endif
+
dataDecNames :: [Dec] -> [Name]
dataDecNames = nub . mapMaybe decName
where
name: basement
version: 0.0.10
x-revision: 1
synopsis: Foundation scrap box of array & string
description: Foundation most basic primitives without any dependencies
license: BSD3
license-file: LICENSE
copyright: 2015-2017 Vincent Hanquez <vincent@snarc.org>
, 2017-2018 Foundation Maintainers
maintainer: vincent@snarc.org
category: Web
build-type: Simple
homepage: https://github.com/haskell-foundation/foundation#readme
bug-reports: https://github.com/haskell-foundation/foundation/issues
cabal-version: >=1.10
extra-source-files: cbits/*.h cbits/basement_rts.c
source-repository head
type: git
location: https://github.com/haskell-foundation/foundation
subdir: basement
library
hs-source-dirs: .
exposed-modules:
Basement.Imports
Basement.Base16
Basement.Bindings.Memory
Basement.Endianness
Basement.Environment
Basement.PrimType
Basement.Exception
Basement.Cast
Basement.From
Basement.Types.Char7
Basement.Types.CharUTF8
Basement.Types.OffsetSize
Basement.Types.Ptr
Basement.Types.AsciiString
Basement.Types.Word128
Basement.Types.Word256
Basement.Monad
Basement.MutableBuilder
Basement.FinalPtr
Basement.Nat
-- Extended Types
Basement.BoxedArray
Basement.Block
Basement.Block.Mutable
Basement.Block.Builder
Basement.UArray
Basement.UArray.Mutable
Basement.String
Basement.String.Builder
Basement.NonEmpty
-- Extended Types with explicit type level size
Basement.Sized.Block
Basement.Sized.UVect
Basement.Sized.Vect
Basement.Sized.List
Basement.BlockN
-- Utils
Basement.NormalForm
Basement.These
-- Terminal
Basement.Terminal
Basement.Terminal.ANSI
-- numeric stuff
Basement.IntegralConv
Basement.Floating
Basement.Numerical.Number
Basement.Numerical.Additive
Basement.Numerical.Subtractive
Basement.Numerical.Multiplicative
Basement.Bounded
-- exported algorithms
Basement.Alg.XorShift
-- compat / base redefinition
Basement.Compat.AMP
Basement.Compat.Base
Basement.Compat.Bifunctor
Basement.Compat.CallStack
Basement.Compat.C.Types
Basement.Compat.ExtList
Basement.Compat.IsList
Basement.Compat.Identity
Basement.Compat.Primitive
Basement.Compat.PrimTypes
Basement.Compat.MonadTrans
Basement.Compat.Semigroup
Basement.Compat.Natural
Basement.Compat.NumLiteral
Basement.Compat.Typeable
Basement.Bits
other-modules:
Basement.Error
Basement.Show
Basement.Runtime
Basement.Alg.Class
Basement.Alg.Mutable
Basement.Alg.PrimArray
Basement.Alg.UTF8
Basement.Alg.String
Basement.Numerical.Conversion
Basement.Block.Base
Basement.UTF8.Base
Basement.UTF8.Helper
Basement.UTF8.Table
Basement.UTF8.Types
Basement.UArray.Base
Basement.String.CaseMapping
Basement.String.Encoding.Encoding
Basement.String.Encoding.UTF16
Basement.String.Encoding.UTF32
Basement.String.Encoding.ASCII7
Basement.String.Encoding.ISO_8859_1
Basement.Terminal.Size
-- support and dependencies
if impl(ghc < 8.0)
-- https://github.com/haskell-infra/hackage-trustees/issues/171
build-depends: base >= 4.9 && < 4.13
else
build-depends: base
, ghc-prim
if os(windows)
build-depends: Win32
default-language: Haskell2010
default-extensions: NoImplicitPrelude
RebindableSyntax
TypeFamilies
BangPatterns
DeriveDataTypeable
if (arch(i386) || arch(x86_64))
cpp-options: -DARCH_IS_LITTLE_ENDIAN
else
cpp-options: -DARCH_IS_UNKNOWN_ENDIAN
include-dirs: cbits
c-sources: cbits/foundation_mem.c
if impl(ghc < 8.2)
c-sources: cbits/basement_rts.c
diff -ru basement-0.0.10.orig/Basement/Compat/Base.hs basement-0.0.10/Basement/Compat/Base.hs
--- basement-0.0.10.orig/Basement/Compat/Base.hs 2019-01-09 06:14:46.000000000 -0500
+++ basement-0.0.10/Basement/Compat/Base.hs 2019-03-16 08:58:05.439886586 -0400
@@ -1,3 +1,4 @@
+{-# LANGUAGE CPP #-}
-- |
-- Module : Basement.Compat.Base
-- License : BSD-style
@@ -34,6 +35,9 @@
, Prelude.Functor (..)
, Control.Applicative.Applicative (..)
, Prelude.Monad (..)
+#if MIN_VERSION_base(4,13,0)
+ , Prelude.MonadFail (..)
+#endif
, Control.Monad.when
, Control.Monad.unless
, Prelude.Maybe (..)
diff -ru bencode-0.6.0.0.orig/src/Data/BEncode/Parser.hs bencode-0.6.0.0/src/Data/BEncode/Parser.hs
--- bencode-0.6.0.0.orig/src/Data/BEncode/Parser.hs 2015-05-09 15:56:43.000000000 -0400
+++ bencode-0.6.0.0/src/Data/BEncode/Parser.hs 2019-05-17 14:32:05.074495583 -0400
@@ -1,3 +1,5 @@
+{-# LANGUAGE CPP #-}
+
-----------------------------------------------------------------------------
-- |
-- Module : BParser
@@ -26,6 +28,7 @@
import Control.Applicative hiding (optional)
import Control.Monad
+import qualified Control.Monad.Fail as Fail
import Data.BEncode
import qualified Data.ByteString.Lazy.Char8 as L
import qualified Data.Map as Map
@@ -61,6 +64,11 @@
Ok a b' -> runB (f a) b'
Error str -> Error str
return val = BParser $ Ok val
+#if !(MIN_VERSION_base(4,13,0))
+ fail = Fail.fail
+#endif
+
+instance Fail.MonadFail BParser where
fail str = BParser $ \_ -> Error str
instance Functor BParser where
diff --git a/src/Data/Tuple/Unboxed.hs b/src/Data/Tuple/Unboxed.hs
index c27e1db..49720e2 100644
--- a/src/Data/Tuple/Unboxed.hs
+++ b/src/Data/Tuple/Unboxed.hs
@@ -76,7 +76,7 @@
-------------------------------------------------------------------------------
module Data.Tuple.Unboxed where
-import GHC.Prim
+import GHC.Exts
#if WORD_SIZE_IN_BITS >= 32
#define INT32 Int#
diff --git a/src/Data/Tuple/Unboxed/Rep.hs b/src/Data/Tuple/Unboxed/Rep.hs
index fd4796a..342f784 100644
--- a/src/Data/Tuple/Unboxed/Rep.hs
+++ b/src/Data/Tuple/Unboxed/Rep.hs
@@ -12,7 +12,7 @@
-- Stability : experimental
-- Portability : non-portable
--
--- This module provides an ad-hoc polymorphic alternative to the functions in
+-- This module provides an ad-hoc polymorphic alternative to the functions in
-- "Data.Tuple.Unboxed". The functions have the same basic signature, but using
-- GHC 8.0+ features they are made parametrically polymorphic within each fixed
-- representation/calling convention.
@@ -30,6 +30,9 @@ module Data.Tuple.Unboxed.Rep
import Data.Kind
import GHC.Prim
import GHC.Exts
+#if MIN_VERSION_ghc_prim(0,8,0)
+import GHC.Types (UnliftedRep)
+#endif
#if __GLASGOW_HASKELL__ >= 802
type VoidRep = TupleRep '[]
diff --git a/bv-sized.cabal b/bv-sized.cabal
index 5ff840f..9a6222c 100644
--- a/bv-sized.cabal
+++ b/bv-sized.cabal
@@ -32,7 +32,7 @@ library
deepseq >= 1.4.0 && < 1.5.0,
panic >= 0.4.0 && < 0.5,
parameterized-utils >= 2.0.2 && < 2.2,
- random >= 1.2.0 && < 1.3,
+ random >= 1.3.0 && < 1.4,
th-lift >= 0.8.1 && < 0.9
hs-source-dirs: src
default-language: Haskell2010
diff --git a/src/Data/BitVector/Sized/Signed.hs b/src/Data/BitVector/Sized/Signed.hs
index 691d248..05c8ade 100644
--- a/src/Data/BitVector/Sized/Signed.hs
+++ b/src/Data/BitVector/Sized/Signed.hs
@@ -1,3 +1,4 @@
+{-# LANGUAGE CPP #-}
{-# LANGUAGE DataKinds #-}
{-# LANGUAGE DeriveAnyClass #-}
{-# LANGUAGE DeriveGeneric #-}
@@ -141,6 +142,10 @@ instance KnownNat w => Uniform (SignedBV w) where
instance (KnownNat w, 1 <= w) => UniformRange (SignedBV w) where
uniformRM (SignedBV lo, SignedBV hi) g =
SignedBV <$> BV.sUniformRM knownNat (lo, hi) g
+#if MIN_VERSION_random(1,3,0)
+ isInRange (lo, hi) x =
+ lo <= x && x <= hi
+#endif
instance (KnownNat w, 1 <= w) => Random (SignedBV w)
diff --git a/src/Data/BitVector/Sized/Unsigned.hs b/src/Data/BitVector/Sized/Unsigned.hs
index 65f3ece..f9cb94f 100644
--- a/src/Data/BitVector/Sized/Unsigned.hs
+++ b/src/Data/BitVector/Sized/Unsigned.hs
@@ -1,3 +1,4 @@
+{-# LANGUAGE CPP #-}
{-# LANGUAGE DataKinds #-}
{-# LANGUAGE DeriveAnyClass #-}
{-# LANGUAGE DeriveGeneric #-}
@@ -132,6 +133,10 @@ instance KnownNat w => Uniform (UnsignedBV w) where
instance UniformRange (UnsignedBV w) where
uniformRM (UnsignedBV lo, UnsignedBV hi) g =
UnsignedBV <$> BV.uUniformRM (lo, hi) g
+#if MIN_VERSION_random(1,3,0)
+ isInRange (lo, hi) x =
+ lo <= x && x <= hi
+#endif
instance KnownNat w => Random (UnsignedBV w)
commit 3bbc80a8a708886f593c9591197d43191e7f31ba
Author: Ryan Scott <ryan.gl.scott@gmail.com>
Date: Fri Mar 15 14:09:31 2019 -0400
Adapt to base-4.13.0.0
diff --git a/src/Data/Bytes/Get.hs b/src/Data/Bytes/Get.hs
index 6ab1a04..fd5e26b 100644
--- a/src/Data/Bytes/Get.hs
+++ b/src/Data/Bytes/Get.hs
@@ -28,6 +28,7 @@ module Data.Bytes.Get
#if __GLASGOW_HASKELL__ < 710
import Control.Applicative
#endif
+import qualified Control.Monad.Fail as Fail
import Control.Monad.Reader
import Control.Monad.Trans.Except as Except
import Control.Monad.RWS.Lazy as Lazy
@@ -43,7 +44,7 @@ import Data.Int
import qualified Data.Serialize.Get as S
import Data.Word
-class (Integral (Remaining m), Monad m, Applicative m) => MonadGet m where
+class (Integral (Remaining m), Fail.MonadFail m, Applicative m) => MonadGet m where
-- | An 'Integral' number type used for unchecked skips and counting.
type Remaining m :: *
diff --git a/src/Data/Bytes/Serial.hs b/src/Data/Bytes/Serial.hs
index a669f15..b032665 100644
--- a/src/Data/Bytes/Serial.hs
+++ b/src/Data/Bytes/Serial.hs
@@ -594,7 +594,7 @@ instance GSerial U1 where
gdeserialize = return U1
instance GSerial V1 where
- gserialize _ = fail "I looked into the void."
+ gserialize _ = error "I looked into the void."
gdeserialize = fail "I looked into the void."
instance (GSerial f, GSerial g) => GSerial (f :*: g) where
@@ -772,7 +772,7 @@ instance GSerial1 U1 where
gdeserializeWith _ = return U1
instance GSerial1 V1 where
- gserializeWith _ = fail "I looked into the void."
+ gserializeWith _ = error "I looked into the void."
gdeserializeWith _ = fail "I looked into the void."
instance (GSerial1 f, GSerial1 g) => GSerial1 (f :*: g) where
diff -ru bytestring-mmap-0.2.2.orig/System/IO/Posix/MMap/Lazy.hs bytestring-mmap-0.2.2/System/IO/Posix/MMap/Lazy.hs
--- bytestring-mmap-0.2.2.orig/System/IO/Posix/MMap/Lazy.hs 2011-04-29 15:58:05.000000000 -0400
+++ bytestring-mmap-0.2.2/System/IO/Posix/MMap/Lazy.hs 2018-05-20 14:44:47.123915525 -0400
@@ -91,7 +91,11 @@
--
unsafeMMapFile :: FilePath -> IO ByteString
unsafeMMapFile path = do
- fd <- openFd path ReadOnly Nothing defaultFileFlags
+ fd <- openFd path ReadOnly
+#if !(MIN_VERSION_unix(2,8,0))
+ Nothing
+#endif
+ defaultFileFlags
always (closeFd fd) $ do
stat <- getFdStatus fd
let size = fromIntegral (fileSize stat)
diff -ru bytestring-mmap-0.2.2.orig/System/IO/Posix/MMap.hs bytestring-mmap-0.2.2/System/IO/Posix/MMap.hs
--- bytestring-mmap-0.2.2.orig/System/IO/Posix/MMap.hs 2011-04-29 15:58:05.000000000 -0400
+++ bytestring-mmap-0.2.2/System/IO/Posix/MMap.hs 2018-05-20 14:44:17.671914783 -0400
@@ -1,4 +1,4 @@
-{-# LANGUAGE ForeignFunctionInterface #-}
+{-# LANGUAGE CPP, ForeignFunctionInterface #-}
--------------------------------------------------------------------
-- |
-- Module : System.IO.Posix.MMap
@@ -98,7 +98,11 @@
--
unsafeMMapFile :: FilePath -> IO ByteString
unsafeMMapFile f = do
- fd <- openFd f ReadOnly Nothing defaultFileFlags
+ fd <- openFd f ReadOnly
+#if !(MIN_VERSION_unix(2,8,0))
+ Nothing
+#endif
+ defaultFileFlags
always (closeFd fd) $ do
stat <- getFdStatus fd
let size = fromIntegral (fileSize stat)
commit 79490be79c4ad2e07fc8e43a9887fc21f1907f76
Author: Ryan Scott <ryan.gl.scott@gmail.com>
Date: Wed Jun 12 18:52:03 2019 -0400
Allow building with Cabal-3.0.*
diff --git a/src/Distribution/Extra/Doctest.hs b/src/Distribution/Extra/Doctest.hs
index 1beb9d2..94ca62b 100644
--- a/src/Distribution/Extra/Doctest.hs
+++ b/src/Distribution/Extra/Doctest.hs
@@ -69,8 +69,10 @@ import Distribution.PackageDescription
PackageDescription (), TestSuite (..))
import Distribution.Simple
(UserHooks (..), autoconfUserHooks, defaultMainWithHooks, simpleUserHooks)
+#if !(MIN_VERSION_Cabal(3,0,0))
import Distribution.Simple.BuildPaths
(autogenModulesDir)
+#endif
import Distribution.Simple.Compiler
(PackageDB (..), showCompilerId)
import Distribution.Simple.LocalBuildInfo
@@ -79,7 +81,11 @@ import Distribution.Simple.LocalBuildInfo
import Distribution.Simple.Setup
(BuildFlags (buildDistPref, buildVerbosity), HaddockFlags (haddockDistPref, haddockVerbosity), fromFlag, emptyBuildFlags)
import Distribution.Simple.Utils
- (createDirectoryIfMissingVerbose, findFile, rewriteFile)
+ (createDirectoryIfMissingVerbose, findFile)
+#if !(MIN_VERSION_Cabal(3,0,0))
+import Distribution.Simple.Utils
+ (rewriteFile)
+#endif
import Distribution.Text
(display, simpleParse)
import System.FilePath
@@ -103,6 +109,9 @@ import Distribution.Types.GenericPackageDescription
import Distribution.PackageDescription
(CondTree (..))
#endif
+#if MIN_VERSION_Cabal(2,5,0)
+import Distribution.Types.LibraryName (libraryNameString)
+#endif
#if MIN_VERSION_directory(1,2,2)
import System.Directory
@@ -432,7 +441,9 @@ generateBuildModule testSuiteName flags pkg lbi = do
isSpecific _ = False
mbLibraryName :: Library -> Name
-#if MIN_VERSION_Cabal(2,0,0)
+#if MIN_VERSION_Cabal(2,5,0)
+ mbLibraryName = NameLib . fmap unUnqualComponentName . libraryNameString . libName
+#elif MIN_VERSION_Cabal(2,0,0)
-- Cabal-2.0 introduced internal libraries, which are named.
mbLibraryName = NameLib . fmap unUnqualComponentName . libName
#else
cabal-version: 1.12
Name: cassava
Version: 0.5.1.0
x-revision: 1
Synopsis: A CSV parsing and encoding library
Description: {
@cassava@ is a library for parsing and encoding [RFC 4180](https://tools.ietf.org/html/rfc4180)
compliant [comma-separated values (CSV)](https://en.wikipedia.org/wiki/Comma-separated_values) data,
which is a textual line-oriented format commonly used for exchanging tabular data.
.
@cassava@'s API includes support for
.
- Index-based record-conversion
- Name-based record-conversion
- Typeclass directed conversion of fields and records
- Built-in field-conversion instances for standard types
- Customizable record-conversion instance derivation via GHC generics
- Low-level [bytestring](https://hackage.haskell.org/package/bytestring) builders (see "Data.Csv.Builder")
- Incremental decoding and encoding API (see "Data.Csv.Incremental")
- Streaming API for constant-space decoding (see "Data.Csv.Streaming")
.
Moreover, this library is designed to be easy to use; for instance, here's a
very simple example of encoding CSV data:
.
>>> Data.Csv.encode [("John",27),("Jane",28)]
"John,27\r\nJane,28\r\n"
.
Please refer to the documentation in "Data.Csv" and the included [README](#readme) for more usage examples.
}
Homepage: https://github.com/hvr/cassava
License: BSD3
License-file: LICENSE
Bug-reports: https://github.com/hvr/cassava/issues
Copyright: (c) 2012 Johan Tibell
(c) 2012 Bryan O'Sullivan
(c) 2011 MailRank, Inc.
Author: Johan Tibell
Maintainer: hvr@gnu.org
Category: Text, Web, CSV
Build-type: Simple
Extra-source-files: examples/*.hs,
CHANGES.md,
README.md
Tested-with: GHC ==8.2.1, GHC ==8.0.2, GHC ==8.0.1, GHC ==7.10.3, GHC ==7.8.4, GHC ==7.6.3, GHC ==7.4.2
----------------------------------------------------------------------------
source-repository head
type: git
location: https://github.com/hvr/cassava.git
flag bytestring--LT-0_10_4
description: [bytestring](https://hackage.haskell.org/haskell/package/bytestring) < 0.10.4
manual: True
default: False
Library
default-language: Haskell2010
other-extensions:
BangPatterns
CPP
DataKinds
DefaultSignatures
DeriveFunctor
FlexibleContexts
FlexibleInstances
KindSignatures
MultiParamTypeClasses
OverloadedStrings
PolyKinds
Rank2Types
ScopedTypeVariables
TypeOperators
UndecidableInstances
if impl(ghc >= 8.0)
other-extensions:
DataKinds
PolyKinds
Exposed-modules:
Data.Csv
Data.Csv.Builder
Data.Csv.Incremental
Data.Csv.Parser
Data.Csv.Streaming
Other-modules:
Data.Csv.Conversion
Data.Csv.Conversion.Internal
Data.Csv.Encoding
Data.Csv.Types
Data.Csv.Util
Build-depends:
array >= 0.4 && < 0.6,
attoparsec >= 0.11.3.0 && < 0.14,
base >= 4.5 && < 5,
bytestring >= 0.9.2 && < 0.11,
containers >= 0.4.2 && < 0.7,
deepseq >= 1.1 && < 1.5,
hashable < 1.3,
scientific >= 0.3.4.7 && < 0.4,
text < 1.3,
unordered-containers < 0.3,
vector >= 0.8 && < 0.13,
Only >= 0.1 && < 0.1.1
if flag(bytestring--LT-0_10_4)
build-depends: bytestring < 0.10.4
, bytestring-builder >= 0.10.8 && < 0.11
else
build-depends: bytestring >= 0.10.4
, text-short == 0.1.*
-- GHC.Generics lived in `ghc-prim` for GHC 7.2 & GHC 7.4 only
if impl(ghc < 7.6)
build-depends: ghc-prim == 0.2.*
-- For Numeric.Natural
if impl(ghc < 7.10)
build-depends: nats >= 1 && < 1.2
-- https://ghc.haskell.org/trac/ghc/wiki/Migration/8.0#Recommendationsforforward-compatibility
if impl(ghc >= 8.0)
ghc-options: -Wcompat -Wnoncanonical-monad-instances -Wnoncanonical-monadfail-instances
else
-- provide/emulate `Control.Monad.Fail` and `Data.Semigroups` API for pre-GHC8
build-depends: fail == 4.9.*, semigroups == 0.18.*
if impl(ghc >= 8.2)
ghc-options: -Wcpp-undef
ghc-options: -Wall -O2
----------------------------------------------------------------------------
Test-suite unit-tests
default-language: Haskell2010
Type: exitcode-stdio-1.0
Main-is: UnitTests.hs
-- dependencies with version constraints inherited via lib:cassava
Build-depends: attoparsec
, base
, bytestring
, cassava
, hashable
, scientific
, text
, unordered-containers
, vector
-- extra dependencies not already used by lib:cassava
build-depends: HUnit < 1.7
, QuickCheck == 2.10.*
, quickcheck-instances >= 0.3.12 && < 0.4
, test-framework == 0.8.*
, test-framework-hunit == 0.3.*
, test-framework-quickcheck2 == 0.3.*
hs-source-dirs: tests
-- GHC.Generics lived in `ghc-prim` for GHC 7.2 & GHC 7.4 only
if impl(ghc < 7.6)
build-depends: ghc-prim == 0.2.*
-- For Numeric.Natural
if impl(ghc < 7.10)
build-depends: nats >= 1 && < 1.2
-- https://ghc.haskell.org/trac/ghc/wiki/Migration/8.0#Recommendationsforforward-compatibility
if impl(ghc >= 8.0)
ghc-options: -Wcompat -Wnoncanonical-monad-instances -Wnoncanonical-monadfail-instances
else
-- provide/emulate `Control.Monad.Fail` and `Data.Semigroups` API for pre-GHC8
build-depends: fail == 4.9.*, semigroups == 0.18.*
if impl(ghc >= 8.2)
ghc-options: -Wcpp-undef
ghc-options: -Wall
diff -ru cassava-0.5.1.0.orig/Data/Csv/Conversion.hs cassava-0.5.1.0/Data/Csv/Conversion.hs
--- cassava-0.5.1.0.orig/Data/Csv/Conversion.hs 2017-08-12 12:05:04.000000000 -0400
+++ cassava-0.5.1.0/Data/Csv/Conversion.hs 2019-03-15 19:00:40.945760943 -0400
@@ -1188,8 +1188,10 @@
{-# INLINE (>>) #-}
return = pure
{-# INLINE return #-}
+#if !(MIN_VERSION_base(4,13,0))
fail = Fail.fail
{-# INLINE fail #-}
+#endif
-- | @since 0.5.0.0
instance Fail.MonadFail Parser where
diff -ru cborg-0.2.1.0.orig/src/Codec/CBOR/Decoding.hs cborg-0.2.1.0/src/Codec/CBOR/Decoding.hs
--- cborg-0.2.1.0.orig/src/Codec/CBOR/Decoding.hs 2018-10-11 17:10:04.000000000 -0400
+++ cborg-0.2.1.0/src/Codec/CBOR/Decoding.hs 2019-03-16 07:38:16.792667620 -0400
@@ -282,7 +282,9 @@
{-# INLINE (>>) #-}
(>>) = (*>)
+#if !(MIN_VERSION_base(4,13,0))
fail = Fail.fail
+#endif
-- | @since 0.2.0.0
instance Fail.MonadFail (Decoder s) where
@@ -828,14 +830,14 @@
decodeListLenCanonicalOf = decodeListLenOfHelper decodeListLenCanonical
{-# INLINE decodeListLenCanonicalOf #-}
-decodeListLenOfHelper :: (Show a, Eq a, Monad m) => m a -> a -> m ()
+decodeListLenOfHelper :: (Show a, Eq a, Fail.MonadFail m) => m a -> a -> m ()
decodeListLenOfHelper decodeFun = \len -> do
len' <- decodeFun
if len == len' then return ()
else fail $ "expected list of length " ++ show len
{-# INLINE decodeListLenOfHelper #-}
-decodeWordOfHelper :: (Show a, Eq a, Monad m) => m a -> a -> m ()
+decodeWordOfHelper :: (Show a, Eq a, Fail.MonadFail m) => m a -> a -> m ()
decodeWordOfHelper decodeFun = \n -> do
n' <- decodeFun
if n == n' then return ()
diff -ru cborg-0.2.1.0.orig/src/Codec/CBOR/Pretty.hs cborg-0.2.1.0/src/Codec/CBOR/Pretty.hs
--- cborg-0.2.1.0.orig/src/Codec/CBOR/Pretty.hs 2018-10-11 17:10:04.000000000 -0400
+++ cborg-0.2.1.0/src/Codec/CBOR/Pretty.hs 2019-03-16 07:38:42.156935413 -0400
@@ -103,7 +103,9 @@
Right (toks', ind', ss', x) -> let PP g' = g x
in g' toks' ind' ss'
return = pure
+#if !(MIN_VERSION_base(4,13,0))
fail = Fail.fail
+#endif
instance Fail.MonadFail PP where
fail s = PP $ \_ _ _ -> Left s