ad 1.0.3 → 1.0.4
raw patch · 2 files changed
+19/−9 lines, 2 filesdep ~comonaddep ~streams
Dependency ranges changed: comonad, streams
Files
- Numeric/AD/Internal/Tensors.hs +16/−2
- ad.cabal +3/−7
Numeric/AD/Internal/Tensors.hs view
@@ -1,4 +1,4 @@-{-# LANGUAGE TypeOperators, TemplateHaskell, ScopedTypeVariables #-}+{-# LANGUAGE TypeOperators, TemplateHaskell, ScopedTypeVariables, FlexibleContexts #-} {-# OPTIONS_HADDOCK hide #-} ----------------------------------------------------------------------------- -- |@@ -27,10 +27,24 @@ infixl 3 :- +-- private, unexported type, so any instances for it will be polymorphic++newtype Showable = Showable (Int -> String -> String)++instance Show Showable where+ showsPrec d (Showable f) = f d++showable :: Show a => a -> Showable+showable a = Showable (\d -> showsPrec d a)+ -- Polymorphic recursion precludes 'Data' in its current form, as no Data1 class exists -- Polymorphic recursion also breaks 'show' for 'Tensors'!--- factor Show1 out of Lifted?+ data Tensors f a = a :- Tensors f (f a)++instance (Functor f, Show (f Showable), Show a) => Show (Tensors f a) where+ showsPrec d (a :- as) = showParen (d > 3) $ + showsPrec 4 a . showString " :- " . showsPrec 3 (fmap showable <$> as) instance Functor f => Functor (Tensors f) where fmap f (a :- as) = f a :- fmap (fmap f) as
ad.cabal view
@@ -1,5 +1,5 @@ name: ad-version: 1.0.3+version: 1.0.4 license: BSD3 license-File: LICENSE copyright: (c) Edward Kmett 2010-2011,@@ -93,15 +93,11 @@ type: git location: git://github.com/ekmett/ad.git --- flag TemplateHaskell24 manual: False default: False library - if flag(TemplateHaskell24) build-depends: template-haskell >= 2.4 && < 2.5 extensions: CPP@@ -114,8 +110,8 @@ data-reify >= 0.6 && < 0.7, containers >= 0.2 && < 0.5, array >= 0.2 && < 0.4,- comonad >= 1.0 && < 1.1,- streams >= 0.6 && < 0.7+ comonad >= 1.0.3 && < 1.1,+ streams >= 0.6.2 && < 0.7 exposed-modules: Numeric.AD