Naperian 0.1.0.1 → 0.1.1.0
raw patch · 2 files changed
+10/−52 lines, 2 filesdep ~basePVP: major bump suggested
API removals or changes: PVP suggests a major version bump
Dependency ranges changed: base
API changes (from Hackage documentation)
+ Naperian: -- (<a>Vector</a> n)</tt> is the range of integers <tt>[0..n-1]</tt>
+ Naperian: -- (represented here as <tt><a>Finite</a> n</tt>.)
+ Naperian: -- <tt><a>Log</a> [a] = Int</tt>. If you have a type-bounded Vector
+ Naperian: -- <tt><a>Vector</a> (n :: <a>Nat</a>) a</tt>, then <tt><a>Log</a>
+ Naperian: -- have a list <tt>[a]</tt>, and you want to look up a value, then you
+ Naperian: -- use an <tt><a>Int</a></tt> to index into the list. In this case,
+ Naperian: -- you use to look up values inside <tt>f a</tt>. For example, if you
+ Naperian: -- | The "logarithm" of <tt>f</tt>. This type represents the <tt>input</tt>
+ Naperian: hlookup :: Hyper (f : fs) a -> Log f -> Hyper fs a
+ Naperian: transposeH' :: Hyper (f : (g : (h : fs))) a -> Hyper (f : (h : (g : fs))) a
- Naperian: Vector :: (Vector a) -> Vector a
+ Naperian: Vector :: Vector a -> Vector a
- Naperian: lookup :: Naperian f => f a -> (Log f -> a)
+ Naperian: lookup :: Naperian f => f a -> Log f -> a
- Naperian: type family Log f;
+ Naperian: type family Compatible (fs :: [Type -> Type]) (gs :: [Type -> Type]) :: Constraint
- Naperian: unary :: Shapely fs => (a -> b) -> (Hyper fs a -> Hyper fs b)
+ Naperian: unary :: Shapely fs => (a -> b) -> Hyper fs a -> Hyper fs b
Files
- Naperian.cabal +3/−52
- src/Naperian.hs +7/−0
Naperian.cabal view
@@ -1,62 +1,19 @@--- Initial Naperian.cabal generated by cabal init. For further --- documentation, see http://haskell.org/cabal/users-guide/---- The name of the package. name: Naperian---- 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: 0.1.0.1+version: 0.1.1.0 --- A short (one-line) description of the package. synopsis: Naperian Functors for APL-like programming---- A longer description of the package.--- description: ---- URL for the project homepage or repository. homepage: https://github.com/idontgetoutmuch/Naperian---- The license under which the package is released. license: OtherLicense---- The file containing the license text. license-file: LICENSE.txt---- The package author(s). author: Austin Seipp---- An email address to which users can send suggestions, bug reports, and --- patches. maintainer: dominic@steinitz.org---- A copyright notice.--- copyright: - category: Math- build-type: Simple---- Extra files to be distributed with the package, such as examples or a --- README. extra-source-files: ChangeLog.md---- Constraint on the version of Cabal needed to build this package. cabal-version: >=1.10 - library- -- Modules exported by the library. exposed-modules: Naperian- - -- Modules included in this library but not exported.- -- other-modules: - - -- LANGUAGE extensions used by modules in this package. other-extensions: ConstraintKinds , DataKinds , DeriveGeneric@@ -76,16 +33,10 @@ , TypeFamilies , TypeOperators , UndecidableInstances- - -- Other library packages from which modules are imported.- build-depends: base >= 4.10 && < 4.11+ build-depends: base >=4.12 && <4.13 , containers , ghc-prim , vector- - -- Directories containing source files. hs-source-dirs: src- - -- Base language which the package is written in. default-language: Haskell2010- +
src/Naperian.hs view
@@ -258,6 +258,9 @@ pure = hreplicate (<*>) = hzipWith ($) +hlookup :: Hyper (f : fs) a -> Log f -> Hyper fs a+hlookup (Prism x) i = fmap (flip lookup i) x+ hzipWith :: (a -> b -> c) -> Hyper fs a -> Hyper fs b -> Hyper fs c hzipWith f (Scalar a) (Scalar b) = Scalar (f a b) hzipWith f (Prism x) (Prism y) = Prism (hzipWith (azipWith f) x y)@@ -270,6 +273,10 @@ transposeH :: Hyper (f : (g : fs)) a -> Hyper (g : (f : fs)) a transposeH (Prism (Prism x)) = Prism (Prism (fmap transpose x))++transposeH' :: Hyper (f : (g : (h : fs))) a+ -> Hyper (f : (h : (g : fs))) a+transposeH' (Prism (Prism (Prism x))) = Prism (Prism (Prism (fmap transpose x))) -- | Fold over a single dimension of a Hypercuboid. foldrH :: (a -> a -> a) -> a -> Hyper (f : fs) a -> Hyper fs a