# Copyright 1999-2024 Gentoo Authors
# Distributed under the terms of the GNU General Public License v2

EAPI=8

# ebuild generated by hackport 0.8.5.1.9999
#hackport: flags: +split-these,use-reflex-optimizer:plugin,debug-cycles:debug,debug-propagation:debug,debug-trace-events:debug,-fast-weak,use-template-haskell:template-haskell

CABAL_FEATURES="lib profile haddock hoogle hscolour test-suite"
inherit haskell-cabal

DESCRIPTION="Higher-order Functional Reactive Programming"
HOMEPAGE="https://reflex-frp.org"

LICENSE="BSD"
SLOT="0/${PV}"
KEYWORDS="~amd64"
IUSE="debug plugin +template-haskell"

# The <hlint-3.5 restriction on ghc-9.0 shouldn't be necessary with ghc-lib
CABAL_CHDEPS=(
	'hlint (< 2.1 || >= 2.2.2) && < 3.5' 'hlint >= 2.2.2'
	'hlint >= 3.5 && < 3.6' 'hlint >= 3.5'
	'constraints >= 0.10 && <0.14' 'constraints >= 0.10'
	'primitive >= 0.5 && < 0.8' 'primitive >= 0.5'
	'lens >= 4.7 && < 5.3' 'lens >= 4.7'
)

RDEPEND="
	>=dev-haskell/bifunctors-5.2:=[profile?] <dev-haskell/bifunctors-5.7:=[profile?]
	>=dev-haskell/commutative-semigroups-0.1:=[profile?] <dev-haskell/commutative-semigroups-0.2:=[profile?]
	>=dev-haskell/comonad-5.0.4:=[profile?] <dev-haskell/comonad-5.1:=[profile?]
	>=dev-haskell/constraints-0.10:=[profile?]
	>=dev-haskell/constraints-extras-0.3:=[profile?] <dev-haskell/constraints-extras-0.5:=[profile?]
	>=dev-haskell/data-default-0.5:=[profile?] <dev-haskell/data-default-0.8:=[profile?]
	>=dev-haskell/dependent-map-0.3:=[profile?] <dev-haskell/dependent-map-0.5:=[profile?]
	>=dev-haskell/dependent-sum-0.6:=[profile?] <dev-haskell/dependent-sum-0.8:=[profile?]
	>=dev-haskell/exception-transformers-0.4:=[profile?] <dev-haskell/exception-transformers-0.5:=[profile?]
	>=dev-haskell/lens-4.7:=[profile?]
	>=dev-haskell/memotrie-0.6:=[profile?] <dev-haskell/memotrie-0.7:=[profile?]
	>=dev-haskell/mmorph-1.0:=[profile?] <dev-haskell/mmorph-1.3:=[profile?]
	>=dev-haskell/monad-control-1.0.1:=[profile?] <dev-haskell/monad-control-1.1:=[profile?]
	>=dev-haskell/monoidal-containers-0.6.2.0:=[profile?] <dev-haskell/monoidal-containers-0.7:=[profile?]
	>=dev-haskell/patch-0.0.7:=[profile?] <dev-haskell/patch-0.1:=[profile?]
	>=dev-haskell/prim-uniq-0.1.0.1:=[profile?] <dev-haskell/prim-uniq-0.3:=[profile?]
	>=dev-haskell/primitive-0.5:=[profile?]
	>=dev-haskell/profunctors-5.3:=[profile?] <dev-haskell/profunctors-5.7:=[profile?]
	>=dev-haskell/random-1.1:=[profile?] <dev-haskell/random-1.3:=[profile?]
	>=dev-haskell/ref-tf-0.4:=[profile?] <dev-haskell/ref-tf-0.6:=[profile?]
	>=dev-haskell/reflection-2.1:=[profile?] <dev-haskell/reflection-2.2:=[profile?]
	>=dev-haskell/semialign-1:=[profile?] <dev-haskell/semialign-1.4:=[profile?]
	>=dev-haskell/semigroupoids-4.0:=[profile?] <dev-haskell/semigroupoids-7:=[profile?]
	>=dev-haskell/syb-0.5:=[profile?] <dev-haskell/syb-0.8:=[profile?]
	>=dev-haskell/these-1:=[profile?] <dev-haskell/these-1.3:=[profile?]
	>=dev-haskell/unbounded-delays-0.1.0.0:=[profile?] <dev-haskell/unbounded-delays-0.2:=[profile?]
	>=dev-haskell/witherable-0.4:=[profile?] <dev-haskell/witherable-0.5:=[profile?]
	>=dev-lang/ghc-9.0.2:=
	template-haskell? (
		>=dev-haskell/haskell-src-exts-1.16:=[profile?] <dev-haskell/haskell-src-exts-1.24:=[profile?]
		>=dev-haskell/haskell-src-meta-0.6:=[profile?] <dev-haskell/haskell-src-meta-0.9:=[profile?]
	)
"
DEPEND="${RDEPEND}
	>=dev-haskell/cabal-3.4.1.0
	test? (
		dev-haskell/filemanip
		>=dev-haskell/hlint-3.5[ghc-lib]
		dev-haskell/hspec
		dev-haskell/proctest
		dev-haskell/split
		dev-haskell/text
		dev-haskell/these-lens
	)
"

src_configure() {
	haskell-cabal_src_configure \
		$(cabal_flag debug debug-cycles) \
		$(cabal_flag debug debug-propagation) \
		$(cabal_flag debug debug-trace-events) \
		--flag=-fast-weak \
		--flag=split-these \
		$(cabal_flag plugin use-reflex-optimizer) \
		$(cabal_flag template-haskell use-template-haskell)
}