-- Copyright (c) 2016 - Ivan Perez and Manuel Bärenz - All rights reserved
--
-- Redistribution and use in source and binary forms, with or without
-- modification, are permitted provided that the following conditions are met:
--
--     * Redistributions of source code must retain the above copyright
--       notice, this list of conditions and the following disclaimer.
--
--     * Redistributions in binary form must reproduce the above
--       copyright notice, this list of conditions and the following
--       disclaimer in the documentation and/or other materials provided
--       with the distribution.
--
--     * Neither the name of Ivan Perez and Manuel Bärenz nor the names of
--       other contributors may be used to endorse or promote products derived
--       from this software without specific prior written permission.
--
-- THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
-- "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
-- LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
-- A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
-- OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
-- SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
-- LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
-- DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
-- THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
-- (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
-- OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
cabal-version: >= 1.10
build-type:    Simple

name:          dunai
version:       0.14.0
author:        Ivan Perez, Manuel Bärenz
maintainer:    ivan.perez@keera.co.uk
homepage:      https://github.com/ivanperez-keera/dunai
license:       BSD3
license-file:  LICENSE
copyright:     Copyright (c) 2016 - Ivan Perez and Manuel Bärenz
category:      Reactivity, FRP
synopsis:
  Generalised reactive framework supporting classic, arrowized and monadic FRP.
description:
  Dunai is a DSL for strongly-typed CPS-based composable transformations.
  .
  Dunai is based on a concept of Monadic Stream Functions (MSFs). MSFs are
  transformations defined by a function
  @unMSF :: MSF m a b -> a -> m (b, MSF m a b)@ that executes one step of a
  simulation, and produces an output in a monadic context, and a continuation
  to be used for future steps.
  .
  MSFs are a generalisation of the implementation mechanism used by Yampa,
  Wormholes and other FRP and reactive implementations.
  .
  When combined with different monads, they produce interesting effects. For
  example, when combined with the @Maybe@ monad, they become transformations
  that may stop producing outputs (and continuations). The @Either@ monad gives
  rise to MSFs that end with a result (akin to Tasks in Yampa, and Monadic
  FRP).
  .
  Flattening, that is, going from some structure @MSF (t m) a b@ to @MSF m a b@
  for a specific transformer @t@ often gives rise to known FRP constructs. For
  instance, flattening with @EitherT@ gives rise to switching, and flattening
  with @ListT@ gives rise to parallelism with broadcasting.
  .
  MSFs can be used to implement many FRP variants, including Arrowized FRP,
  Classic FRP, and plain reactive programming. Arrowized and applicative syntax
  are both supported.
  .
  For a very detailed introduction to MSFs, see:
  <http://dl.acm.org/citation.cfm?id=2976010>
  (mirror: <http://ivanperez.io/#FRPRefactored>).


x-curation: uncurated


extra-source-files:
  CHANGELOG


source-repository head
  type:     git
  location: git@github.com:ivanperez-keera/dunai.git
  subdir:   dunai


-- You can disable the hlint test suite with -f-test-hlint
flag test-hlint
  description: Enable hlint test suite
  default:     False
  manual:      True

-- You can disable the haddock coverage test suite with -f-test-doc-coverage
flag test-doc-coverage
  description: Enable haddock coverage test suite
  default:     False
  manual:      True


library
  exposed-modules:
    Control.Monad.Trans.MSF
    Control.Monad.Trans.MSF.Except
    Control.Monad.Trans.MSF.List
    Control.Monad.Trans.MSF.Maybe
    Control.Monad.Trans.MSF.Random
    Control.Monad.Trans.MSF.Reader
    Control.Monad.Trans.MSF.RWS
    Control.Monad.Trans.MSF.State
    Control.Monad.Trans.MSF.Writer
    Data.MonadicStreamFunction
    Data.MonadicStreamFunction.Async
    Data.MonadicStreamFunction.Core
    Data.MonadicStreamFunction.Instances.ArrowChoice
    Data.MonadicStreamFunction.Instances.ArrowLoop
    Data.MonadicStreamFunction.Instances.ArrowPlus
    Data.MonadicStreamFunction.Instances.Num
    Data.MonadicStreamFunction.Instances.VectorSpace
    Data.MonadicStreamFunction.InternalCore
    Data.MonadicStreamFunction.Parallel
    Data.MonadicStreamFunction.ReactHandle
    Data.MonadicStreamFunction.Util

  other-modules:
    Control.Arrow.Util

  build-depends:
      base >= 4.6 && < 5
    , MonadRandom         >= 0.2   && < 0.7
    , list-transformer    >= 1.1.1 && < 1.2
    , simple-affine-space >= 0.2   && < 0.3
    , transformers        >= 0.3   && < 0.7
    , transformers-base   >= 0.4   && < 0.5

  default-language:
    Haskell2010

  hs-source-dirs:
    src

  ghc-options:
    -Wall -fno-warn-unused-do-bind

  if impl(ghc <= 7.8.4)
    build-depends:
        MonadRandom         >= 0.2 && < 0.6
      , transformers-compat >= 0.3 && < 0.8
      , void                >= 0.1 && < 0.8

test-suite hlint
  type:
    exitcode-stdio-1.0

  main-is:
    HLintMain.hs

  default-language:
    Haskell2010

  hs-source-dirs:
    tests

  if !flag(test-hlint)
    buildable:
      False
  else
    build-depends:
        base  >= 4   && < 5
      , hlint >= 1.7 && < 3.8

-- Verify that the code is thoroughly documented
test-suite haddock-coverage
  type:
    exitcode-stdio-1.0

  main-is:
    HaddockCoverage.hs

  default-language:
    Haskell2010

  hs-source-dirs:
    tests

  ghc-options:
    -Wall

  if !flag(test-doc-coverage)
    buildable:
      False
  else
    build-depends:
        base           >= 4       && < 5
      , directory      >= 1.2     && < 1.4
      , filepath       >= 1.3.0.1 && < 1.6
      , process        >= 1.1.0.2 && < 1.7
      , regex-posix    >= 0.95    && < 0.97


test-suite regression-tests
  type:
    exitcode-stdio-1.0

  main-is:
    RegressionTests.hs

  default-language:
    Haskell2010

  hs-source-dirs:
    tests

  ghc-options:
    -Wall

  build-depends:
      base         >= 4   && < 5
    , transformers >= 0.3 && < 0.7
    , tasty        >= 0.1 && < 1.6
    , tasty-hunit  >= 0.8 && < 0.11

    , dunai


benchmark dunai-bench
  type:
    exitcode-stdio-1.0

  main-is:
    Bench.hs

  build-depends:
       base      >= 4       && < 5
     , criterion >= 0.5.0.0 && < 1.7
     , filepath  >= 1.3.0.1 && < 1.6
     , time      >= 1.4     && < 1.16
     , dunai

  default-language:
    Haskell2010

  hs-source-dirs:
    benchmarks