cabal-version:      2.2
name:               ral
version:            0.2
synopsis:           Random access lists
category:           Data, Dependent Types, Singletons
description:
  This package provides ordinary random access list, 'RAList', and also 
  a length indexed variant, 'RAVec'.
  .
  The data structure allows fast cons-operation (like ordinary list) but also fast random access (like non-functional arrays).
  .
  For @lens@ or @optics@ support see [ral-lens](https://hackage.haskell.org/package/ral-lens) and [ral-optics](https://hackage.haskell.org/package/ral-optics) packages respectively.
  .
  === Similar packages
  .
  This packages don't provide length-indexed variant, and their 'RAList' has
  opaque structure.
  .
  * https://hackage.haskell.org/package/ralist
  * https://hackage.haskell.org/package/random-access-list

homepage:           https://github.com/phadej/vec
bug-reports:        https://github.com/phadej/vec/issues
license:            GPL-2.0-or-later
license-file:       LICENSE
author:             Oleg Grenrus <oleg.grenrus@iki.fi>
maintainer:         Oleg.Grenrus <oleg.grenrus@iki.fi>
copyright:          (c) 2019-2021 Oleg Grenrus
build-type:         Simple
extra-source-files: ChangeLog.md
tested-with:
  GHC ==7.8.4
   || ==7.10.3
   || ==8.0.2
   || ==8.2.2
   || ==8.4.4
   || ==8.6.5
   || ==8.8.4
   || ==8.10.4
   || ==9.0.1

source-repository head
  type:     git
  location: https://github.com/phadej/vec.git
  subdir:   ral

flag adjunctions
  description: Depend on @adjunctions@ to provide its instances
  manual:      True
  default:     True

flag distributive
  description:
    Depend on @distributive@ to provide its instances. Turning on, disables @adjunctions@ too.

  manual:      True
  default:     True

flag semigroupoids
  description:
    Depend on @semigroupoids@ to provide its instances, and `traverse1`.

  manual:      True
  default:     True

library
  default-language: Haskell2010
  hs-source-dirs:   src
  ghc-options:      -Wall -fprint-explicit-kinds
  exposed-modules:
    Data.RAList
    Data.RAList.NonEmpty
    Data.RAList.Tree
    Data.RAVec
    Data.RAVec.NonEmpty
    Data.RAVec.Tree
    Data.RAVec.Tree.DF

  other-modules:
    Data.RAList.Internal
    Data.RAList.NonEmpty.Internal
    Data.RAList.Tree.Internal
    TrustworthyCompat

  -- GHC boot libs
  build-depends:
    , base     >=4.7     && <4.16
    , deepseq  >=1.3.0.1 && <1.5

  if !impl(ghc >=8.0)
    build-depends: semigroups >=0.18.5 && <0.20

  -- siblings
  build-depends:
    , bin  ^>=0.1
    , fin  ^>=0.2

  -- other dependencies
  build-depends:
    , hashable             >=1.2.7.0 && <1.4
    , indexed-traversable  ^>=0.1.1
    , QuickCheck           ^>=2.14.2

  if flag(distributive)
    build-depends: distributive >=0.5.3 && <0.7

    if flag(adjunctions)
      build-depends: adjunctions ^>=4.4

  if flag(semigroupoids)
    build-depends: semigroupoids ^>=5.3.5

  if impl(ghc >=9.0)
    -- these flags may abort compilation with GHC-8.10
    -- https://gitlab.haskell.org/ghc/ghc/-/merge_requests/3295
    ghc-options: -Winferred-safe-imports -Wmissing-safe-haskell-mode

-- dump-core
-- if impl(ghc >= 8.0)
--  build-depends: dump-core
--  ghc-options: -fplugin=DumpCore -fplugin-opt DumpCore:core-html

benchmark ral-bench
  type:             exitcode-stdio-1.0
  default-language: Haskell2010
  hs-source-dirs:   bench
  ghc-options:      -Wall -fprint-explicit-kinds -threaded
  main-is:          Bench.hs
  build-depends:
    , base
    , criterion
    , ral
    , vector