packages feed

cl3-posit-1.0.0.0: cl3-posit.cabal

-- Initial cl3-posit.cabal generated by copying my old library and changing stuff.  For further documentation, read this file.
-- and also see https://docs.haskellstack.org/en/stable/GUIDE/

-- The name of the package.
name:                cl3-posit

-- The package version.  See the Haskell package versioning policy (PVP) 
-- for standards guiding when and how versions should be incremented.
-- https://wiki.haskell.org/Package_versioning_policy
-- PVP summary:      +-+------- breaking API changes
--                   | | +----- non-breaking API additions
--                   | | | +--- code changes with no API change
version:             1.0.0.0

category:       Math, Numeric, Algebra
-- Geometric Algebra, Algebra of Physical Space

-- A short (one-line) description of the package.
synopsis:            Clifford Algebra of three dimensional space, implemented with Posit numbers.

-- A longer description of the package.
description:         Haskell Library implementing standard functions for the Algebra of Physical Space Cl(3,0), R approximated by Posit Numbers.

-- URL for the project homepage or repository.
homepage:            https://github.com/waivio/cl3-posit

bug-reports:         https://github.com/waivio/cl3-posit/issues

-- The license under which the package is released.
license:             BSD3

-- The file containing the license text.
license-file:        LICENSE

-- The package author(s).
author:              Nathan Waivio

-- An email address to which users can send suggestions, bug reports, and 
-- patches.
maintainer:          Nathan Waivio <nathan.waivio@gmail.com>

-- A copyright notice.
copyright:           Copyright (C) 2017-2024 Nathan Waivio


build-type:          Simple

tested-with:         GHC == 8.10.7,
                     GHC == 9.0.2,
                     GHC == 9.2.8,
                     GHC == 9.4.8,
                     GHC == 9.6.6,
                     GHC == 9.8.4

-- Extra files to be distributed with the package, such as examples or a 
-- README.
extra-source-files:  ChangeLog.md,
                     README.md,
                     stack.yaml

-- Constraint on the version of Cabal needed to build this package.
cabal-version:       >=1.10

source-repository head
  type:     git
  location: https://github.com/waivio/cl3-posit.git

flag do-no-derived-instances
  description: Disable derived instances to reduce noise when inspecting GHC Core
  manual:      True
  default:     True

-- Turned random off, probably should be implmented in data-dword, like Storable
flag do-no-random
  description: Build without random library support
  manual:      True
  default:     False

flag do-no-storable
  description: Build without Storable Class support
  manual:      True
  default:     False

flag do-liquid
  description: Build with Liquid Haskell checking
  manual:      True
  default:     False

library
  -- Modules exported by the library.
  exposed-modules:
    Posit.Cl3,
    Posit.Cl3.JonesCalculus

  build-depends:
    posit >= 2022.0.1,
    cl3

  -- Compiler options
  ghc-options: -Wall -O2
  
  if flag(do-liquid)
    ghc-options: -fplugin=LiquidHaskell -fplugin-opt=LiquidHaskell:--fast -fplugin-opt=LiquidHaskell:--max-case-expand=0 -fplugin-opt=LiquidHaskell:--no-termination -fplugin-opt=LiquidHaskell:--short-names
  
  if flag(do-no-derived-instances)
    cpp-options: -DO_NO_DERIVED
  
  if flag(do-no-random)
    cpp-options: -DO_NO_RANDOM
  
  if flag(do-no-storable)
    cpp-options: -DO_NO_STORABLE
  
  if flag(do-liquid)
    cpp-options: -DO_LIQUID -DO_NO_RANDOM -DO_NO_DERIVED -DO_NO_STORABLE
  
  -- LANGUAGE extensions used by modules in this package.
  other-extensions:
    GADTs,
    ViewPatterns,
    CPP,
    BangPatterns,
    MultiWayIf,
    TypeApplications,
    ScopedTypeVariables,
    FlexibleContexts,
    ConstraintKinds,
    UndecidableInstances,
    BlockArguments,
    DataKinds,
    MultiParamTypeClasses
  
  -- Other library packages from which modules are imported.
  build-depends:
    deepseq >=1.1 && <2
  
  if !flag(do-no-random)
    build-depends:
      random >=1.0 && <2
  
  if !flag(do-liquid)
    build-depends:
      base >=4.7 && <5
  
  if flag(do-liquid)
    build-depends:
      liquid-base,
      liquidhaskell
  
  -- Directories containing source files.
  hs-source-dirs:      src
  
  -- Base language which the package is written in.
  default-language:    Haskell2010

-- Test Cl3 Posit, all types concurently. For instance if we have 12 concurent processes on 12 cores.
test-suite test-cl3
  type: exitcode-stdio-1.0
  hs-source-dirs: tests
  main-is: TestCl3Posit.hs
  ghc-options: -Wall -O2 -threaded -rtsopts "-with-rtsopts=-N12"
  build-depends: 
    cl3-posit,
    posit,
    base >=4.7 && <5,
    random >=1.0 && <2,
    time >=1.0 && <2
  default-language: Haskell2010

-- Criterion based benchmark -threaded -rtsopts "-with-rtsopts=-N"
-- benchmark bench-cl3-posit-nbody
--   type: exitcode-stdio-1.0
--   hs-source-dirs: benchmarks
--   main-is: NbodyGameCl3Posit.hs
--   ghc-options: -Wall -O2
--   build-depends:
--     cl3-posit,
--     base >=4.7 && <5,
--     criterion >=1.1 && <2
--   default-language: Haskell2010

-- Weigh based benchmark for Vector and Massiv
-- benchmark bench-cl3-posit-weigh
--   type: exitcode-stdio-1.0
--   hs-source-dirs: benchmarks
--   main-is: WeighStorableCl3Posit.hs
--   ghc-options: -Wall -O2
--   build-depends:
--     cl3-posit,
--     base >=4.7 && <5,
--     vector,
--     massiv >= 1.0,
--     weigh
--   default-language: Haskell2010

-- Cl3/Massiv N-body benchmark -threaded -rtsopts "-with-rtsopts=-N"
-- benchmark bench-cl3-posit-massiv-nbody
--   type: exitcode-stdio-1.0
--   hs-source-dirs: benchmarks
--   main-is: NbodyMassivCl3Posit.hs
--   ghc-options: -Wall -O2
--   build-depends:
--     cl3-posit,
--     base >=4.7 && <5,
--     time,
--     massiv >= 1.0
--   default-language: Haskell2010