sample-frame-np (empty) → 0.0.1
raw patch · 4 files changed
+134/−0 lines, 4 filesdep +basedep +numeric-preludedep +sample-framesetup-changed
Dependencies added: base, numeric-prelude, sample-frame, special-functors
Files
- LICENSE +31/−0
- Setup.lhs +3/−0
- sample-frame-np.cabal +40/−0
- src/Sound/Frame/NumericPrelude/Stereo.hs +60/−0
+ LICENSE view
@@ -0,0 +1,31 @@+Copyright (c) 2009, Henning Thielemann++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.++ * The names of contributors may not 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.
+ Setup.lhs view
@@ -0,0 +1,3 @@+#! /usr/bin/env runhaskell+> import Distribution.Simple+> main = defaultMain
+ sample-frame-np.cabal view
@@ -0,0 +1,40 @@+Name: sample-frame-np+Version: 0.0.1+License: BSD3+License-File: LICENSE+Author: Henning Thielemann <haskell@henning-thielemann.de>+Maintainer: Henning Thielemann <haskell@henning-thielemann.de>+Homepage: http://www.haskell.org/haskellwiki/Synthesizer+Package-URL: http://code.haskell.org/~thielema/sample-frame/core/+Category: Sound+Synopsis: Orphan instances for types from sample-frame and numericprelude+Description:+ Orphan instances for types from sample-frame package+ and type classes from numeric-prelude.+ .+ This is used by packages synthesizer.+Tested-With: GHC==6.10.4+Cabal-Version: >=1.2+Build-Type: Simple++Flag splitBase+ description: Choose the new smaller, split-up base package.++Library+ Build-Depends:+ sample-frame >=0.0.1 && <0.1,+ numeric-prelude >= 0.1.2 && <0.2+ If flag(splitBase)+ Build-Depends:+ base >= 2 && <5+ Else+ Build-Depends:+ special-functors >= 1.0 && <1.1,+ base >= 1.0 && < 2++ Hs-Source-Dirs: src++ GHC-Options: -Wall++ Exposed-Modules:+ Sound.Frame.NumericPrelude.Stereo
+ src/Sound/Frame/NumericPrelude/Stereo.hs view
@@ -0,0 +1,60 @@+{-# LANGUAGE MultiParamTypeClasses #-}+{-# LANGUAGE FlexibleInstances #-}+{-# OPTIONS_GHC -fno-warn-orphans #-}+module Sound.Frame.NumericPrelude.Stereo (T, left, right, cons, map, ) where++import qualified Sound.Frame.Stereo as Stereo+import Sound.Frame.Stereo (T, left, right, cons, map, )++import qualified Algebra.NormedSpace.Maximum as NormedMax+import qualified Algebra.NormedSpace.Euclidean as NormedEuc+import qualified Algebra.NormedSpace.Sum as NormedSum++import qualified Algebra.Module as Module+import qualified Algebra.Algebraic as Algebraic+import qualified Algebra.Additive as Additive++import Algebra.Module ((<*>.*>), )+import Algebra.Additive ((<*>.+), (<*>.-), (<*>.-$), )++import qualified NumericPrelude.Elementwise as Elem+import Control.Applicative (Applicative(pure), )++import NumericPrelude+import PreludeBase hiding (map)+import Prelude ()+++instance (Additive.C a) => Additive.C (T a) where+ {-# INLINE zero #-}+ {-# INLINE negate #-}+ {-# INLINE (+) #-}+ {-# INLINE (-) #-}+ zero = cons zero zero+ (+) = Elem.run2 $ pure cons <*>.+ left <*>.+ right+ (-) = Elem.run2 $ pure cons <*>.- left <*>.- right+ negate = Elem.run $ pure cons <*>.-$ left <*>.-$ right++instance (Module.C a v) => Module.C a (T v) where+ {-# INLINE (*>) #-}+ (*>) = Elem.run2 $ pure cons <*>.*> left <*>.*> right+++instance (Additive.C a, NormedSum.C a v) => NormedSum.C a (T v) where+ {-# INLINE norm #-}+ norm x =+ NormedSum.norm (left x) + NormedSum.norm (right x)++instance (NormedEuc.Sqr a v) => NormedEuc.Sqr a (T v) where+ {-# INLINE normSqr #-}+ normSqr x =+ NormedEuc.normSqr (left x) + NormedEuc.normSqr (right x)++instance (Algebraic.C a, NormedEuc.Sqr a v) => NormedEuc.C a (T v) where+ {-# INLINE norm #-}+ norm = NormedEuc.defltNorm++instance (Ord a, NormedMax.C a v) => NormedMax.C a (T v) where+ {-# INLINE norm #-}+ norm x =+ max (NormedMax.norm (left x)) (NormedMax.norm (right x))