packages feed

ghc-typelits-natnormalise-0.9.4: ghc-typelits-natnormalise.cabal

cabal-version:       3.0
name:                ghc-typelits-natnormalise
version:             0.9.4
synopsis:            GHC typechecker plugin for types of kind GHC.TypeLits.Nat
description:
  A type checker plugin for GHC that can solve /equalities/ and /inequalities/
  of types of kind @Nat@, where these types are either:

  * Type-level naturals

  * Type variables

  * Applications of the arithmetic expressions @(+,-,*,^)@.

  It solves these equalities by normalising them to /sort-of/ @SOP@
  (Sum-of-Products) form, and then perform a simple syntactic equality.

  For example, this solver can prove the equality between:

  @
  (x + 2)^(y + 2)
  @

  and

  @
  4*x*(2 + x)^y + 4*(2 + x)^y + (2 + x)^y*x^2
  @

  Because the latter is actually the @SOP@ normal form of the former.

  To use the plugin, add the

  @
  OPTIONS_GHC -fplugin GHC.TypeLits.Normalise
  @

  Pragma to the header of your file.
homepage:            http://www.clash-lang.org/
bug-reports:         http://github.com/clash-lang/ghc-typelits-natnormalise/issues
license:             BSD-2-Clause
license-file:        LICENSE
author:              Christiaan Baaij
maintainer:          christiaan.baaij@gmail.com
copyright:           Copyright © 2015-2016, University of Twente,
                                 2017-2018, QBayLogic B.V.
category:            Type System
build-type:          Simple
extra-doc-files:     README.md
                     CHANGELOG.md
tested-with:         GHC == 8.8.4, GHC == 8.10.7, GHC == 9.0.2, GHC == 9.2.8,
                     GHC == 9.4.8, GHC == 9.6.7, GHC == 9.8.4, GHC == 9.10.2,
                     GHC == 9.12.2

source-repository head
  type: git
  location: https://github.com/clash-lang/ghc-typelits-natnormalise.git

flag deverror
  description:
    Enables `-Werror` for development mode and TravisCI
  default: False
  manual: True

library
  exposed-modules:     GHC.TypeLits.Normalise,
                       GHC.TypeLits.Normalise.Compat,
                       GHC.TypeLits.Normalise.SOP,
                       GHC.TypeLits.Normalise.Unify
  build-depends:       base                >=4.9   && <5,
                       containers          >=0.5.7.1 && <0.9,
                       ghc                 >=8.8.1 && <9.15,
                       ghc-tcplugin-api    >=0.18.2 && <0.19,
                       transformers        >=0.5.2.0 && < 0.7
  if impl(ghc >= 9.0.0)
    build-depends:     ghc-bignum >=1.0 && <1.5
  else
    build-depends:     integer-gmp >=1.0 && <1.1

    mixins:
      ghc
        ( TcTypeNats as GHC.Builtin.Types.Literals
        , TyCon      as GHC.Core.TyCon
        , TysWiredIn as GHC.Builtin.Types
        , Unique     as GHC.Types.Unique
        , Util       as GHC.Utils.Misc
        )

  hs-source-dirs:      src
  default-language:    Haskell2010
  other-extensions:    CPP
                       LambdaCase
                       RecordWildCards
                       TupleSections
  if flag(deverror)
    ghc-options:         -Wall -Werror
  else
    ghc-options:         -Wall

test-suite unit-tests
  type:                exitcode-stdio-1.0
  main-is:             Tests.hs
  Other-Modules:       ShouldError
                       ShouldError.Tasty
  build-depends:       base >=4.8 && <5,
                       ghc-typelits-natnormalise,
                       interpolate,
                       process,
                       tasty >= 0.10,
                       tasty-hunit >= 0.9,
                       temporary
  if impl(ghc >= 9.4)
    build-depends:     ghc-prim >= 0.9
  hs-source-dirs:      tests
  ghc-options:         -Wall
  default-language:    Haskell2010
  other-extensions:    DataKinds
                       GADTs
                       KindSignatures
                       NoImplicitPrelude
                       TypeFamilies
                       TypeOperators
                       ScopedTypeVariables
  if flag(deverror)
    ghc-options:       -Werror -dcore-lint