cabal-version:      2.2
name:               overloaded
version:            0.3.1
synopsis:           Overloaded pragmas as a plugin
description:
  Implement @Overloaded@ pragmas as a source plugin
  .
  For example we can replace
  .
  @
  {-\# LANGUAGE OverloadedStrings #-}
  @
  .
  with
  .
  @
  {-\# OPTIONS -fplugin=Overloaded -fplugin-opt=Overloaded:Strings #-}
  @

license:            BSD-3-Clause
license-file:       LICENSE
author:             Oleg Grenrus <oleg.grenrus@iki.fi>
maintainer:         Oleg Grenrus <oleg.grenrus@iki.fi>
category:           Plugin
extra-source-files: CHANGELOG.md
tested-with:        GHC ==8.6.5 || ==8.8.3 || ==8.10.4 || ==9.0.1

source-repository head
  type:     git
  location: https://github.com/phadej/overloaded.git

library
  default-language: Haskell2010
  hs-source-dirs:   src
  ghc-options:      -Wall
  exposed-modules:
    Overloaded
    Overloaded.Categories
    Overloaded.Chars
    Overloaded.CodeLabels
    Overloaded.CodeStrings
    Overloaded.Constructors
    Overloaded.Do
    Overloaded.If
    Overloaded.Lists
    Overloaded.Lists.Bidi
    Overloaded.Naturals
    Overloaded.Numerals
    Overloaded.Plugin
    Overloaded.Symbols
    Overloaded.TypeNats
    Overloaded.TypeSymbols

  other-modules:
    GHC.Compat.All
    GHC.Compat.Expr
    Overloaded.Plugin.Categories
    Overloaded.Plugin.Diagnostics
    Overloaded.Plugin.HasConstructor
    Overloaded.Plugin.HasField
    Overloaded.Plugin.IdiomBrackets
    Overloaded.Plugin.LocalDo
    Overloaded.Plugin.Names
    Overloaded.Plugin.Rewrite
    Overloaded.Plugin.TcPlugin
    Overloaded.Plugin.TcPlugin.Ctx
    Overloaded.Plugin.TcPlugin.Utils
    Overloaded.Plugin.V

  -- GHC boot dependencies
  build-depends:
    , base              ^>=4.12.0.0 || ^>=4.13.0.0 || ^>=4.14.0.0 || ^>=4.15.0.0
    , bytestring        ^>=0.10.8.2
    , containers        ^>=0.6.0.1
    , ghc               ^>=8.6 || ^>=8.8 || ^>=8.10 || ^>=9.0
    , template-haskell
    , text              ^>=1.2.3.0
    , time              ^>=1.8.0.2 || ^>=1.9.3

  -- other dependencies
  build-depends:
    , assoc                ^>=1.0.1
    , bin                  ^>=0.1.1
    , fin                  ^>=0.2
    , indexed-traversable  ^>=0.1.1
    , profunctors          ^>=5.6
    , ral                  ^>=0.2
    , record-hasfield      ^>=1.0
    , semigroupoids        ^>=5.3.4
    , sop-core             ^>=0.5.0.0
    , split                ^>=0.2.3.3
    , syb                  ^>=0.7.1
    , symbols              ^>=0.3.0.0
    , th-compat            ^>=0.1.1
    , vec                  ^>=0.4

test-suite example
  default-language: Haskell2010
  type:             exitcode-stdio-1.0
  hs-source-dirs:   example
  main-is:          Example.hs

  -- inherited dependencies
  build-depends:
    , base
    , bytestring
    , fin
    , overloaded
    , sop-core
    , symbols
    , vec

  -- test dependencies
  build-depends:
    , HUnit        ^>=1.6.0.0
    , tasty
    , tasty-hunit

test-suite example-idiom-brackets
  default-language: Haskell2010
  type:             exitcode-stdio-1.0
  hs-source-dirs:   example
  main-is:          IdiomBrackets.hs

  -- inherited dependencies
  build-depends:
    , base
    , overloaded

  -- test dependencies
  build-depends:
    , HUnit        ^>=1.6.0.0
    , tasty
    , tasty-hunit

test-suite example-record-fields
  default-language: Haskell2010
  type:             exitcode-stdio-1.0
  hs-source-dirs:   example
  main-is:          RecordFields.hs

  -- inherited dependencies
  build-depends:
    , base
    , overloaded

  -- test dependencies
  build-depends:
    , HUnit            ^>=1.6.0.0
    , record-hasfield
    , tasty
    , tasty-hunit

test-suite example-boring
  default-language: Haskell2010
  type:             exitcode-stdio-1.0
  hs-source-dirs:   example
  main-is:          Boring.hs

  -- inherited dependencies
  build-depends:
    , base
    , overloaded

  -- test dependencies
  build-depends:
    , boring       ^>=0.1.3
    , constraints  ^>=0.13
    , HUnit        ^>=1.6.0.0
    , tasty
    , tasty-hunit

test-suite example-local-do
  default-language: Haskell2010
  type:             exitcode-stdio-1.0
  hs-source-dirs:   example
  main-is:          LocalDo.hs

  -- inherited dependencies
  build-depends:
    , base
    , overloaded

test-suite example-ad
  default-language: Haskell2010
  type:             exitcode-stdio-1.0
  hs-source-dirs:   example
  main-is:          AD.hs
  other-modules:    VectorSpace
  build-depends:
    , base
    , constraints  ^>=0.13
    , hmatrix      ^>=0.20.0.0
    , overloaded
    , splitmix     ^>=0.1

  if impl(ghc >=9.0)
    buildable: False

library optics-hasfield
  default-language: Haskell2010
  hs-source-dirs:   optics-hasfield
  exposed-modules:  Optics.HasField
  build-depends:
    , base
    , optics-core
    , record-hasfield

test-suite test
  default-language: Haskell2010
  type:             exitcode-stdio-1.0
  hs-source-dirs:   test
  main-is:          Tests.hs
  other-modules:
    AD
    IxMonad
    Overloaded.Test.Categories
    Overloaded.Test.Chars
    Overloaded.Test.CodeLabels
    Overloaded.Test.CodeLabels.String
    Overloaded.Test.CodeStrings
    Overloaded.Test.Constructors
    Overloaded.Test.Do
    Overloaded.Test.If
    Overloaded.Test.Labels
    Overloaded.Test.Labels.GenericLens
    Overloaded.Test.Lists
    Overloaded.Test.Lists.Bidi
    Overloaded.Test.Naturals
    Overloaded.Test.Numerals
    Overloaded.Test.RebindableApplications
    Overloaded.Test.RecordFields
    Overloaded.Test.Strings
    Overloaded.Test.Symbols
    Overloaded.Test.TypeSymbols
    Regexp.Term
    Regexp.Type
    STLC

  -- inherited dependencies
  build-depends:
    , assoc
    , base
    , bin
    , bytestring
    , containers
    , fin
    , optics-core
    , optics-hasfield
    , overloaded
    , ral
    , record-hasfield
    , sop-core
    , symbols
    , template-haskell
    , text
    , th-compat
    , time
    , vec

  -- test dependencies
  build-depends:
    , generic-lens-lite  ^>=0.1
    , lens               ^>=5
    , QuickCheck         ^>=2.14
    , singleton-bool     ^>=0.1.5
    , tasty              ^>=1.4.1
    , tasty-hunit        ^>=0.10.0.2
    , tasty-quickcheck   ^>=0.10.1.1