on 2eb21d5 help sign in
93 files changed+5957−2350
since splitsnapshots
unifiedsplit
.ghc.environment.x86_64-linux-8.6.5+17 .github/workflows/ci.yml−43 .gitignore+2−54 .travis.yml−47 CHANGELOG.md−17 ChangeLog.md+3 LICENSE+26−17 README.md+24−107 Setup.hs+2 test/Examples/Readme.hs → app/Main.hs+33−61 appveyor.yml−34 benchmark/Main.hs−175 build/x86_64-linux/ghc-8.6.5/laop-0.1.0.0/build/autogen/Paths_laop.hs+50 build/x86_64-linux/ghc-8.6.5/laop-0.1.0.0/build/autogen/cabal_macros.h+143 build/x86_64-linux/ghc-8.6.5/laop-0.1.0.0/cache/config build/x86_64-linux/ghc-8.6.5/laop-0.1.0.0/doc/html/laop-0.1.0.0-docs/Dist.html+15 build/x86_64-linux/ghc-8.6.5/laop-0.1.0.0/doc/html/laop-0.1.0.0-docs/Matrix-Nat.html+22 build/x86_64-linux/ghc-8.6.5/laop-0.1.0.0/doc/html/laop-0.1.0.0-docs/Matrix-Type.html+36 build/x86_64-linux/ghc-8.6.5/laop-0.1.0.0/doc/html/laop-0.1.0.0-docs/Utils.html+52 build/x86_64-linux/ghc-8.6.5/laop-0.1.0.0/doc/html/laop-0.1.0.0-docs/doc-index.html+1 build/x86_64-linux/ghc-8.6.5/laop-0.1.0.0/doc/html/laop-0.1.0.0-docs/doc-index.json+1 build/x86_64-linux/ghc-8.6.5/laop-0.1.0.0/doc/html/laop-0.1.0.0-docs/haddock-bundle.min.js+2 build/x86_64-linux/ghc-8.6.5/laop-0.1.0.0/doc/html/laop-0.1.0.0-docs/hslogo-16.png build/x86_64-linux/ghc-8.6.5/laop-0.1.0.0/doc/html/laop-0.1.0.0-docs/laop.haddock build/x86_64-linux/ghc-8.6.5/laop-0.1.0.0/doc/html/laop-0.1.0.0-docs/laop.txt+429 build/x86_64-linux/ghc-8.6.5/laop-0.1.0.0/doc/html/laop-0.1.0.0-docs/meta.json+1 build/x86_64-linux/ghc-8.6.5/laop-0.1.0.0/doc/html/laop-0.1.0.0-docs/minus.gif build/x86_64-linux/ghc-8.6.5/laop-0.1.0.0/doc/html/laop-0.1.0.0-docs/ocean.css+647 build/x86_64-linux/ghc-8.6.5/laop-0.1.0.0/doc/html/laop-0.1.0.0-docs/plus.gif build/x86_64-linux/ghc-8.6.5/laop-0.1.0.0/doc/html/laop-0.1.0.0-docs/quick-jump.css+164 build/x86_64-linux/ghc-8.6.5/laop-0.1.0.0/doc/html/laop-0.1.0.0-docs/quick-jump.min.js+2 build/x86_64-linux/ghc-8.6.5/laop-0.1.0.0/doc/html/laop-0.1.0.0-docs/src/Dist.Internal.html+174 build/x86_64-linux/ghc-8.6.5/laop-0.1.0.0/doc/html/laop-0.1.0.0-docs/src/Dist.html+70 build/x86_64-linux/ghc-8.6.5/laop-0.1.0.0/doc/html/laop-0.1.0.0-docs/src/Matrix.Internal.html+903 build/x86_64-linux/ghc-8.6.5/laop-0.1.0.0/doc/html/laop-0.1.0.0-docs/src/Matrix.Nat.html+484 build/x86_64-linux/ghc-8.6.5/laop-0.1.0.0/doc/html/laop-0.1.0.0-docs/src/Matrix.Type.html+648 build/x86_64-linux/ghc-8.6.5/laop-0.1.0.0/doc/html/laop-0.1.0.0-docs/src/Paths_laop.html+51 build/x86_64-linux/ghc-8.6.5/laop-0.1.0.0/doc/html/laop-0.1.0.0-docs/src/Utils.Internal.html+177 build/x86_64-linux/ghc-8.6.5/laop-0.1.0.0/doc/html/laop-0.1.0.0-docs/src/Utils.html+101 build/x86_64-linux/ghc-8.6.5/laop-0.1.0.0/doc/html/laop-0.1.0.0-docs/src/highlight.js+27 build/x86_64-linux/ghc-8.6.5/laop-0.1.0.0/doc/html/laop-0.1.0.0-docs/src/style.css+55 build/x86_64-linux/ghc-8.6.5/laop-0.1.0.0/doc/html/laop-0.1.0.0-docs/synopsis.png build/x86_64-linux/ghc-8.6.5/laop-0.1.0.0/package.conf.inplace/package.cache build/x86_64-linux/ghc-8.6.5/laop-0.1.0.0/package.conf.inplace/package.cache.lock build/x86_64-linux/ghc-8.6.5/laop-0.1.0.0/setup-config cache/compiler cache/config cache/elaborated-plan cache/improved-plan cache/plan.json+1 cache/solver-plan cache/source-hashes cache/up-to-date dist-newstyle/build/x86_64-linux/ghc-8.6.5/fake-package-0/x/script/build/script/autogen/Paths_fake_package.hs+50 dist-newstyle/build/x86_64-linux/ghc-8.6.5/fake-package-0/x/script/build/script/autogen/cabal_macros.h+118 dist-newstyle/build/x86_64-linux/ghc-8.6.5/fake-package-0/x/script/cache/config dist-newstyle/build/x86_64-linux/ghc-8.6.5/fake-package-0/x/script/package.conf.inplace/package.cache dist-newstyle/build/x86_64-linux/ghc-8.6.5/fake-package-0/x/script/package.conf.inplace/package.cache.lock dist-newstyle/build/x86_64-linux/ghc-8.6.5/fake-package-0/x/script/setup-config dist-newstyle/cache/compiler dist-newstyle/cache/config dist-newstyle/cache/elaborated-plan dist-newstyle/cache/improved-plan dist-newstyle/cache/plan.json+1 dist-newstyle/cache/solver-plan dist-newstyle/cache/source-hashes dist-newstyle/cache/up-to-date dist-newstyle/packagedb/ghc-8.6.5/package.cache dist-newstyle/packagedb/ghc-8.6.5/package.cache.lock dist/cabal-config-flags dist/laop-0.1.0.0.tar.gz dist/setup-config hackage.sh+10 laop-0.1.0.0-docs.tar.gz laop.cabal−89 package.yaml+48 packagedb/ghc-8.6.5/package.cache packagedb/ghc-8.6.5/package.cache.lock src/LAoP/Dist.hs−10 src/LAoP/Dist/Internal.hs+36−87 src/LAoP/Matrix/Internal.hs+436−445 src/LAoP/Matrix/Nat.hs+187−194 src/LAoP/Matrix/Type.hs+240−283 src/LAoP/Relation.hs+7−34 src/LAoP/Relation/Internal.hs+317−486 src/LAoP/Utils.hs−6 src/LAoP/Utils/Internal.hs+73−70 stack-8.8.3.yaml−1 stack.yaml+66−1 stack.yaml.lock+4−4 test/Examples/Quantum.hs−31 test/Examples/Spreadsheets.hs−47 test/Spec.hs+1−7
.ghc.environment.x86_64-linux-8.6.5new file+17
@@ -0,0 +1,17 @@
1+-- This is a GHC environment file written by cabal. This means you can
2+-- run ghc or ghci and get the environment of the project as a whole.
3+-- But you still need to use cabal repl $target to get the environment
4+-- of specific components (libs, exes, tests etc) because each one can
5+-- have its own source dirs, cpp flags etc.
6+--
7+clear-package-db
8+global-package-db
9+package-db /home/bolt/.cabal/store/ghc-8.6.5/package.db
10+package-db packagedb/ghc-8.6.5
11+package-id laop-0.1.0.0-inplace
12+package-id base-4.12.0.0
13+package-id ghc-prim-0.5.3
14+package-id rts
15+package-id integer-gmp-1.0.2.0
16+package-id deepseq-1.4.4.0
17+package-id array-0.5.3.0
.github/workflows/ci.ymldeleted−43
@@ -1,43 +0,0 @@
1−name: CI
2−
3−# Trigger the workflow on push or pull request, but only for the master branch
4−on:
5− pull_request:
6− push:
7− branches: [master]
8−
9−jobs:
10− build:
11− name: ghc ${{ matrix.ghc }}
12− runs-on: ubuntu-16.04
13− strategy:
14− matrix:
15− cabal: ["3.0"]
16− ghc:
17− - "8.6.5"
18− - "8.8.3"
19−
20− steps:
21− - uses: actions/checkout@v2
22− if: github.event.action == 'opened' || github.event.action == 'synchronize' || github.event.ref == 'refs/heads/master'
23−
24− - uses: actions/setup-haskell@v1
25− name: Setup Haskell
26− with:
27− ghc-version: ${{ matrix.ghc }}
28− cabal-version: ${{ matrix.cabal }}
29−
30− - uses: actions/cache@v1
31− name: Cache ~/.cabal/store
32− with:
33− path: ~/.cabal/store
34− key: ${{ runner.os }}-${{ matrix.ghc }}-cabal
35−
36− - name: Build
37− run: |
38− cabal v2-update
39− cabal v2-build --enable-tests --enable-benchmarks
40−
41− - name: Test
42− run: |
43− cabal v2-test --enable-tests
.gitignore+2−54
@@ -1,55 +1,3 @@
1−### Haskell
2−dist
3−dist-*
4−cabal-dev
5−*.o
6−*.hi
7−*.chi
8−*.chs.h
9−*.dyn_o
10−*.dyn_hi
11−*.prof
12−*.aux
13−*.hp
14−*.eventlog
15−.virtualenv
16−.hsenv
17−.hpc
18−.cabal-sandbox/
19−cabal.sandbox.config
20−cabal.config
21−cabal.project.local
22−.ghc.environment.*
23−.HTF/
24−# Stack
251.stack-work/
26−stack.yaml.lock
27−
28−### IDE/support
29−# Vim
30−[._]*.s[a-v][a-z]
31−[._]*.sw[a-p]
32−[._]s[a-v][a-z]
33−[._]sw[a-p]
34−*~
35−tags
36−
37−# IntellijIDEA
38−.idea/
39−.ideaHaskellLib/
40−*.iml
41−
42−# Atom
43−.haskell-ghc-mod.json
44−
45−# VS
46−.vscode/
47−
48−# Emacs
49−*#
50−.dir-locals.el
51−TAGS
52−
53−# other
54−.DS_Store
55−hackage.sh
2+laop.cabal
3+*~
.travis.ymldeleted−47
@@ -1,47 +0,0 @@
1−sudo: true
2−language: haskell
3−
4−git:
5− depth: 5
6−
7−cabal: "3.0"
8−
9−cache:
10− directories:
11− - "$HOME/.cabal/store"
12− - "$HOME/.stack"
13− - "$TRAVIS_BUILD_DIR/.stack-work"
14−
15−matrix:
16− include:
17− - ghc: 8.6.5
18− - ghc: 8.8.3
19−
20− - ghc: 8.8.3
21− env: STACK_YAML="$TRAVIS_BUILD_DIR/stack-8.8.3.yaml"
22−
23− - ghc: 8.6.5
24− env: STACK_YAML="$TRAVIS_BUILD_DIR/stack.yaml"
25−
26−
27−install:
28− - |
29− if [ -z "$STACK_YAML" ]; then
30− cabal v2-update
31− cabal v2-build --enable-tests --enable-benchmarks
32− else
33− curl -sSL https://get.haskellstack.org/ | sh
34− stack --version
35− stack build --system-ghc --test --bench --no-run-tests --no-run-benchmarks
36− fi
37−
38−script:
39− - |
40− if [ -z "$STACK_YAML" ]; then
41− cabal v2-test --enable-tests
42− else
43− stack test --system-ghc
44− fi
45−
46−notifications:
47− email: false
CHANGELOG.mddeleted−17
@@ -1,17 +0,0 @@
1−# Changelog
2−
3−`laop` uses [PVP Versioning][1].
4−The changelog is available [on GitHub][2].
5−
6−## 0.1.1.1
7−
8−* Bump base version to work with cabal
9−
10−## 0.1.1.0
11−
12−* Package is more organized and now has tests and benchmarks separated
13−* Repository is more organized and clean
14−* Added CI
15−
16−[1]: https://pvp.haskell.org
17−[2]: https://github.com/bolt12/laop2/releases
ChangeLog.mdnew file+3
@@ -0,0 +1,3 @@
1+# Changelog for laop
2+
3+## Unreleased changes
LICENSE+26−17
@@ -1,21 +1,30 @@
1−MIT License
1+Copyright Armando Santos (c) 2019
22
3−Copyright (c) 2020 Armando Santos
3+All rights reserved.
44
5−Permission is hereby granted, free of charge, to any person obtaining a copy
6−of this software and associated documentation files (the "Software"), to deal
7−in the Software without restriction, including without limitation the rights
8−to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
9−copies of the Software, and to permit persons to whom the Software is
10−furnished to do so, subject to the following conditions:
5+Redistribution and use in source and binary forms, with or without
6+modification, are permitted provided that the following conditions are met:
117
12−The above copyright notice and this permission notice shall be included in all
13−copies or substantial portions of the Software.
8+ * Redistributions of source code must retain the above copyright
9+ notice, this list of conditions and the following disclaimer.
1410
15−THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16−IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
17−FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
18−AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
19−LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
20−OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
21−SOFTWARE.
11+ * Redistributions in binary form must reproduce the above
12+ copyright notice, this list of conditions and the following
13+ disclaimer in the documentation and/or other materials provided
14+ with the distribution.
15+
16+ * Neither the name of Armando Santos nor the names of other
17+ contributors may be used to endorse or promote products derived
18+ from this software without specific prior written permission.
19+
20+THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
21+"AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
22+LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
23+A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
24+OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
25+SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
26+LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
27+DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
28+THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
29+(INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
30+OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
README.md+24−107
@@ -1,11 +1,5 @@
11# laop - Linear Algebra of Programming library
22
3−[![GitHub CI](https://github.com/bolt12/laop/workflows/CI/badge.svg)](https://github.com/bolt12/laop/actions)
4−[![Build status](https://img.shields.io/travis/bolt12/laop.svg?logo=travis)](https://travis-ci.org/bolt12/laop)
5−[![Hackage](https://img.shields.io/hackage/v/laop.svg?logo=haskell)](https://hackage.haskell.org/package/laop)
6−[![Stackage Lts](http://stackage.org/package/laop/badge/lts)](http://stackage.org/lts/package/laop)
7−[![Stackage Nightly](http://stackage.org/package/laop/badge/nightly)](http://stackage.org/nightly/package/laop)
8−
93The LAoP discipline generalises relations and functions treating them as
104Boolean matrices and in turn consider these as arrows.
115
@@ -16,38 +10,33 @@ motivation behind the library, the underlying theory, and implementation details
1610This module offers many of the combinators mentioned in the work of
1711[Macedo (2012)](https://repositorium.sdum.uminho.pt/handle/1822/22894) and [Oliveira (2012)](https://pdfs.semanticscholar.org/ccf5/27fa9179081223bffe8067edd81948644fc0.pdf).
1812
19−See the package in hackage [here](https://hackage.haskell.org/package/laop-0.1.1.0)
20−
21−A Functional Pearl has been written and can be regarded as the [reference document](https://github.com/bolt12/tymfgg-pearl) for this library.
13+See the candidate package in hackage [here](https://hackage.haskell.org/package/laop-0.1.0.0/candidate)
2214
2315## Features
2416
25−This library offers 3 main matrix programming modules:
26−
27−- One in which matrices are typed with type level natural numbers;
28−- One in which matrices are typed with arbitrary generic data types;
29−- One in which matrices are regarded as relations, i.e. boolean matrices;
30−
31−There's also an experimental module that uses matrices to represent probability
32−distributions.
33−
34−The most interesting feature is that matrices are represented as an inductive data type.
35−Given this formulation, matrix algorithms can be expressed in a much more elegant and
36−calculational style than the traditional vector of vectors representation. This data type
37−guarantees that a matrix will always have valid dimensions. It can also express block matrix
38−computations naturally, which leads to total, efficient and statically typed manipulation
39−and transformation functions.
40−
41−Like matrix multiplication, other common operations, such as matrix transposition, benefit from a block-oriented structure that leads to a simple and natural divide-and-conquer algorithmic solution. Performance wise, this means that without much effort we can obtain optimal cache-oblivious algorithms.
42−
43−Given this, this new matrix formulation compared to other libraries:
44−
45−- Is more compositional and polymorphic and does not have partial matrix manipulation functions (hence less chances for usage errors);
46−- Our implementation of matrices enables simple manipulation of submatrices, making it particularly suitable for formal verification and equation reasoning, using the mathematical framework defined by the linear algebra of programming. Furthermore, the data type constructors ensure that the matrices of this kind are sound, i.e. malformed matrices with incorrect dimensions of the sort, can not be constructed.
47−
48−## Known issues
49−
50−Unfortunately, due to the use of type-level programming features, this approach sometimes requires type dimensions to be constrainted, in some way, impossible to write idiomatic Arrow instances, for example. Type inference isn't perfect, when it comes to infer the types of matrices which dimensions are computed using type level naturals multiplication, the compiler needs type annotations in order to succeed. And not all kinds of programs can be modeled using matrices, namely programs that deal with arbitrary infinite data types such as lists or integers (although there are some workarounds).
17+This library offers:
18+
19+- An internal representation that uses normal datatypes (`Void`, `()`, `Either`) for matrix dimensions and two
20+ type families `FromNat` and `Count` to make it easier to work with these type of matrices.
21+- A module that uses generalised types for the dimensions and is just a newtype wrapper
22+ around the internal matrix data type.
23+- Other that uses type level naturals for the dimensions and is just a newtype wrapper
24+ around the internal matrix data type.
25+- A very simple Probabilistic Programming module and several functions and data types to
26+ make it easier to deal with sample space.
27+
28+Given this, this new matrix formulation compared to other libraries one has much more advantages, such as:
29+
30+- Has an inductive definition enabling writing matrix manipulation functions in a much more elegant and calculational way;
31+- Statically typed dimensions;
32+- Polymorphic data type dimensions;
33+- Polymorphic matrix content;
34+- Awesome dimension type inference;
35+- Fast type natural conversion via `FromNat` type family;
36+- Matrix `Junc` and `Split`-ing in O(1);
37+- Matrix composition takes advantage of divide-and-conquer and fusion laws.
38+
39+Unfortunately, this approach does not solve the issue of type dimensions being in some way constrainted making it impossible to write Arrow instances, for example. Type inference isn't perfect, when it comes to infer the types of matrices which dimensions are computed using type level naturals multiplication, the compiler needs type annotations in order to succeed.
5140
5241## Notes
5342
@@ -129,73 +118,6 @@ grass_wet = row [0,1] . kp1
129118rainning :: Matrix Double (Bool, (Bool, Bool)) One
130119rainning = row [0,1] . kp2 . kp2
131120
132−-- Alcuin Puzzle
133−
134−data Being = Farmer | Fox | Goose | Beans
135− deriving (Bounded, Enum, Eq, Show, Generic)
136−
137−data Bank = LeftB | RightB
138− deriving (Bounded, Enum, Eq, Show, Generic)
139−
140−eats :: Being -> Being -> Bool
141−eats Fox Goose = True
142−eats Goose Beans = True
143−eats _ _ = False
144−
145−eatsR :: R.Relation Being Being
146−eatsR = R.toRel eats
147−
148−cross :: Bank -> Bank
149−cross LeftB = RightB
150−cross RightB = LeftB
151−
152−crossR :: R.Relation Bank Bank
153−crossR = R.fromF' cross
154−
155−-- | Initial state, everyone in the left bank
156−locationLeft :: Being -> Bank
157−locationLeft _ = LeftB
158−
159−locationLeftR :: R.Relation Being Bank
160−locationLeftR = R.fromF' locationLeft
161−
162−-- | Initial state, everyone in the right bank
163−locationRight :: Being -> Bank
164−locationRight _ = RightB
165−
166−locationRightR :: R.Relation Being Bank
167−locationRightR = R.fromF' locationRight
168−
169−-- Properties
170−
171−-- Being at the same bank
172−sameBank :: R.Relation Being Bank -> R.Relation Being Being
173−sameBank = R.ker
174−
175−-- Risk of somebody eating somebody else
176−canEat :: R.Relation Being Bank -> R.Relation Being Being
177−canEat w = sameBank w `R.intersection` eatsR
178−
179−-- "Starvation" property.
180−inv :: R.Relation Being Bank -> Bool
181−inv w = (w `R.comp` canEat w) `R.sse` (w `R.comp` farmer)
182− where
183− farmer :: R.Relation Being Being
184− farmer = R.fromF' (const Farmer)
185−
186−-- Arbitrary state
187−bankState :: Being -> Bank -> Bool
188−bankState Farmer LeftB = True
189−bankState Fox LeftB = True
190−bankState Goose RightB = True
191−bankState Beans RightB = True
192−bankState _ _ = False
193−
194−bankStateR :: R.Relation Being Bank
195−bankStateR = R.toRel bankState
196−
197−-- Main
198−
199121main :: IO ()
200122main = do
201123 putStrLn "Monty Hall Problem solution:"
@@ -210,8 +132,6 @@ main = do
210132 prettyPrint (grass_wet . state)
211133 putStrLn "\n Probability of rain:"
212134 prettyPrint (rainning . state)
213− putStrLn "\n Is the arbitrary state a valid state? (Alcuin Puzzle)"
214− print (inv bankStateR)
215135```
216136
217137```Shell
@@ -270,7 +190,4 @@ Monty Hall Problem solution:
270190┌ ┐
271191│ 0.2 │
272192└ ┘
273−
274−Is the arbitrary state a valid state? (Alcuin Puzzle)
275−False
276193```
Setup.hsnew file+2
@@ -0,0 +1,2 @@
1+import Distribution.Simple
2+main = defaultMain
test/Examples/Readme.hs → app/Main.hsrenamed+33−61
@@ -1,13 +1,10 @@
1−{-# LANGUAGE GADTs #-}
21{-# LANGUAGE DeriveGeneric #-}
32{-# LANGUAGE FlexibleContexts #-}
3+{-# LANGUAGE TypeOperators #-}
44{-# LANGUAGE TypeApplications #-}
55{-# LANGUAGE DataKinds #-}
66
7−module Examples.Readme
8− ( exec
9− )
10− where
7+module Main where
118
129import LAoP.Matrix.Type
1310import qualified LAoP.Relation as R
@@ -15,12 +12,13 @@ import LAoP.Utils
1512import LAoP.Dist
1613import GHC.TypeLits
1714import Data.Coerce
18−import qualified GHC.Generics as G
19−import Prelude hiding (id, (.))
15+import GHC.Generics
16+import Control.Category hiding (id)
17+import Prelude hiding ((.))
2018
2119-- Monty Hall Problem
2220data Outcome = Win | Lose
23− deriving (Bounded, Enum, Eq, Show, G.Generic)
21+ deriving (Bounded, Enum, Eq, Show, Generic)
2422
2523switch :: Outcome -> Outcome
2624switch Win = Lose
@@ -30,7 +28,7 @@ firstChoice :: Matrix Double () Outcome
3028firstChoice = col [1/3, 2/3]
3129
3230secondChoice :: Matrix Double Outcome Outcome
33−secondChoice = fromF switch
31+secondChoice = fromF' switch
3432
3533-- Dice sum
3634
@@ -39,7 +37,7 @@ type SS = Natural 1 6 -- Sample Space
3937sumSS :: SS -> SS -> Natural 2 12
4038sumSS = coerceNat (+)
4139
42−sumSSM = fromF (uncurry sumSS)
40+sumSSM = fromF' (uncurry sumSS)
4341
4442condition :: (Int, Int) -> Int -> Int
4543condition (fst, snd) thrd = if fst == snd
@@ -49,64 +47,38 @@ condition (fst, snd) thrd = if fst == snd
4947conditionSS :: (SS, SS) -> SS -> Natural 3 18
5048conditionSS = coerceNat2 condition
5149
52−conditionalThrows = fromF (uncurry conditionSS) . kr (kr die die) die
50+conditionalThrows = fromF' (uncurry conditionSS) . khatri (khatri die die) die
5351
5452die :: Matrix Double () SS
5553die = col $ map (const (1/6)) [nat @1 @6 1 .. nat 6]
5654
5755-- Sprinkler
58−data G = Dry | Wet
59− deriving (Bounded, Enum, Eq, Show, G.Generic)
60−
61−data S = Off | On
62− deriving (Bounded, Enum, Eq, Show, G.Generic)
6356
64−data R = No | Yes
65− deriving (Bounded, Enum, Eq, Show, G.Generic)
66−
67−rain :: Matrix Double () R
68−rain = matrixBuilder gen
69− where
70− gen (_, No) = 0.8
71− gen (_, Yes) = 0.2
57+rain :: Matrix Double () Bool
58+rain = col [0.8, 0.2]
7259
73−sprinkler :: Matrix Double R S
74−sprinkler = matrixBuilder gen
75− where
76− gen (No, Off) = 0.6
77− gen (No, On) = 0.4
78− gen (Yes, Off) = 0.99
79− gen (Yes, On) = 0.01
80−
81−grass :: Matrix Double (S, R) G
82−grass = matrixBuilder gen
83− where
84− gen ((Off, No), Dry) = 1
85− gen ((Off, Yes), Dry) = 0.2
86− gen ((On, No), Dry) = 0.1
87− gen ((On, Yes), Dry) = 0.01
88− gen ((Off, No), Wet) = 0
89− gen ((Off, Yes), Wet) = 0.8
90− gen ((On, No), Wet) = 0.9
91− gen ((On, Yes), Wet) = 0.99
60+sprinkler :: Matrix Double Bool Bool
61+sprinkler = fromLists [[0.6, 0.99], [0.4, 0.01]]
9262
93−tag f = kr f id
63+grass :: Matrix Double (Bool, Bool) Bool
64+grass = fromLists [[1, 0.2, 0.1, 0.01], [0, 0.8, 0.9, 0.99]]
9465
95−state g s r = tag g . tag s . r
66+state :: Matrix Double () (Bool, (Bool, Bool))
67+state = khatri grass identity . khatri sprinkler identity . rain
9668
97−grass_wet :: Matrix Double () (G, (S, R)) -> Matrix Double One One
98−grass_wet state = row [0,1] . fstM . state
69+grass_wet :: Matrix Double (Bool, (Bool, Bool)) One
70+grass_wet = row [0,1] . kp1
9971
100−rainning :: Matrix Double (G, (S, R)) One
101−rainning = row [0,1] . sndM . sndM
72+rainning :: Matrix Double (Bool, (Bool, Bool)) One
73+rainning = row [0,1] . kp2 . kp2
10274
10375-- Alcuin Puzzle
10476
10577data Being = Farmer | Fox | Goose | Beans
106− deriving (Bounded, Enum, Eq, Show, G.Generic)
78+ deriving (Bounded, Enum, Eq, Show, Generic)
10779
10880data Bank = LeftB | RightB
109− deriving (Bounded, Enum, Eq, Show, G.Generic)
81+ deriving (Bounded, Enum, Eq, Show, Generic)
11082
11183eats :: Being -> Being -> Bool
11284eats Fox Goose = True
@@ -121,21 +93,21 @@ cross LeftB = RightB
12193cross RightB = LeftB
12294
12395crossR :: R.Relation Bank Bank
124−crossR = R.fromF cross
96+crossR = R.fromF' cross
12597
12698-- | Initial state, everyone in the left bank
12799locationLeft :: Being -> Bank
128100locationLeft _ = LeftB
129101
130102locationLeftR :: R.Relation Being Bank
131−locationLeftR = R.fromF locationLeft
103+locationLeftR = R.fromF' locationLeft
132104
133105-- | Initial state, everyone in the right bank
134106locationRight :: Being -> Bank
135107locationRight _ = RightB
136108
137109locationRightR :: R.Relation Being Bank
138−locationRightR = R.fromF locationRight
110+locationRightR = R.fromF' locationRight
139111
140112-- Properties
141113
@@ -152,7 +124,7 @@ inv :: R.Relation Being Bank -> Bool
152124inv w = (w `R.comp` canEat w) `R.sse` (w `R.comp` farmer)
153125 where
154126 farmer :: R.Relation Being Being
155− farmer = R.fromF (const Farmer)
127+ farmer = R.fromF' (const Farmer)
156128
157129-- Arbitrary state
158130bankState :: Being -> Bank -> Bool
@@ -166,19 +138,19 @@ bankStateR :: R.Relation Being Bank
166138bankStateR = R.toRel bankState
167139
168140-- Main
169−exec :: IO ()
170−exec = do
141+main :: IO ()
142+main = do
171143 putStrLn "Monty Hall Problem solution:"
172144 prettyPrint (secondChoice . firstChoice)
173145 putStrLn "\n Sum of dices probability:"
174− prettyPrint (sumSSM . kr die die)
146+ prettyPrint (sumSSM `comp` khatri die die)
175147 putStrLn "\n Conditional dice throw:"
176148 prettyPrint conditionalThrows
177149 putStrLn "\n Checking that the last result is indeed a distribution: "
178− prettyPrint (bang . sumSSM . kr die die)
150+ prettyPrint (bang . sumSSM . khatri die die)
179151 putStrLn "\n Probability of grass being wet:"
180− prettyPrint (grass_wet (state grass sprinkler rain))
152+ prettyPrint (grass_wet . state)
181153 putStrLn "\n Probability of rain:"
182− prettyPrint (rainning . state grass sprinkler rain)
154+ prettyPrint (rainning . state)
183155 putStrLn "\n Is the arbitrary state a valid state? (Alcuin Puzzle)"
184156 print (inv bankStateR)
appveyor.ymldeleted−34
@@ -1,34 +0,0 @@
1−clone_folder: "c:\\WORK"
2−clone_depth: 5
3−
4−# Do not build feature branch with open Pull Requests
5−skip_branch_with_pr: true
6−
7−platform:
8− - x86_64
9−
10−cache:
11− - "C:\\SR"
12− - dist-newstyle
13−
14−environment:
15− global:
16− CABOPTS: --store-dir=C:\\SR
17−
18− matrix:
19− - GHCVER: 8.6.5
20−
21−install:
22− - choco source add -n mistuke -s https://www.myget.org/F/mistuke/api/v2
23− - choco install -y cabal --version 2.4.1.0
24− - choco install -y ghc --version 8.6.3
25− - refreshenv
26−
27−before_build:
28− - cabal --version
29− - ghc --version
30− - cabal %CABOPTS% v2-update
31−
32−build_script:
33− - cabal %CABOPTS% v2-build --enable-tests
34− - cabal %CABOPTS% v2-test --enable-tests
benchmark/Main.hsdeleted−175
@@ -1,175 +0,0 @@
1−{-# LANGUAGE KindSignatures #-}
2−{-# LANGUAGE GeneralizedNewtypeDeriving #-}
3−{-# LANGUAGE DerivingVia #-}
4−{-# LANGUAGE DataKinds #-}
5−{-# LANGUAGE BangPatterns #-}
6−{-# LANGUAGE TypeApplications #-}
7−{-# LANGUAGE FlexibleContexts #-}
8−{-# LANGUAGE AllowAmbiguousTypes #-}
9−{-# LANGUAGE ScopedTypeVariables #-}
10−
11−module Main (main) where
12−
13−import LAoP.Dist.Internal
14−import LAoP.Utils
15−import LAoP.Matrix.Type hiding (CountableN, Countable, FLN)
16−import qualified LAoP.Matrix.Type as T (FLN)
17−import Criterion.Main
18−import Control.DeepSeq
19−import Test.QuickCheck
20−import GHC.TypeLits
21−import Data.Proxy
22−import Prelude hiding (id, (.))
23−
24−selectM2 ::
25− ( Num e,
26− T.FLN b b,
27− CountableN b
28− ) => Matrix e cols (Either a b) -> Matrix e a b -> Matrix e cols b
29−selectM2 m y = join y iden `comp` m
30−
31−selectD2 ::
32− ( FLN b b,
33− CountableN b
34− ) => Dist (Either a b) -> Matrix Prob a b -> Dist b
35−selectD2 (D d) m = D (join m iden `comp` d)
36−
37−-- Composition with iden
38−compId m = comp iden m
39−
40−randomDist :: forall a . (Countable a, FLN () a) => Gen (Dist a)
41−randomDist = do
42− let size = fromInteger (natVal (Proxy :: Proxy (Count a)))
43− l <- vectorOf size (arbitrary :: Gen Prob)
44− let ln = normalize l
45− lr = map (:[]) ln
46− m = fromLists lr
47− return (D m)
48−
49−randomMatrix :: forall a b . (CountableDims a b, FLN a b) => Gen (Matrix Prob a b)
50−randomMatrix = do
51− let cols = fromInteger (natVal (Proxy :: Proxy (Count a)))
52− rows = fromInteger (natVal (Proxy :: Proxy (Count b)))
53− l <- vectorOf (cols * rows) arbitrary
54− let lr = buildList l cols
55− m = fromLists lr
56− return m
57−
58−buildList [] _ = []
59−buildList l r = take r l : buildList (drop r l) r
60−
61−normalize :: [Prob] -> [Prob]
62−normalize l = let l' = map abs l
63− s = sum l'
64− in map (/ s) l'
65−
66−-- Probability
67−newtype Probability = P Double
68− deriving (Num, Show, Fractional, NFData) via Double
69−newtype Dist' a = D' { unD :: [(a,Probability)] }
70− deriving (Show, NFData)
71−
72−instance Functor Dist' where
73− fmap f (D' d) = D' [(f x,p) | (x,p) <- d]
74−
75−instance Applicative Dist' where
76− pure x = D' [(x, 1)]
77− fm <*> m = D' [(f x,q*p) | (f,p) <- unD fm, (x,q) <- unD m]
78−
79−class Applicative f => Selective f where
80− select :: f (Either a b) -> f (a -> b) -> f b
81−
82−instance Selective Dist' where
83− select x y = (\e f -> either f id e) <$> x <*> y -- selectA
84−
85−instance Monad Dist' where
86− return = pure
87− (D' d) >>= f = D' [(y,q*p) | (x,p) <- d, (y,q) <- unD (f x)]
88−
89−normalize2 :: forall a . (Enum a, Bounded a) => [Probability] -> [(a, Probability)]
90−normalize2 l = let l' = map abs l
91− as = [minBound .. maxBound]
92− s = sum l'
93− probs = map (/ s) l'
94− in zip as probs
95−
96−randomDist2 :: forall a . (Countable a, Enum a, Bounded a) => Gen (Dist' a)
97−randomDist2 = do
98− let size = fromInteger (natVal (Proxy :: Proxy (Count a)))
99− l <- vectorOf size (arbitrary :: Gen Prob)
100− let ln = normalize2 @a (map P l)
101− return (D' ln)
102−
103−normalize3 :: forall a . [a] -> [Probability] -> [(a, Probability)]
104−normalize3 as l = let s = sum l
105− probs = map (/ s) l
106− in zip as probs
107−
108−randomDistF :: forall a b . (CountableDims a b, CoArbitrary a, Arbitrary b) => Gen (Dist' (a -> b))
109−randomDistF = do
110− let a = fromInteger (natVal (Proxy :: Proxy (Count a)))
111− b = fromInteger (natVal (Proxy :: Proxy (Count b)))
112− size = a * b
113− l <- vectorOf size (arbitrary :: Gen Prob)
114− l2 <- vectorOf size (arbitrary :: Gen (a -> b))
115− let !ln = normalize3 l2 (map P l)
116− return (D' ln)
117−
118−instance CoArbitrary (Natural a b)
119−
120−instance forall (a :: Nat) (b :: Nat). (KnownNat a, KnownNat b) => Arbitrary (Natural a b)
121− where
122− arbitrary =
123− let bottom = fromInteger (natVal (Proxy :: Proxy a))
124− top = fromInteger (natVal (Proxy :: Proxy b))
125− in do
126− x <- arbitrary `suchThat` (\n -> n >= bottom && n <= top)
127− return (nat x)
128−
129−setupEnv = do
130− m11 <- generate (resize 1 (randomMatrix @(Natural 0 10) @(Natural 0 10) ))
131− m12 <- generate (resize 1 (randomMatrix @(Natural 0 10) @(Natural 0 10) ))
132− m21 <- generate (resize 1 (randomMatrix @(Natural 0 100) @(Natural 0 100) ))
133− m22 <- generate (resize 1 (randomMatrix @(Natural 0 100) @(Natural 0 100) ))
134− m31 <- generate (resize 1 (randomMatrix @(Natural 0 200) @(Natural 0 200) ))
135− m32 <- generate (resize 1 (randomMatrix @(Natural 0 200) @(Natural 0 200) ))
136− return (m11, m12, m21, m22, m31, m32)
137−
138−setupEnv2 = do
139− m21 <- generate (resize 1 (randomMatrix @(Natural 0 100) @(Natural 0 100) ))
140− m40 <- generate (resize 1 (randomMatrix @(Natural 0 100) @(Either (Natural 0 100) (Natural 0 100) )))
141− dist <- generate (resize 1 (randomDist @(Either (Natural 0 100) (Natural 0 100)) ))
142− dist2 <- generate (resize 1 (randomMatrix @(Natural 0 100) @(Natural 0 100) ))
143− distList1 <- generate (resize 1 (randomDist2 @(Either (Natural 0 100) (Natural 0 100))))
144− distList2 <- generate (resize 1 (randomDistF @(Natural 0 100) @(Natural 0 100)))
145− return (m21, m40, dist, dist2, distList1, distList2)
146−
147−main :: IO ()
148−main = defaultMain [
149− env setupEnv $ \ ~(m11, m12, m21, m22, m31, m32) -> bgroup "Matrix Composition" [
150− bgroup "10x10" [
151− bench "WHNF - 10x10" $ whnf (comp m11) m12
152− , bench "NF - 10x10" $ nf (comp m11) m12
153− ],
154− bgroup "100x100" [
155− bench "WHNF - 100x100" $ whnf (comp m21) m22
156− , bench "NF - 100x100" $ nf (comp m21) m22
157− ],
158− bgroup "200x200" [
159− bench "WHNF - 200x200" $ whnf (comp m31) m32
160− , bench "NF - 200x200" $ nf (comp m31) m32
161− ],
162− bgroup "200x200 - RULES" [
163− bench "No rules - 200x200" $ nf (comp m21) iden
164− , bench "Rules - 200x200" $ nf compId m21
165− ] ],
166− env setupEnv2 $ \ ~(m21, m40, dist, dist2, dl1, dl2) -> bgroup "Matrix vs List - `select`" [
167− bgroup "Distribution `select` - 100+100 / 100x100" [
168− bench "List Distribution - Applicative version" $ nf (select dl1) dl2
169− , bench "Matrix Distribution - Applicative version" $ nf (selectD2 dist) dist2
170− , bench "Matrix Distribution - Selective version" $ nf (selectD dist) dist2
171− ],
172− bgroup "Matrix `select` - 100x(100+100) / 100x100" [
173− bench "Applicative version" $ nf (selectM2 m40) m21
174− , bench "Selective version" $ nf (selectM m40) m21
175− ] ] ]
build/x86_64-linux/ghc-8.6.5/laop-0.1.0.0/build/autogen/Paths_laop.hsnew file+50
@@ -0,0 +1,50 @@
1+{-# LANGUAGE CPP #-}
2+{-# LANGUAGE NoRebindableSyntax #-}
3+{-# OPTIONS_GHC -fno-warn-missing-import-lists #-}
4+module Paths_laop (
5+ version,
6+ getBinDir, getLibDir, getDynLibDir, getDataDir, getLibexecDir,
7+ getDataFileName, getSysconfDir
8+ ) where
9+
10+import qualified Control.Exception as Exception
11+import Data.Version (Version(..))
12+import System.Environment (getEnv)
13+import Prelude
14+
15+#if defined(VERSION_base)
16+
17+#if MIN_VERSION_base(4,0,0)
18+catchIO :: IO a -> (Exception.IOException -> IO a) -> IO a
19+#else
20+catchIO :: IO a -> (Exception.Exception -> IO a) -> IO a
21+#endif
22+
23+#else
24+catchIO :: IO a -> (Exception.IOException -> IO a) -> IO a
25+#endif
26+catchIO = Exception.catch
27+
28+version :: Version
29+version = Version [0,1,0,0] []
30+bindir, libdir, dynlibdir, datadir, libexecdir, sysconfdir :: FilePath
31+
32+bindir = "/home/bolt/.cabal/bin"
33+libdir = "/home/bolt/.cabal/lib/x86_64-linux-ghc-8.6.5/laop-0.1.0.0-inplace"
34+dynlibdir = "/home/bolt/.cabal/lib/x86_64-linux-ghc-8.6.5"
35+datadir = "/home/bolt/.cabal/share/x86_64-linux-ghc-8.6.5/laop-0.1.0.0"
36+libexecdir = "/home/bolt/.cabal/libexec/x86_64-linux-ghc-8.6.5/laop-0.1.0.0"
37+sysconfdir = "/home/bolt/.cabal/etc"
38+
39+getBinDir, getLibDir, getDynLibDir, getDataDir, getLibexecDir, getSysconfDir :: IO FilePath
40+getBinDir = catchIO (getEnv "laop_bindir") (\_ -> return bindir)
41+getLibDir = catchIO (getEnv "laop_libdir") (\_ -> return libdir)
42+getDynLibDir = catchIO (getEnv "laop_dynlibdir") (\_ -> return dynlibdir)
43+getDataDir = catchIO (getEnv "laop_datadir") (\_ -> return datadir)
44+getLibexecDir = catchIO (getEnv "laop_libexecdir") (\_ -> return libexecdir)
45+getSysconfDir = catchIO (getEnv "laop_sysconfdir") (\_ -> return sysconfdir)
46+
47+getDataFileName :: FilePath -> IO FilePath
48+getDataFileName name = do
49+ dir <- getDataDir
50+ return (dir ++ "/" ++ name)
build/x86_64-linux/ghc-8.6.5/laop-0.1.0.0/build/autogen/cabal_macros.hnew file+143
@@ -0,0 +1,143 @@
1+/* DO NOT EDIT: This file is automatically generated by Cabal */
2+
3+/* package laop-0.1.0.0 */
4+#ifndef VERSION_laop
5+#define VERSION_laop "0.1.0.0"
6+#endif /* VERSION_laop */
7+#ifndef MIN_VERSION_laop
8+#define MIN_VERSION_laop(major1,major2,minor) (\
9+ (major1) < 0 || \
10+ (major1) == 0 && (major2) < 1 || \
11+ (major1) == 0 && (major2) == 1 && (minor) <= 0)
12+#endif /* MIN_VERSION_laop */
13+
14+/* package base-4.12.0.0 */
15+#ifndef VERSION_base
16+#define VERSION_base "4.12.0.0"
17+#endif /* VERSION_base */
18+#ifndef MIN_VERSION_base
19+#define MIN_VERSION_base(major1,major2,minor) (\
20+ (major1) < 4 || \
21+ (major1) == 4 && (major2) < 12 || \
22+ (major1) == 4 && (major2) == 12 && (minor) <= 0)
23+#endif /* MIN_VERSION_base */
24+
25+/* package deepseq-1.4.4.0 */
26+#ifndef VERSION_deepseq
27+#define VERSION_deepseq "1.4.4.0"
28+#endif /* VERSION_deepseq */
29+#ifndef MIN_VERSION_deepseq
30+#define MIN_VERSION_deepseq(major1,major2,minor) (\
31+ (major1) < 1 || \
32+ (major1) == 1 && (major2) < 4 || \
33+ (major1) == 1 && (major2) == 4 && (minor) <= 4)
34+#endif /* MIN_VERSION_deepseq */
35+
36+/* tool gcc-9.2.0 */
37+#ifndef TOOL_VERSION_gcc
38+#define TOOL_VERSION_gcc "9.2.0"
39+#endif /* TOOL_VERSION_gcc */
40+#ifndef MIN_TOOL_VERSION_gcc
41+#define MIN_TOOL_VERSION_gcc(major1,major2,minor) (\
42+ (major1) < 9 || \
43+ (major1) == 9 && (major2) < 2 || \
44+ (major1) == 9 && (major2) == 2 && (minor) <= 0)
45+#endif /* MIN_TOOL_VERSION_gcc */
46+
47+/* tool ghc-8.6.5 */
48+#ifndef TOOL_VERSION_ghc
49+#define TOOL_VERSION_ghc "8.6.5"
50+#endif /* TOOL_VERSION_ghc */
51+#ifndef MIN_TOOL_VERSION_ghc
52+#define MIN_TOOL_VERSION_ghc(major1,major2,minor) (\
53+ (major1) < 8 || \
54+ (major1) == 8 && (major2) < 6 || \
55+ (major1) == 8 && (major2) == 6 && (minor) <= 5)
56+#endif /* MIN_TOOL_VERSION_ghc */
57+
58+/* tool ghc-pkg-8.6.5 */
59+#ifndef TOOL_VERSION_ghc_pkg
60+#define TOOL_VERSION_ghc_pkg "8.6.5"
61+#endif /* TOOL_VERSION_ghc_pkg */
62+#ifndef MIN_TOOL_VERSION_ghc_pkg
63+#define MIN_TOOL_VERSION_ghc_pkg(major1,major2,minor) (\
64+ (major1) < 8 || \
65+ (major1) == 8 && (major2) < 6 || \
66+ (major1) == 8 && (major2) == 6 && (minor) <= 5)
67+#endif /* MIN_TOOL_VERSION_ghc_pkg */
68+
69+/* tool haddock-2.22.0 */
70+#ifndef TOOL_VERSION_haddock
71+#define TOOL_VERSION_haddock "2.22.0"
72+#endif /* TOOL_VERSION_haddock */
73+#ifndef MIN_TOOL_VERSION_haddock
74+#define MIN_TOOL_VERSION_haddock(major1,major2,minor) (\
75+ (major1) < 2 || \
76+ (major1) == 2 && (major2) < 22 || \
77+ (major1) == 2 && (major2) == 22 && (minor) <= 0)
78+#endif /* MIN_TOOL_VERSION_haddock */
79+
80+/* tool hpc-0.67 */
81+#ifndef TOOL_VERSION_hpc
82+#define TOOL_VERSION_hpc "0.67"
83+#endif /* TOOL_VERSION_hpc */
84+#ifndef MIN_TOOL_VERSION_hpc
85+#define MIN_TOOL_VERSION_hpc(major1,major2,minor) (\
86+ (major1) < 0 || \
87+ (major1) == 0 && (major2) < 67 || \
88+ (major1) == 0 && (major2) == 67 && (minor) <= 0)
89+#endif /* MIN_TOOL_VERSION_hpc */
90+
91+/* tool hsc2hs-0.68.5 */
92+#ifndef TOOL_VERSION_hsc2hs
93+#define TOOL_VERSION_hsc2hs "0.68.5"
94+#endif /* TOOL_VERSION_hsc2hs */
95+#ifndef MIN_TOOL_VERSION_hsc2hs
96+#define MIN_TOOL_VERSION_hsc2hs(major1,major2,minor) (\
97+ (major1) < 0 || \
98+ (major1) == 0 && (major2) < 68 || \
99+ (major1) == 0 && (major2) == 68 && (minor) <= 5)
100+#endif /* MIN_TOOL_VERSION_hsc2hs */
101+
102+/* tool pkg-config-1.6.3 */
103+#ifndef TOOL_VERSION_pkg_config
104+#define TOOL_VERSION_pkg_config "1.6.3"
105+#endif /* TOOL_VERSION_pkg_config */
106+#ifndef MIN_TOOL_VERSION_pkg_config
107+#define MIN_TOOL_VERSION_pkg_config(major1,major2,minor) (\
108+ (major1) < 1 || \
109+ (major1) == 1 && (major2) < 6 || \
110+ (major1) == 1 && (major2) == 6 && (minor) <= 3)
111+#endif /* MIN_TOOL_VERSION_pkg_config */
112+
113+/* tool runghc-8.6.5 */
114+#ifndef TOOL_VERSION_runghc
115+#define TOOL_VERSION_runghc "8.6.5"
116+#endif /* TOOL_VERSION_runghc */
117+#ifndef MIN_TOOL_VERSION_runghc
118+#define MIN_TOOL_VERSION_runghc(major1,major2,minor) (\
119+ (major1) < 8 || \
120+ (major1) == 8 && (major2) < 6 || \
121+ (major1) == 8 && (major2) == 6 && (minor) <= 5)
122+#endif /* MIN_TOOL_VERSION_runghc */
123+
124+/* tool strip-2.33 */
125+#ifndef TOOL_VERSION_strip
126+#define TOOL_VERSION_strip "2.33"
127+#endif /* TOOL_VERSION_strip */
128+#ifndef MIN_TOOL_VERSION_strip
129+#define MIN_TOOL_VERSION_strip(major1,major2,minor) (\
130+ (major1) < 2 || \
131+ (major1) == 2 && (major2) < 33 || \
132+ (major1) == 2 && (major2) == 33 && (minor) <= 0)
133+#endif /* MIN_TOOL_VERSION_strip */
134+
135+#ifndef CURRENT_PACKAGE_KEY
136+#define CURRENT_PACKAGE_KEY "laop-0.1.0.0-inplace"
137+#endif /* CURRENT_PACKAGE_KEY */
138+#ifndef CURRENT_COMPONENT_ID
139+#define CURRENT_COMPONENT_ID "laop-0.1.0.0-inplace"
140+#endif /* CURRENT_COMPONENT_ID */
141+#ifndef CURRENT_PACKAGE_VERSION
142+#define CURRENT_PACKAGE_VERSION "0.1.0.0"
143+#endif /* CURRENT_PACKAGE_VERSION */
build/x86_64-linux/ghc-8.6.5/laop-0.1.0.0/cache/confignew file

Binary file not shown.

build/x86_64-linux/ghc-8.6.5/laop-0.1.0.0/doc/html/laop-0.1.0.0-docs/Dist.htmlnew file+15
@@ -0,0 +1,15 @@
1+<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"><html xmlns="http://www.w3.org/1999/xhtml"><head><meta http-equiv="Content-Type" content="text/html; charset=UTF-8" /><title>Dist</title><link href="ocean.css" rel="stylesheet" type="text/css" title="Ocean" /><link rel="stylesheet" type="text/css" href="quick-jump.css" /><script src="haddock-bundle.min.js" async="async" type="text/javascript"></script><script src="https://cdnjs.cloudflare.com/ajax/libs/mathjax/2.7.0/MathJax.js?config=TeX-AMS-MML_HTMLorMML" type="text/javascript"></script></head><body><div id="package-header"><ul class="links" id="page-menu"><li><a href="src/Dist.html">Source</a></li><li><a href="/package/laop-0.1.0.0">Contents</a></li><li><a href="doc-index.html">Index</a></li></ul><p class="caption">laop-0.1.0.0: An inductive matrix definition library &#224; la LAoP</p></div><div id="content"><div id="module-header"><table class="info"><tr><th valign="top">Copyright</th><td>(c) Armando Santos 2019-2020</td></tr><tr><th>Maintainer</th><td>armandoifsantos@gmail.com</td></tr><tr><th>Stability</th><td>experimental</td></tr><tr><th>Safe Haskell</th><td>None</td></tr><tr><th>Language</th><td>Haskell2010</td></tr></table><p class="caption">Dist</p></div><div id="table-of-contents"><p class="caption">Contents</p><ul><li><a href="#g:1"><code>Dist</code> and <code>Prob</code> type synonyms</a></li><li><a href="#g:2">Functor instance equivalent functions</a></li><li><a href="#g:3">Applicative equivalent functions</a></li><li><a href="#g:4">Selective equivalent functions</a></li><li><a href="#g:5">Monad equivalent functions</a></li><li><a href="#g:6">Distribution construction functions</a></li><li><a href="#g:7">Converto to list of pairs</a></li><li><a href="#g:8">Pretty print distribution</a></li></ul></div><div id="description"><p class="caption">Description</p><div class="doc"><p><strong>LAoP</strong> is a library for algebraic (inductive) construction and manipulation of matrices
2+ in Haskell. See <a href="https://github.com/bolt12/master-thesis">my Msc Thesis</a> for the
3+ motivation behind the library, the underlying theory, and implementation details.</p><p>This module exports a type synonym <code><a href="Dist.html#t:Dist" title="Dist">Dist</a></code>
4+ that represents a stochastic distribution
5+ matrix and several distribution construction
6+ functions.</p></div></div><div id="synopsis"><details id="syn"><summary>Synopsis</summary><ul class="details-toggle" data-details-id="syn"><li class="src short"><span class="keyword">newtype</span> <a href="#t:Dist">Dist</a> a = <a href="#v:D">D</a> (<a href="Matrix-Type.html#t:Matrix" title="Matrix.Type">Matrix</a> <a href="Dist.html#t:Prob" title="Dist">Prob</a> () a)</li><li class="src short"><span class="keyword">type</span> <a href="#t:Prob">Prob</a> = <a href="/package/base-4.12.0.0/docs/Prelude.html#t:Double" title="Prelude">Double</a></li><li class="src short"><a href="#v:fmapD">fmapD</a> :: (<a href="/package/base-4.12.0.0/docs/Prelude.html#t:Bounded" title="Prelude">Bounded</a> a, <a href="/package/base-4.12.0.0/docs/Prelude.html#t:Bounded" title="Prelude">Bounded</a> b, <a href="/package/base-4.12.0.0/docs/Prelude.html#t:Enum" title="Prelude">Enum</a> a, <a href="/package/base-4.12.0.0/docs/Prelude.html#t:Enum" title="Prelude">Enum</a> b, <a href="/package/base-4.12.0.0/docs/Data-Eq.html#t:Eq" title="Data.Eq">Eq</a> b, <a href="/package/base-4.12.0.0/docs/GHC-TypeNats.html#t:KnownNat" title="GHC.TypeNats">KnownNat</a> (<a href="Matrix-Type.html#t:Count" title="Matrix.Type">Count</a> (<a href="Matrix-Type.html#t:Normalize" title="Matrix.Type">Normalize</a> a)), <a href="/package/base-4.12.0.0/docs/GHC-TypeNats.html#t:KnownNat" title="GHC.TypeNats">KnownNat</a> (<a href="Matrix-Type.html#t:Count" title="Matrix.Type">Count</a> (<a href="Matrix-Type.html#t:Normalize" title="Matrix.Type">Normalize</a> b)), <a href="Matrix-Type.html#t:FromLists" title="Matrix.Type">FromLists</a> <a href="Dist.html#t:Prob" title="Dist">Prob</a> (<a href="Matrix-Type.html#t:Normalize" title="Matrix.Type">Normalize</a> b) (<a href="Matrix-Type.html#t:Normalize" title="Matrix.Type">Normalize</a> a)) =&gt; (a -&gt; b) -&gt; <a href="Dist.html#t:Dist" title="Dist">Dist</a> a -&gt; <a href="Dist.html#t:Dist" title="Dist">Dist</a> b</li><li class="src short"><a href="#v:unitD">unitD</a> :: <a href="Dist.html#t:Dist" title="Dist">Dist</a> ()</li><li class="src short"><a href="#v:multD">multD</a> :: (<a href="/package/base-4.12.0.0/docs/GHC-TypeNats.html#t:KnownNat" title="GHC.TypeNats">KnownNat</a> (<a href="Matrix-Type.html#t:Count" title="Matrix.Type">Count</a> (<a href="Matrix-Type.html#t:Normalize" title="Matrix.Type">Normalize</a> a)), <a href="/package/base-4.12.0.0/docs/GHC-TypeNats.html#t:KnownNat" title="GHC.TypeNats">KnownNat</a> (<a href="Matrix-Type.html#t:Count" title="Matrix.Type">Count</a> (<a href="Matrix-Type.html#t:Normalize" title="Matrix.Type">Normalize</a> b)), <a href="/package/base-4.12.0.0/docs/GHC-TypeNats.html#t:KnownNat" title="GHC.TypeNats">KnownNat</a> (<a href="Matrix-Type.html#t:Count" title="Matrix.Type">Count</a> (<a href="Matrix-Type.html#t:Normalize" title="Matrix.Type">Normalize</a> (a, b))), <a href="Matrix-Type.html#t:FromLists" title="Matrix.Type">FromLists</a> <a href="Dist.html#t:Prob" title="Dist">Prob</a> (<a href="Matrix-Type.html#t:Normalize" title="Matrix.Type">Normalize</a> (a, b)) (<a href="Matrix-Type.html#t:Normalize" title="Matrix.Type">Normalize</a> a), <a href="Matrix-Type.html#t:FromLists" title="Matrix.Type">FromLists</a> <a href="Dist.html#t:Prob" title="Dist">Prob</a> (<a href="Matrix-Type.html#t:Normalize" title="Matrix.Type">Normalize</a> (a, b)) (<a href="Matrix-Type.html#t:Normalize" title="Matrix.Type">Normalize</a> b), <a href="Matrix-Type.html#t:Normalize" title="Matrix.Type">Normalize</a> (a, b) ~ <a href="Matrix-Type.html#t:Normalize" title="Matrix.Type">Normalize</a> (<a href="Matrix-Type.html#t:Normalize" title="Matrix.Type">Normalize</a> a, <a href="Matrix-Type.html#t:Normalize" title="Matrix.Type">Normalize</a> b)) =&gt; <a href="Dist.html#t:Dist" title="Dist">Dist</a> a -&gt; <a href="Dist.html#t:Dist" title="Dist">Dist</a> b -&gt; <a href="Dist.html#t:Dist" title="Dist">Dist</a> (a, b)</li><li class="src short"><a href="#v:selectD">selectD</a> :: (<a href="Matrix-Type.html#t:Normalize" title="Matrix.Type">Normalize</a> (<a href="/package/base-4.12.0.0/docs/Data-Either.html#t:Either" title="Data.Either">Either</a> a b) ~ <a href="/package/base-4.12.0.0/docs/Data-Either.html#t:Either" title="Data.Either">Either</a> (<a href="Matrix-Type.html#t:Normalize" title="Matrix.Type">Normalize</a> a) (<a href="Matrix-Type.html#t:Normalize" title="Matrix.Type">Normalize</a> b), <a href="Matrix-Type.html#t:FromLists" title="Matrix.Type">FromLists</a> <a href="Dist.html#t:Prob" title="Dist">Prob</a> (<a href="Matrix-Type.html#t:Normalize" title="Matrix.Type">Normalize</a> b) (<a href="Matrix-Type.html#t:Normalize" title="Matrix.Type">Normalize</a> b), <a href="/package/base-4.12.0.0/docs/GHC-TypeNats.html#t:KnownNat" title="GHC.TypeNats">KnownNat</a> (<a href="Matrix-Type.html#t:Count" title="Matrix.Type">Count</a> (<a href="Matrix-Type.html#t:Normalize" title="Matrix.Type">Normalize</a> b))) =&gt; <a href="Dist.html#t:Dist" title="Dist">Dist</a> (<a href="/package/base-4.12.0.0/docs/Data-Either.html#t:Either" title="Data.Either">Either</a> a b) -&gt; <a href="Matrix-Type.html#t:Matrix" title="Matrix.Type">Matrix</a> <a href="Dist.html#t:Prob" title="Dist">Prob</a> a b -&gt; <a href="Dist.html#t:Dist" title="Dist">Dist</a> b</li><li class="src short"><a href="#v:returnD">returnD</a> :: <span class="keyword">forall</span> a. (<a href="/package/base-4.12.0.0/docs/Prelude.html#t:Enum" title="Prelude">Enum</a> a, <a href="Matrix-Type.html#t:FromLists" title="Matrix.Type">FromLists</a> <a href="Dist.html#t:Prob" title="Dist">Prob</a> () (<a href="Matrix-Type.html#t:Normalize" title="Matrix.Type">Normalize</a> a), <a href="/package/base-4.12.0.0/docs/GHC-TypeNats.html#t:KnownNat" title="GHC.TypeNats">KnownNat</a> (<a href="Matrix-Type.html#t:Count" title="Matrix.Type">Count</a> a)) =&gt; a -&gt; <a href="Dist.html#t:Dist" title="Dist">Dist</a> a</li><li class="src short"><a href="#v:bindD">bindD</a> :: <a href="Dist.html#t:Dist" title="Dist">Dist</a> a -&gt; <a href="Matrix-Type.html#t:Matrix" title="Matrix.Type">Matrix</a> <a href="Dist.html#t:Prob" title="Dist">Prob</a> a b -&gt; <a href="Dist.html#t:Dist" title="Dist">Dist</a> b</li><li class="src short"><a href="#v:choose">choose</a> :: <a href="Matrix-Type.html#t:FromLists" title="Matrix.Type">FromLists</a> <a href="Dist.html#t:Prob" title="Dist">Prob</a> () (<a href="Matrix-Type.html#t:Normalize" title="Matrix.Type">Normalize</a> a) =&gt; <a href="Dist.html#t:Prob" title="Dist">Prob</a> -&gt; <a href="Dist.html#t:Dist" title="Dist">Dist</a> a</li><li class="src short"><a href="#v:shape">shape</a> :: <a href="Matrix-Type.html#t:FromLists" title="Matrix.Type">FromLists</a> <a href="Dist.html#t:Prob" title="Dist">Prob</a> () (<a href="Matrix-Type.html#t:Normalize" title="Matrix.Type">Normalize</a> a) =&gt; (<a href="Dist.html#t:Prob" title="Dist">Prob</a> -&gt; <a href="Dist.html#t:Prob" title="Dist">Prob</a>) -&gt; [a] -&gt; <a href="Dist.html#t:Dist" title="Dist">Dist</a> a</li><li class="src short"><a href="#v:linear">linear</a> :: <a href="Matrix-Type.html#t:FromLists" title="Matrix.Type">FromLists</a> <a href="Dist.html#t:Prob" title="Dist">Prob</a> () (<a href="Matrix-Type.html#t:Normalize" title="Matrix.Type">Normalize</a> a) =&gt; [a] -&gt; <a href="Dist.html#t:Dist" title="Dist">Dist</a> a</li><li class="src short"><a href="#v:uniform">uniform</a> :: <a href="Matrix-Type.html#t:FromLists" title="Matrix.Type">FromLists</a> <a href="Dist.html#t:Prob" title="Dist">Prob</a> () (<a href="Matrix-Type.html#t:Normalize" title="Matrix.Type">Normalize</a> a) =&gt; [a] -&gt; <a href="Dist.html#t:Dist" title="Dist">Dist</a> a</li><li class="src short"><a href="#v:negExp">negExp</a> :: <a href="Matrix-Type.html#t:FromLists" title="Matrix.Type">FromLists</a> <a href="Dist.html#t:Prob" title="Dist">Prob</a> () (<a href="Matrix-Type.html#t:Normalize" title="Matrix.Type">Normalize</a> a) =&gt; [a] -&gt; <a href="Dist.html#t:Dist" title="Dist">Dist</a> a</li><li class="src short"><a href="#v:normal">normal</a> :: <a href="Matrix-Type.html#t:FromLists" title="Matrix.Type">FromLists</a> <a href="Dist.html#t:Prob" title="Dist">Prob</a> () (<a href="Matrix-Type.html#t:Normalize" title="Matrix.Type">Normalize</a> a) =&gt; [a] -&gt; <a href="Dist.html#t:Dist" title="Dist">Dist</a> a</li><li class="src short"><a href="#v:toValues">toValues</a> :: <span class="keyword">forall</span> a. (<a href="/package/base-4.12.0.0/docs/Prelude.html#t:Enum" title="Prelude">Enum</a> a, <a href="/package/base-4.12.0.0/docs/GHC-TypeNats.html#t:KnownNat" title="GHC.TypeNats">KnownNat</a> (<a href="Matrix-Type.html#t:Count" title="Matrix.Type">Count</a> a), <a href="Matrix-Type.html#t:FromLists" title="Matrix.Type">FromLists</a> <a href="Dist.html#t:Prob" title="Dist">Prob</a> () (<a href="Matrix-Type.html#t:Normalize" title="Matrix.Type">Normalize</a> a)) =&gt; <a href="Dist.html#t:Dist" title="Dist">Dist</a> a -&gt; [(a, <a href="Dist.html#t:Prob" title="Dist">Prob</a>)]</li><li class="src short"><a href="#v:prettyDist">prettyDist</a> :: <span class="keyword">forall</span> a. (<a href="/package/base-4.12.0.0/docs/Text-Show.html#t:Show" title="Text.Show">Show</a> a, <a href="/package/base-4.12.0.0/docs/Prelude.html#t:Enum" title="Prelude">Enum</a> a, <a href="/package/base-4.12.0.0/docs/GHC-TypeNats.html#t:KnownNat" title="GHC.TypeNats">KnownNat</a> (<a href="Matrix-Type.html#t:Count" title="Matrix.Type">Count</a> a), <a href="Matrix-Type.html#t:FromLists" title="Matrix.Type">FromLists</a> <a href="Dist.html#t:Prob" title="Dist">Prob</a> () (<a href="Matrix-Type.html#t:Normalize" title="Matrix.Type">Normalize</a> a)) =&gt; <a href="Dist.html#t:Dist" title="Dist">Dist</a> a -&gt; <a href="/package/base-4.12.0.0/docs/Data-String.html#t:String" title="Data.String">String</a></li><li class="src short"><a href="#v:prettyPrintDist">prettyPrintDist</a> :: <span class="keyword">forall</span> a. (<a href="/package/base-4.12.0.0/docs/Text-Show.html#t:Show" title="Text.Show">Show</a> a, <a href="/package/base-4.12.0.0/docs/Prelude.html#t:Enum" title="Prelude">Enum</a> a, <a href="/package/base-4.12.0.0/docs/GHC-TypeNats.html#t:KnownNat" title="GHC.TypeNats">KnownNat</a> (<a href="Matrix-Type.html#t:Count" title="Matrix.Type">Count</a> a), <a href="Matrix-Type.html#t:FromLists" title="Matrix.Type">FromLists</a> <a href="Dist.html#t:Prob" title="Dist">Prob</a> () (<a href="Matrix-Type.html#t:Normalize" title="Matrix.Type">Normalize</a> a)) =&gt; <a href="Dist.html#t:Dist" title="Dist">Dist</a> a -&gt; <a href="/package/base-4.12.0.0/docs/System-IO.html#t:IO" title="System.IO">IO</a> ()</li></ul></details></div><div id="interface"><h1>Documentation</h1><div class="doc"><p>If the sum of the rows of a column matrix
7+ is equal to 1 then this stochastic matrix
8+ can be seen as a probability distribution.</p><p>This module is still experimental but it's
9+ already possible to model probabilistic programming
10+ problems with it. Import <code><a href="Matrix.html#v:Nat" title="Matrix">Nat</a></code> or <code><a href="Matrix.html#v:Type" title="Matrix">Type</a></code>
11+ to access LAoP matrix combinators and then all you have
12+ to do is to define your sample space, either by creating a new data
13+ type or by abstracting it out via <code>Natural</code>.</p><p>Write manipulation functions and promote them to matrices via
14+ <code>fromF</code> or <code>fromF'</code> and you're good to go!</p></div><a href="#g:1" id="g:1"><h1><code><a href="Dist.html#t:Dist" title="Dist">Dist</a></code> and <code><a href="Dist.html#t:Prob" title="Dist">Prob</a></code> type synonyms</h1></a><div class="top"><p class="src"><span class="keyword">newtype</span> <a id="t:Dist" class="def">Dist</a> a <a href="src/Dist.Internal.html#Dist" class="link">Source</a> <a href="#t:Dist" class="selflink">#</a></p><div class="doc"><p>Type synonym for column vector matrices. This represents a probability
15+ distribution.</p></div><div class="subs constructors"><p class="caption">Constructors</p><table><tr><td class="src"><a id="v:D" class="def">D</a> (<a href="Matrix-Type.html#t:Matrix" title="Matrix.Type">Matrix</a> <a href="Dist.html#t:Prob" title="Dist">Prob</a> () a)</td><td class="doc empty">&nbsp;</td></tr></table></div></div><div class="top"><p class="src"><span class="keyword">type</span> <a id="t:Prob" class="def">Prob</a> = <a href="/package/base-4.12.0.0/docs/Prelude.html#t:Double" title="Prelude">Double</a> <a href="src/Dist.Internal.html#Prob" class="link">Source</a> <a href="#t:Prob" class="selflink">#</a></p><div class="doc"><p>Type synonym for probability value</p></div></div><a href="#g:2" id="g:2"><h1>Functor instance equivalent functions</h1></a><div class="top"><p class="src"><a id="v:fmapD" class="def">fmapD</a> :: (<a href="/package/base-4.12.0.0/docs/Prelude.html#t:Bounded" title="Prelude">Bounded</a> a, <a href="/package/base-4.12.0.0/docs/Prelude.html#t:Bounded" title="Prelude">Bounded</a> b, <a href="/package/base-4.12.0.0/docs/Prelude.html#t:Enum" title="Prelude">Enum</a> a, <a href="/package/base-4.12.0.0/docs/Prelude.html#t:Enum" title="Prelude">Enum</a> b, <a href="/package/base-4.12.0.0/docs/Data-Eq.html#t:Eq" title="Data.Eq">Eq</a> b, <a href="/package/base-4.12.0.0/docs/GHC-TypeNats.html#t:KnownNat" title="GHC.TypeNats">KnownNat</a> (<a href="Matrix-Type.html#t:Count" title="Matrix.Type">Count</a> (<a href="Matrix-Type.html#t:Normalize" title="Matrix.Type">Normalize</a> a)), <a href="/package/base-4.12.0.0/docs/GHC-TypeNats.html#t:KnownNat" title="GHC.TypeNats">KnownNat</a> (<a href="Matrix-Type.html#t:Count" title="Matrix.Type">Count</a> (<a href="Matrix-Type.html#t:Normalize" title="Matrix.Type">Normalize</a> b)), <a href="Matrix-Type.html#t:FromLists" title="Matrix.Type">FromLists</a> <a href="Dist.html#t:Prob" title="Dist">Prob</a> (<a href="Matrix-Type.html#t:Normalize" title="Matrix.Type">Normalize</a> b) (<a href="Matrix-Type.html#t:Normalize" title="Matrix.Type">Normalize</a> a)) =&gt; (a -&gt; b) -&gt; <a href="Dist.html#t:Dist" title="Dist">Dist</a> a -&gt; <a href="Dist.html#t:Dist" title="Dist">Dist</a> b <a href="src/Dist.Internal.html#fmapD" class="link">Source</a> <a href="#v:fmapD" class="selflink">#</a></p><div class="doc"><p>Functor instance</p></div></div><a href="#g:3" id="g:3"><h1>Applicative equivalent functions</h1></a><div class="top"><p class="src"><a id="v:unitD" class="def">unitD</a> :: <a href="Dist.html#t:Dist" title="Dist">Dist</a> () <a href="src/Dist.Internal.html#unitD" class="link">Source</a> <a href="#v:unitD" class="selflink">#</a></p><div class="doc"><p>Applicative/Monoidal instance <code>unit</code> function</p></div></div><div class="top"><p class="src"><a id="v:multD" class="def">multD</a> :: (<a href="/package/base-4.12.0.0/docs/GHC-TypeNats.html#t:KnownNat" title="GHC.TypeNats">KnownNat</a> (<a href="Matrix-Type.html#t:Count" title="Matrix.Type">Count</a> (<a href="Matrix-Type.html#t:Normalize" title="Matrix.Type">Normalize</a> a)), <a href="/package/base-4.12.0.0/docs/GHC-TypeNats.html#t:KnownNat" title="GHC.TypeNats">KnownNat</a> (<a href="Matrix-Type.html#t:Count" title="Matrix.Type">Count</a> (<a href="Matrix-Type.html#t:Normalize" title="Matrix.Type">Normalize</a> b)), <a href="/package/base-4.12.0.0/docs/GHC-TypeNats.html#t:KnownNat" title="GHC.TypeNats">KnownNat</a> (<a href="Matrix-Type.html#t:Count" title="Matrix.Type">Count</a> (<a href="Matrix-Type.html#t:Normalize" title="Matrix.Type">Normalize</a> (a, b))), <a href="Matrix-Type.html#t:FromLists" title="Matrix.Type">FromLists</a> <a href="Dist.html#t:Prob" title="Dist">Prob</a> (<a href="Matrix-Type.html#t:Normalize" title="Matrix.Type">Normalize</a> (a, b)) (<a href="Matrix-Type.html#t:Normalize" title="Matrix.Type">Normalize</a> a), <a href="Matrix-Type.html#t:FromLists" title="Matrix.Type">FromLists</a> <a href="Dist.html#t:Prob" title="Dist">Prob</a> (<a href="Matrix-Type.html#t:Normalize" title="Matrix.Type">Normalize</a> (a, b)) (<a href="Matrix-Type.html#t:Normalize" title="Matrix.Type">Normalize</a> b), <a href="Matrix-Type.html#t:Normalize" title="Matrix.Type">Normalize</a> (a, b) ~ <a href="Matrix-Type.html#t:Normalize" title="Matrix.Type">Normalize</a> (<a href="Matrix-Type.html#t:Normalize" title="Matrix.Type">Normalize</a> a, <a href="Matrix-Type.html#t:Normalize" title="Matrix.Type">Normalize</a> b)) =&gt; <a href="Dist.html#t:Dist" title="Dist">Dist</a> a -&gt; <a href="Dist.html#t:Dist" title="Dist">Dist</a> b -&gt; <a href="Dist.html#t:Dist" title="Dist">Dist</a> (a, b) <a href="src/Dist.Internal.html#multD" class="link">Source</a> <a href="#v:multD" class="selflink">#</a></p><div class="doc"><p>Applicative/Monoidal instance <code>mult</code> function</p></div></div><a href="#g:4" id="g:4"><h1>Selective equivalent functions</h1></a><div class="top"><p class="src"><a id="v:selectD" class="def">selectD</a> :: (<a href="Matrix-Type.html#t:Normalize" title="Matrix.Type">Normalize</a> (<a href="/package/base-4.12.0.0/docs/Data-Either.html#t:Either" title="Data.Either">Either</a> a b) ~ <a href="/package/base-4.12.0.0/docs/Data-Either.html#t:Either" title="Data.Either">Either</a> (<a href="Matrix-Type.html#t:Normalize" title="Matrix.Type">Normalize</a> a) (<a href="Matrix-Type.html#t:Normalize" title="Matrix.Type">Normalize</a> b), <a href="Matrix-Type.html#t:FromLists" title="Matrix.Type">FromLists</a> <a href="Dist.html#t:Prob" title="Dist">Prob</a> (<a href="Matrix-Type.html#t:Normalize" title="Matrix.Type">Normalize</a> b) (<a href="Matrix-Type.html#t:Normalize" title="Matrix.Type">Normalize</a> b), <a href="/package/base-4.12.0.0/docs/GHC-TypeNats.html#t:KnownNat" title="GHC.TypeNats">KnownNat</a> (<a href="Matrix-Type.html#t:Count" title="Matrix.Type">Count</a> (<a href="Matrix-Type.html#t:Normalize" title="Matrix.Type">Normalize</a> b))) =&gt; <a href="Dist.html#t:Dist" title="Dist">Dist</a> (<a href="/package/base-4.12.0.0/docs/Data-Either.html#t:Either" title="Data.Either">Either</a> a b) -&gt; <a href="Matrix-Type.html#t:Matrix" title="Matrix.Type">Matrix</a> <a href="Dist.html#t:Prob" title="Dist">Prob</a> a b -&gt; <a href="Dist.html#t:Dist" title="Dist">Dist</a> b <a href="src/Dist.Internal.html#selectD" class="link">Source</a> <a href="#v:selectD" class="selflink">#</a></p><div class="doc"><p>Selective instance function</p></div></div><a href="#g:5" id="g:5"><h1>Monad equivalent functions</h1></a><div class="top"><p class="src"><a id="v:returnD" class="def">returnD</a> :: <span class="keyword">forall</span> a. (<a href="/package/base-4.12.0.0/docs/Prelude.html#t:Enum" title="Prelude">Enum</a> a, <a href="Matrix-Type.html#t:FromLists" title="Matrix.Type">FromLists</a> <a href="Dist.html#t:Prob" title="Dist">Prob</a> () (<a href="Matrix-Type.html#t:Normalize" title="Matrix.Type">Normalize</a> a), <a href="/package/base-4.12.0.0/docs/GHC-TypeNats.html#t:KnownNat" title="GHC.TypeNats">KnownNat</a> (<a href="Matrix-Type.html#t:Count" title="Matrix.Type">Count</a> a)) =&gt; a -&gt; <a href="Dist.html#t:Dist" title="Dist">Dist</a> a <a href="src/Dist.Internal.html#returnD" class="link">Source</a> <a href="#v:returnD" class="selflink">#</a></p><div class="doc"><p>Monad instance <code><a href="/package/base-4.12.0.0/docs/Control-Monad.html#v:return" title="Control.Monad">return</a></code> function</p></div></div><div class="top"><p class="src"><a id="v:bindD" class="def">bindD</a> :: <a href="Dist.html#t:Dist" title="Dist">Dist</a> a -&gt; <a href="Matrix-Type.html#t:Matrix" title="Matrix.Type">Matrix</a> <a href="Dist.html#t:Prob" title="Dist">Prob</a> a b -&gt; <a href="Dist.html#t:Dist" title="Dist">Dist</a> b <a href="src/Dist.Internal.html#bindD" class="link">Source</a> <a href="#v:bindD" class="selflink">#</a></p><div class="doc"><p>Monad instance '(&gt;&gt;=)' function</p></div></div><a href="#g:6" id="g:6"><h1>Distribution construction functions</h1></a><div class="top"><p class="src"><a id="v:choose" class="def">choose</a> :: <a href="Matrix-Type.html#t:FromLists" title="Matrix.Type">FromLists</a> <a href="Dist.html#t:Prob" title="Dist">Prob</a> () (<a href="Matrix-Type.html#t:Normalize" title="Matrix.Type">Normalize</a> a) =&gt; <a href="Dist.html#t:Prob" title="Dist">Prob</a> -&gt; <a href="Dist.html#t:Dist" title="Dist">Dist</a> a <a href="src/Dist.Internal.html#choose" class="link">Source</a> <a href="#v:choose" class="selflink">#</a></p><div class="doc"><p>Constructs a Bernoulli distribution</p></div></div><div class="top"><p class="src"><a id="v:shape" class="def">shape</a> :: <a href="Matrix-Type.html#t:FromLists" title="Matrix.Type">FromLists</a> <a href="Dist.html#t:Prob" title="Dist">Prob</a> () (<a href="Matrix-Type.html#t:Normalize" title="Matrix.Type">Normalize</a> a) =&gt; (<a href="Dist.html#t:Prob" title="Dist">Prob</a> -&gt; <a href="Dist.html#t:Prob" title="Dist">Prob</a>) -&gt; [a] -&gt; <a href="Dist.html#t:Dist" title="Dist">Dist</a> a <a href="src/Dist.Internal.html#shape" class="link">Source</a> <a href="#v:shape" class="selflink">#</a></p><div class="doc"><p>Creates a distribution given a shape function</p></div></div><div class="top"><p class="src"><a id="v:linear" class="def">linear</a> :: <a href="Matrix-Type.html#t:FromLists" title="Matrix.Type">FromLists</a> <a href="Dist.html#t:Prob" title="Dist">Prob</a> () (<a href="Matrix-Type.html#t:Normalize" title="Matrix.Type">Normalize</a> a) =&gt; [a] -&gt; <a href="Dist.html#t:Dist" title="Dist">Dist</a> a <a href="src/Dist.Internal.html#linear" class="link">Source</a> <a href="#v:linear" class="selflink">#</a></p><div class="doc"><p>Constructs a Linear distribution</p></div></div><div class="top"><p class="src"><a id="v:uniform" class="def">uniform</a> :: <a href="Matrix-Type.html#t:FromLists" title="Matrix.Type">FromLists</a> <a href="Dist.html#t:Prob" title="Dist">Prob</a> () (<a href="Matrix-Type.html#t:Normalize" title="Matrix.Type">Normalize</a> a) =&gt; [a] -&gt; <a href="Dist.html#t:Dist" title="Dist">Dist</a> a <a href="src/Dist.Internal.html#uniform" class="link">Source</a> <a href="#v:uniform" class="selflink">#</a></p><div class="doc"><p>Constructs an Uniform distribution</p></div></div><div class="top"><p class="src"><a id="v:negExp" class="def">negExp</a> :: <a href="Matrix-Type.html#t:FromLists" title="Matrix.Type">FromLists</a> <a href="Dist.html#t:Prob" title="Dist">Prob</a> () (<a href="Matrix-Type.html#t:Normalize" title="Matrix.Type">Normalize</a> a) =&gt; [a] -&gt; <a href="Dist.html#t:Dist" title="Dist">Dist</a> a <a href="src/Dist.Internal.html#negExp" class="link">Source</a> <a href="#v:negExp" class="selflink">#</a></p><div class="doc"><p>Constructs an Negative Exponential distribution</p></div></div><div class="top"><p class="src"><a id="v:normal" class="def">normal</a> :: <a href="Matrix-Type.html#t:FromLists" title="Matrix.Type">FromLists</a> <a href="Dist.html#t:Prob" title="Dist">Prob</a> () (<a href="Matrix-Type.html#t:Normalize" title="Matrix.Type">Normalize</a> a) =&gt; [a] -&gt; <a href="Dist.html#t:Dist" title="Dist">Dist</a> a <a href="src/Dist.Internal.html#normal" class="link">Source</a> <a href="#v:normal" class="selflink">#</a></p><div class="doc"><p>Constructs an Normal distribution</p></div></div><a href="#g:7" id="g:7"><h1>Converto to list of pairs</h1></a><div class="top"><p class="src"><a id="v:toValues" class="def">toValues</a> :: <span class="keyword">forall</span> a. (<a href="/package/base-4.12.0.0/docs/Prelude.html#t:Enum" title="Prelude">Enum</a> a, <a href="/package/base-4.12.0.0/docs/GHC-TypeNats.html#t:KnownNat" title="GHC.TypeNats">KnownNat</a> (<a href="Matrix-Type.html#t:Count" title="Matrix.Type">Count</a> a), <a href="Matrix-Type.html#t:FromLists" title="Matrix.Type">FromLists</a> <a href="Dist.html#t:Prob" title="Dist">Prob</a> () (<a href="Matrix-Type.html#t:Normalize" title="Matrix.Type">Normalize</a> a)) =&gt; <a href="Dist.html#t:Dist" title="Dist">Dist</a> a -&gt; [(a, <a href="Dist.html#t:Prob" title="Dist">Prob</a>)] <a href="src/Dist.Internal.html#toValues" class="link">Source</a> <a href="#v:toValues" class="selflink">#</a></p><div class="doc"><p>Transforms a <code><a href="Dist.html#t:Dist" title="Dist">Dist</a></code> into a list of pairs.</p></div></div><a href="#g:8" id="g:8"><h1>Pretty print distribution</h1></a><div class="top"><p class="src"><a id="v:prettyDist" class="def">prettyDist</a> :: <span class="keyword">forall</span> a. (<a href="/package/base-4.12.0.0/docs/Text-Show.html#t:Show" title="Text.Show">Show</a> a, <a href="/package/base-4.12.0.0/docs/Prelude.html#t:Enum" title="Prelude">Enum</a> a, <a href="/package/base-4.12.0.0/docs/GHC-TypeNats.html#t:KnownNat" title="GHC.TypeNats">KnownNat</a> (<a href="Matrix-Type.html#t:Count" title="Matrix.Type">Count</a> a), <a href="Matrix-Type.html#t:FromLists" title="Matrix.Type">FromLists</a> <a href="Dist.html#t:Prob" title="Dist">Prob</a> () (<a href="Matrix-Type.html#t:Normalize" title="Matrix.Type">Normalize</a> a)) =&gt; <a href="Dist.html#t:Dist" title="Dist">Dist</a> a -&gt; <a href="/package/base-4.12.0.0/docs/Data-String.html#t:String" title="Data.String">String</a> <a href="src/Dist.Internal.html#prettyDist" class="link">Source</a> <a href="#v:prettyDist" class="selflink">#</a></p><div class="doc"><p>Pretty a distribution</p></div></div><div class="top"><p class="src"><a id="v:prettyPrintDist" class="def">prettyPrintDist</a> :: <span class="keyword">forall</span> a. (<a href="/package/base-4.12.0.0/docs/Text-Show.html#t:Show" title="Text.Show">Show</a> a, <a href="/package/base-4.12.0.0/docs/Prelude.html#t:Enum" title="Prelude">Enum</a> a, <a href="/package/base-4.12.0.0/docs/GHC-TypeNats.html#t:KnownNat" title="GHC.TypeNats">KnownNat</a> (<a href="Matrix-Type.html#t:Count" title="Matrix.Type">Count</a> a), <a href="Matrix-Type.html#t:FromLists" title="Matrix.Type">FromLists</a> <a href="Dist.html#t:Prob" title="Dist">Prob</a> () (<a href="Matrix-Type.html#t:Normalize" title="Matrix.Type">Normalize</a> a)) =&gt; <a href="Dist.html#t:Dist" title="Dist">Dist</a> a -&gt; <a href="/package/base-4.12.0.0/docs/System-IO.html#t:IO" title="System.IO">IO</a> () <a href="src/Dist.Internal.html#prettyPrintDist" class="link">Source</a> <a href="#v:prettyPrintDist" class="selflink">#</a></p><div class="doc"><p>Pretty Print a distribution</p></div></div></div></div><div id="footer"><p>Produced by <a href="http://www.haskell.org/haddock/">Haddock</a> version 2.22.0</p></div></body></html>
build/x86_64-linux/ghc-8.6.5/laop-0.1.0.0/doc/html/laop-0.1.0.0-docs/Matrix-Nat.htmlnew file+22
@@ -0,0 +1,22 @@
1+<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"><html xmlns="http://www.w3.org/1999/xhtml"><head><meta http-equiv="Content-Type" content="text/html; charset=UTF-8" /><title>Matrix.Nat</title><link href="ocean.css" rel="stylesheet" type="text/css" title="Ocean" /><link rel="stylesheet" type="text/css" href="quick-jump.css" /><script src="haddock-bundle.min.js" async="async" type="text/javascript"></script><script src="https://cdnjs.cloudflare.com/ajax/libs/mathjax/2.7.0/MathJax.js?config=TeX-AMS-MML_HTMLorMML" type="text/javascript"></script></head><body><div id="package-header"><ul class="links" id="page-menu"><li><a href="src/Matrix.Nat.html">Source</a></li><li><a href="/package/laop-0.1.0.0">Contents</a></li><li><a href="doc-index.html">Index</a></li></ul><p class="caption">laop-0.1.0.0: An inductive matrix definition library &#224; la LAoP</p></div><div id="content"><div id="module-header"><table class="info"><tr><th valign="top">Copyright</th><td>(c) Armando Santos 2019-2020</td></tr><tr><th>Maintainer</th><td>armandoifsantos@gmail.com</td></tr><tr><th>Stability</th><td>experimental</td></tr><tr><th>Safe Haskell</th><td>None</td></tr><tr><th>Language</th><td>Haskell2010</td></tr></table><p class="caption">Matrix.Nat</p></div><div id="table-of-contents"><p class="caption">Contents</p><ul><li><a href="#g:1">Type safe matrix representation</a></li><li><a href="#g:2">Primitives</a></li><li><a href="#g:3">Auxiliary type families</a></li><li><a href="#g:4">Matrix construction and conversion</a></li><li><a href="#g:5">Misc</a><ul><li><a href="#g:6">Get dimensions</a></li><li><a href="#g:7">Matrix Transposition</a></li><li><a href="#g:8">Selective operator</a></li><li><a href="#g:9">McCarthy's Conditional</a></li><li><a href="#g:10">Matrix &quot;abiding&quot;</a></li></ul></li><li><a href="#g:11">Biproduct approach</a><ul><li><a href="#g:12">Split</a><ul><li><a href="#g:13">Projections</a></li></ul></li><li><a href="#g:14">Junc</a><ul><li><a href="#g:15">Injections</a></li></ul></li><li><a href="#g:16">Bifunctors</a></li><li><a href="#g:17">Applicative matrix combinators</a><ul><li><a href="#g:18">Matrix pairing</a></li></ul></li></ul></li><li><a href="#g:19">Matrix composition and lifting</a><ul><li><a href="#g:20">Arrow matrix combinators</a></li></ul></li><li><a href="#g:21">Matrix printing</a></li></ul></div><div id="description"><p class="caption">Description</p><div class="doc"><p>The LAoP discipline generalises relations and functions treating them as
2+ Boolean matrices and in turn consider these as arrows.</p><p><strong>LAoP</strong> is a library for algebraic (inductive) construction and manipulation of matrices
3+ in Haskell. See <a href="https://github.com/bolt12/master-thesis">my Msc Thesis</a> for the
4+ motivation behind the library, the underlying theory, and implementation details.</p><p>This module offers a newtype wrapper around <code><a href="Matrix-Type.html#v:Matrix" title="Matrix.Type">Matrix</a></code> that
5+ uses type level naturals instead of standard data types for the matrices
6+ dimensions.</p></div></div><div id="synopsis"><details id="syn"><summary>Synopsis</summary><ul class="details-toggle" data-details-id="syn"><li class="src short"><span class="keyword">newtype</span> <a href="#t:Matrix">Matrix</a> e (cols :: <a href="/package/base-4.12.0.0/docs/GHC-TypeNats.html#t:Nat" title="GHC.TypeNats">Nat</a>) (rows :: <a href="/package/base-4.12.0.0/docs/GHC-TypeNats.html#t:Nat" title="GHC.TypeNats">Nat</a>) = <a href="#v:M">M</a> (Matrix e (<a href="Matrix-Nat.html#t:FromNat" title="Matrix.Nat">FromNat</a> cols) (<a href="Matrix-Nat.html#t:FromNat" title="Matrix.Nat">FromNat</a> rows))</li><li class="src short"><a href="#v:empty">empty</a> :: <a href="Matrix-Nat.html#t:Matrix" title="Matrix.Nat">Matrix</a> e 0 0</li><li class="src short"><a href="#v:one">one</a> :: e -&gt; <a href="Matrix-Nat.html#t:Matrix" title="Matrix.Nat">Matrix</a> e 1 1</li><li class="src short"><a href="#v:junc">junc</a> :: <a href="Matrix-Nat.html#t:FromNat" title="Matrix.Nat">FromNat</a> cols3 ~ <a href="/package/base-4.12.0.0/docs/Data-Either.html#t:Either" title="Data.Either">Either</a> (<a href="Matrix-Nat.html#t:FromNat" title="Matrix.Nat">FromNat</a> cols1) (<a href="Matrix-Nat.html#t:FromNat" title="Matrix.Nat">FromNat</a> cols2) =&gt; <a href="Matrix-Nat.html#t:Matrix" title="Matrix.Nat">Matrix</a> e cols1 rows -&gt; <a href="Matrix-Nat.html#t:Matrix" title="Matrix.Nat">Matrix</a> e cols2 rows -&gt; <a href="Matrix-Nat.html#t:Matrix" title="Matrix.Nat">Matrix</a> e cols3 rows</li><li class="src short"><a href="#v:split">split</a> :: <a href="Matrix-Nat.html#t:FromNat" title="Matrix.Nat">FromNat</a> rows3 ~ <a href="/package/base-4.12.0.0/docs/Data-Either.html#t:Either" title="Data.Either">Either</a> (<a href="Matrix-Nat.html#t:FromNat" title="Matrix.Nat">FromNat</a> rows1) (<a href="Matrix-Nat.html#t:FromNat" title="Matrix.Nat">FromNat</a> rows2) =&gt; <a href="Matrix-Nat.html#t:Matrix" title="Matrix.Nat">Matrix</a> e cols rows1 -&gt; <a href="Matrix-Nat.html#t:Matrix" title="Matrix.Nat">Matrix</a> e cols rows2 -&gt; <a href="Matrix-Nat.html#t:Matrix" title="Matrix.Nat">Matrix</a> e cols rows3</li><li class="src short"><span class="keyword">type family</span> <a href="#t:FromNat">FromNat</a> (n :: <a href="/package/base-4.12.0.0/docs/GHC-TypeNats.html#t:Nat" title="GHC.TypeNats">Nat</a>) :: <a href="/package/base-4.12.0.0/docs/Data-Kind.html#t:Type" title="Data.Kind">Type</a> <span class="keyword">where ...</span></li><li class="src short"><span class="keyword">type family</span> <a href="#t:Count">Count</a> (d :: <a href="/package/base-4.12.0.0/docs/Data-Kind.html#t:Type" title="Data.Kind">Type</a>) :: <a href="/package/base-4.12.0.0/docs/GHC-TypeNats.html#t:Nat" title="GHC.TypeNats">Nat</a> <span class="keyword">where ...</span></li><li class="src short"><span class="keyword">type family</span> <a href="#t:Normalize">Normalize</a> (d :: <a href="/package/base-4.12.0.0/docs/Data-Kind.html#t:Type" title="Data.Kind">Type</a>) :: <a href="/package/base-4.12.0.0/docs/Data-Kind.html#t:Type" title="Data.Kind">Type</a> <span class="keyword">where ...</span></li><li class="src short"><span class="keyword">class</span> <a href="#t:FromLists">FromLists</a> e cols rows</li><li class="src short"><a href="#v:fromLists">fromLists</a> :: <a href="Matrix-Nat.html#t:FromLists" title="Matrix.Nat">FromLists</a> e (<a href="Matrix-Nat.html#t:FromNat" title="Matrix.Nat">FromNat</a> cols) (<a href="Matrix-Nat.html#t:FromNat" title="Matrix.Nat">FromNat</a> rows) =&gt; [[e]] -&gt; <a href="Matrix-Nat.html#t:Matrix" title="Matrix.Nat">Matrix</a> e cols rows</li><li class="src short"><a href="#v:toLists">toLists</a> :: <a href="Matrix-Nat.html#t:Matrix" title="Matrix.Nat">Matrix</a> e cols rows -&gt; [[e]]</li><li class="src short"><a href="#v:toList">toList</a> :: <a href="Matrix-Nat.html#t:Matrix" title="Matrix.Nat">Matrix</a> e cols rows -&gt; [e]</li><li class="src short"><a href="#v:matrixBuilder">matrixBuilder</a> :: (<a href="Matrix-Nat.html#t:FromLists" title="Matrix.Nat">FromLists</a> e (<a href="Matrix-Nat.html#t:FromNat" title="Matrix.Nat">FromNat</a> cols) (<a href="Matrix-Nat.html#t:FromNat" title="Matrix.Nat">FromNat</a> rows), <a href="/package/base-4.12.0.0/docs/GHC-TypeNats.html#t:KnownNat" title="GHC.TypeNats">KnownNat</a> (<a href="Matrix-Nat.html#t:Count" title="Matrix.Nat">Count</a> (<a href="Matrix-Nat.html#t:FromNat" title="Matrix.Nat">FromNat</a> cols)), <a href="/package/base-4.12.0.0/docs/GHC-TypeNats.html#t:KnownNat" title="GHC.TypeNats">KnownNat</a> (<a href="Matrix-Nat.html#t:Count" title="Matrix.Nat">Count</a> (<a href="Matrix-Nat.html#t:FromNat" title="Matrix.Nat">FromNat</a> rows))) =&gt; ((<a href="/package/base-4.12.0.0/docs/Data-Int.html#t:Int" title="Data.Int">Int</a>, <a href="/package/base-4.12.0.0/docs/Data-Int.html#t:Int" title="Data.Int">Int</a>) -&gt; e) -&gt; <a href="Matrix-Nat.html#t:Matrix" title="Matrix.Nat">Matrix</a> e cols rows</li><li class="src short"><a href="#v:row">row</a> :: <a href="Matrix-Nat.html#t:FromLists" title="Matrix.Nat">FromLists</a> e (<a href="Matrix-Nat.html#t:FromNat" title="Matrix.Nat">FromNat</a> cols) () =&gt; [e] -&gt; <a href="Matrix-Nat.html#t:Matrix" title="Matrix.Nat">Matrix</a> e cols 1</li><li class="src short"><a href="#v:col">col</a> :: <a href="Matrix-Nat.html#t:FromLists" title="Matrix.Nat">FromLists</a> e () (<a href="Matrix-Nat.html#t:FromNat" title="Matrix.Nat">FromNat</a> rows) =&gt; [e] -&gt; <a href="Matrix-Nat.html#t:Matrix" title="Matrix.Nat">Matrix</a> e 1 rows</li><li class="src short"><a href="#v:zeros">zeros</a> :: (<a href="/package/base-4.12.0.0/docs/Prelude.html#t:Num" title="Prelude">Num</a> e, <a href="Matrix-Nat.html#t:FromLists" title="Matrix.Nat">FromLists</a> e (<a href="Matrix-Nat.html#t:FromNat" title="Matrix.Nat">FromNat</a> cols) (<a href="Matrix-Nat.html#t:FromNat" title="Matrix.Nat">FromNat</a> rows), <a href="/package/base-4.12.0.0/docs/GHC-TypeNats.html#t:KnownNat" title="GHC.TypeNats">KnownNat</a> (<a href="Matrix-Nat.html#t:Count" title="Matrix.Nat">Count</a> (<a href="Matrix-Nat.html#t:FromNat" title="Matrix.Nat">FromNat</a> cols)), <a href="/package/base-4.12.0.0/docs/GHC-TypeNats.html#t:KnownNat" title="GHC.TypeNats">KnownNat</a> (<a href="Matrix-Nat.html#t:Count" title="Matrix.Nat">Count</a> (<a href="Matrix-Nat.html#t:FromNat" title="Matrix.Nat">FromNat</a> rows))) =&gt; <a href="Matrix-Nat.html#t:Matrix" title="Matrix.Nat">Matrix</a> e cols rows</li><li class="src short"><a href="#v:ones">ones</a> :: (<a href="/package/base-4.12.0.0/docs/Prelude.html#t:Num" title="Prelude">Num</a> e, <a href="Matrix-Nat.html#t:FromLists" title="Matrix.Nat">FromLists</a> e (<a href="Matrix-Nat.html#t:FromNat" title="Matrix.Nat">FromNat</a> cols) (<a href="Matrix-Nat.html#t:FromNat" title="Matrix.Nat">FromNat</a> rows), <a href="/package/base-4.12.0.0/docs/GHC-TypeNats.html#t:KnownNat" title="GHC.TypeNats">KnownNat</a> (<a href="Matrix-Nat.html#t:Count" title="Matrix.Nat">Count</a> (<a href="Matrix-Nat.html#t:FromNat" title="Matrix.Nat">FromNat</a> cols)), <a href="/package/base-4.12.0.0/docs/GHC-TypeNats.html#t:KnownNat" title="GHC.TypeNats">KnownNat</a> (<a href="Matrix-Nat.html#t:Count" title="Matrix.Nat">Count</a> (<a href="Matrix-Nat.html#t:FromNat" title="Matrix.Nat">FromNat</a> rows))) =&gt; <a href="Matrix-Nat.html#t:Matrix" title="Matrix.Nat">Matrix</a> e cols rows</li><li class="src short"><a href="#v:bang">bang</a> :: <span class="keyword">forall</span> e cols. (<a href="/package/base-4.12.0.0/docs/Prelude.html#t:Num" title="Prelude">Num</a> e, <a href="/package/base-4.12.0.0/docs/Prelude.html#t:Enum" title="Prelude">Enum</a> e, <a href="Matrix-Nat.html#t:FromLists" title="Matrix.Nat">FromLists</a> e (<a href="Matrix-Nat.html#t:FromNat" title="Matrix.Nat">FromNat</a> cols) (), <a href="/package/base-4.12.0.0/docs/GHC-TypeNats.html#t:KnownNat" title="GHC.TypeNats">KnownNat</a> (<a href="Matrix-Nat.html#t:Count" title="Matrix.Nat">Count</a> (<a href="Matrix-Nat.html#t:FromNat" title="Matrix.Nat">FromNat</a> cols))) =&gt; <a href="Matrix-Nat.html#t:Matrix" title="Matrix.Nat">Matrix</a> e cols 1</li><li class="src short"><a href="#v:constant">constant</a> :: (<a href="/package/base-4.12.0.0/docs/Prelude.html#t:Num" title="Prelude">Num</a> e, <a href="Matrix-Nat.html#t:FromLists" title="Matrix.Nat">FromLists</a> e (<a href="Matrix-Nat.html#t:FromNat" title="Matrix.Nat">FromNat</a> cols) (<a href="Matrix-Nat.html#t:FromNat" title="Matrix.Nat">FromNat</a> rows), <a href="/package/base-4.12.0.0/docs/GHC-TypeNats.html#t:KnownNat" title="GHC.TypeNats">KnownNat</a> (<a href="Matrix-Nat.html#t:Count" title="Matrix.Nat">Count</a> (<a href="Matrix-Nat.html#t:FromNat" title="Matrix.Nat">FromNat</a> cols)), <a href="/package/base-4.12.0.0/docs/GHC-TypeNats.html#t:KnownNat" title="GHC.TypeNats">KnownNat</a> (<a href="Matrix-Nat.html#t:Count" title="Matrix.Nat">Count</a> (<a href="Matrix-Nat.html#t:FromNat" title="Matrix.Nat">FromNat</a> rows))) =&gt; e -&gt; <a href="Matrix-Nat.html#t:Matrix" title="Matrix.Nat">Matrix</a> e cols rows</li><li class="src short"><a href="#v:columns">columns</a> :: <a href="/package/base-4.12.0.0/docs/GHC-TypeNats.html#t:KnownNat" title="GHC.TypeNats">KnownNat</a> (<a href="Matrix-Nat.html#t:Count" title="Matrix.Nat">Count</a> (<a href="Matrix-Nat.html#t:FromNat" title="Matrix.Nat">FromNat</a> cols)) =&gt; <a href="Matrix-Nat.html#t:Matrix" title="Matrix.Nat">Matrix</a> e cols rows -&gt; <a href="/package/base-4.12.0.0/docs/Data-Int.html#t:Int" title="Data.Int">Int</a></li><li class="src short"><a href="#v:rows">rows</a> :: <a href="/package/base-4.12.0.0/docs/GHC-TypeNats.html#t:KnownNat" title="GHC.TypeNats">KnownNat</a> (<a href="Matrix-Nat.html#t:Count" title="Matrix.Nat">Count</a> (<a href="Matrix-Nat.html#t:FromNat" title="Matrix.Nat">FromNat</a> rows)) =&gt; <a href="Matrix-Nat.html#t:Matrix" title="Matrix.Nat">Matrix</a> e cols rows -&gt; <a href="/package/base-4.12.0.0/docs/Data-Int.html#t:Int" title="Data.Int">Int</a></li><li class="src short"><a href="#v:tr">tr</a> :: <a href="Matrix-Nat.html#t:Matrix" title="Matrix.Nat">Matrix</a> e cols rows -&gt; <a href="Matrix-Nat.html#t:Matrix" title="Matrix.Nat">Matrix</a> e rows cols</li><li class="src short"><a href="#v:select">select</a> :: (<a href="/package/base-4.12.0.0/docs/Prelude.html#t:Num" title="Prelude">Num</a> e, <a href="Matrix-Nat.html#t:FromLists" title="Matrix.Nat">FromLists</a> e (<a href="Matrix-Nat.html#t:FromNat" title="Matrix.Nat">FromNat</a> rows1) (<a href="Matrix-Nat.html#t:FromNat" title="Matrix.Nat">FromNat</a> rows1), <a href="/package/base-4.12.0.0/docs/GHC-TypeNats.html#t:KnownNat" title="GHC.TypeNats">KnownNat</a> (<a href="Matrix-Nat.html#t:Count" title="Matrix.Nat">Count</a> (<a href="Matrix-Nat.html#t:FromNat" title="Matrix.Nat">FromNat</a> rows1)), <a href="Matrix-Nat.html#t:FromNat" title="Matrix.Nat">FromNat</a> rows2 ~ <a href="Matrix-Nat.html#t:FromNat" title="Matrix.Nat">FromNat</a> rows1, <a href="Matrix-Nat.html#t:FromNat" title="Matrix.Nat">FromNat</a> cols1 ~ <a href="Matrix-Nat.html#t:FromNat" title="Matrix.Nat">FromNat</a> cols2, <a href="Matrix-Nat.html#t:FromNat" title="Matrix.Nat">FromNat</a> rows3 ~ <a href="/package/base-4.12.0.0/docs/Data-Either.html#t:Either" title="Data.Either">Either</a> (<a href="Matrix-Nat.html#t:FromNat" title="Matrix.Nat">FromNat</a> cols3) (<a href="Matrix-Nat.html#t:FromNat" title="Matrix.Nat">FromNat</a> rows1)) =&gt; <a href="Matrix-Nat.html#t:Matrix" title="Matrix.Nat">Matrix</a> e cols1 rows3 -&gt; <a href="Matrix-Nat.html#t:Matrix" title="Matrix.Nat">Matrix</a> e cols3 rows1 -&gt; <a href="Matrix-Nat.html#t:Matrix" title="Matrix.Nat">Matrix</a> e cols2 rows2</li><li class="src short"><a href="#v:cond">cond</a> :: (<a href="Matrix-Nat.html#t:FromNat" title="Matrix.Nat">FromNat</a> (<a href="Matrix-Nat.html#t:Count" title="Matrix.Nat">Count</a> (<a href="Matrix-Nat.html#t:FromNat" title="Matrix.Nat">FromNat</a> cols)) ~ <a href="Matrix-Nat.html#t:FromNat" title="Matrix.Nat">FromNat</a> cols, <a href="/package/base-4.12.0.0/docs/GHC-TypeNats.html#t:KnownNat" title="GHC.TypeNats">KnownNat</a> (<a href="Matrix-Nat.html#t:Count" title="Matrix.Nat">Count</a> (<a href="Matrix-Nat.html#t:FromNat" title="Matrix.Nat">FromNat</a> cols)), <a href="Matrix-Nat.html#t:FromLists" title="Matrix.Nat">FromLists</a> e () (<a href="Matrix-Nat.html#t:FromNat" title="Matrix.Nat">FromNat</a> cols), <a href="Matrix-Nat.html#t:FromLists" title="Matrix.Nat">FromLists</a> e (<a href="Matrix-Nat.html#t:FromNat" title="Matrix.Nat">FromNat</a> cols) (), <a href="Matrix-Nat.html#t:FromLists" title="Matrix.Nat">FromLists</a> e (<a href="Matrix-Nat.html#t:FromNat" title="Matrix.Nat">FromNat</a> cols) (<a href="Matrix-Nat.html#t:FromNat" title="Matrix.Nat">FromNat</a> cols), <a href="/package/base-4.12.0.0/docs/Prelude.html#t:Bounded" title="Prelude">Bounded</a> a, <a href="/package/base-4.12.0.0/docs/Prelude.html#t:Enum" title="Prelude">Enum</a> a, <a href="/package/base-4.12.0.0/docs/Prelude.html#t:Num" title="Prelude">Num</a> e, <a href="/package/base-4.12.0.0/docs/Data-Ord.html#t:Ord" title="Data.Ord">Ord</a> e) =&gt; (a -&gt; <a href="/package/base-4.12.0.0/docs/Data-Bool.html#t:Bool" title="Data.Bool">Bool</a>) -&gt; <a href="Matrix-Nat.html#t:Matrix" title="Matrix.Nat">Matrix</a> e cols rows -&gt; <a href="Matrix-Nat.html#t:Matrix" title="Matrix.Nat">Matrix</a> e cols rows -&gt; <a href="Matrix-Nat.html#t:Matrix" title="Matrix.Nat">Matrix</a> e cols rows</li><li class="src short"><a href="#v:abideJS">abideJS</a> :: <a href="Matrix-Nat.html#t:Matrix" title="Matrix.Nat">Matrix</a> e cols rows -&gt; <a href="Matrix-Nat.html#t:Matrix" title="Matrix.Nat">Matrix</a> e cols rows</li><li class="src short"><a href="#v:abideSJ">abideSJ</a> :: <a href="Matrix-Nat.html#t:Matrix" title="Matrix.Nat">Matrix</a> e cols rows -&gt; <a href="Matrix-Nat.html#t:Matrix" title="Matrix.Nat">Matrix</a> e cols rows</li><li class="src short"><a href="#v:-61--61--61-">(===)</a> :: <a href="Matrix-Nat.html#t:FromNat" title="Matrix.Nat">FromNat</a> rows3 ~ <a href="/package/base-4.12.0.0/docs/Data-Either.html#t:Either" title="Data.Either">Either</a> (<a href="Matrix-Nat.html#t:FromNat" title="Matrix.Nat">FromNat</a> rows1) (<a href="Matrix-Nat.html#t:FromNat" title="Matrix.Nat">FromNat</a> rows2) =&gt; <a href="Matrix-Nat.html#t:Matrix" title="Matrix.Nat">Matrix</a> e cols rows1 -&gt; <a href="Matrix-Nat.html#t:Matrix" title="Matrix.Nat">Matrix</a> e cols rows2 -&gt; <a href="Matrix-Nat.html#t:Matrix" title="Matrix.Nat">Matrix</a> e cols rows3</li><li class="src short"><a href="#v:p1">p1</a> :: (<a href="/package/base-4.12.0.0/docs/Prelude.html#t:Num" title="Prelude">Num</a> e, <a href="/package/base-4.12.0.0/docs/GHC-TypeNats.html#t:KnownNat" title="GHC.TypeNats">KnownNat</a> (<a href="Matrix-Nat.html#t:Count" title="Matrix.Nat">Count</a> (<a href="Matrix-Nat.html#t:FromNat" title="Matrix.Nat">FromNat</a> n)), <a href="/package/base-4.12.0.0/docs/GHC-TypeNats.html#t:KnownNat" title="GHC.TypeNats">KnownNat</a> (<a href="Matrix-Nat.html#t:Count" title="Matrix.Nat">Count</a> (<a href="Matrix-Nat.html#t:FromNat" title="Matrix.Nat">FromNat</a> m)), <a href="Matrix-Nat.html#t:FromLists" title="Matrix.Nat">FromLists</a> e (<a href="Matrix-Nat.html#t:FromNat" title="Matrix.Nat">FromNat</a> n) (<a href="Matrix-Nat.html#t:FromNat" title="Matrix.Nat">FromNat</a> m), <a href="Matrix-Nat.html#t:FromLists" title="Matrix.Nat">FromLists</a> e (<a href="Matrix-Nat.html#t:FromNat" title="Matrix.Nat">FromNat</a> m) (<a href="Matrix-Nat.html#t:FromNat" title="Matrix.Nat">FromNat</a> m), <a href="Matrix-Nat.html#t:FromNat" title="Matrix.Nat">FromNat</a> (m <a href="/package/base-4.12.0.0/docs/GHC-TypeNats.html#t:-43-" title="GHC.TypeNats">+</a> n) ~ <a href="/package/base-4.12.0.0/docs/Data-Either.html#t:Either" title="Data.Either">Either</a> (<a href="Matrix-Nat.html#t:FromNat" title="Matrix.Nat">FromNat</a> m) (<a href="Matrix-Nat.html#t:FromNat" title="Matrix.Nat">FromNat</a> n)) =&gt; <a href="Matrix-Nat.html#t:Matrix" title="Matrix.Nat">Matrix</a> e (m <a href="/package/base-4.12.0.0/docs/GHC-TypeNats.html#t:-43-" title="GHC.TypeNats">+</a> n) m</li><li class="src short"><a href="#v:p2">p2</a> :: (<a href="/package/base-4.12.0.0/docs/Prelude.html#t:Num" title="Prelude">Num</a> e, <a href="/package/base-4.12.0.0/docs/GHC-TypeNats.html#t:KnownNat" title="GHC.TypeNats">KnownNat</a> (<a href="Matrix-Nat.html#t:Count" title="Matrix.Nat">Count</a> (<a href="Matrix-Nat.html#t:FromNat" title="Matrix.Nat">FromNat</a> n)), <a href="/package/base-4.12.0.0/docs/GHC-TypeNats.html#t:KnownNat" title="GHC.TypeNats">KnownNat</a> (<a href="Matrix-Nat.html#t:Count" title="Matrix.Nat">Count</a> (<a href="Matrix-Nat.html#t:FromNat" title="Matrix.Nat">FromNat</a> m)), <a href="Matrix-Nat.html#t:FromLists" title="Matrix.Nat">FromLists</a> e (<a href="Matrix-Nat.html#t:FromNat" title="Matrix.Nat">FromNat</a> m) (<a href="Matrix-Nat.html#t:FromNat" title="Matrix.Nat">FromNat</a> n), <a href="Matrix-Nat.html#t:FromLists" title="Matrix.Nat">FromLists</a> e (<a href="Matrix-Nat.html#t:FromNat" title="Matrix.Nat">FromNat</a> n) (<a href="Matrix-Nat.html#t:FromNat" title="Matrix.Nat">FromNat</a> n), <a href="Matrix-Nat.html#t:FromNat" title="Matrix.Nat">FromNat</a> (m <a href="/package/base-4.12.0.0/docs/GHC-TypeNats.html#t:-43-" title="GHC.TypeNats">+</a> n) ~ <a href="/package/base-4.12.0.0/docs/Data-Either.html#t:Either" title="Data.Either">Either</a> (<a href="Matrix-Nat.html#t:FromNat" title="Matrix.Nat">FromNat</a> m) (<a href="Matrix-Nat.html#t:FromNat" title="Matrix.Nat">FromNat</a> n)) =&gt; <a href="Matrix-Nat.html#t:Matrix" title="Matrix.Nat">Matrix</a> e (m <a href="/package/base-4.12.0.0/docs/GHC-TypeNats.html#t:-43-" title="GHC.TypeNats">+</a> n) n</li><li class="src short"><a href="#v:-124--124--124-">(|||)</a> :: <a href="Matrix-Nat.html#t:FromNat" title="Matrix.Nat">FromNat</a> cols3 ~ <a href="/package/base-4.12.0.0/docs/Data-Either.html#t:Either" title="Data.Either">Either</a> (<a href="Matrix-Nat.html#t:FromNat" title="Matrix.Nat">FromNat</a> cols1) (<a href="Matrix-Nat.html#t:FromNat" title="Matrix.Nat">FromNat</a> cols2) =&gt; <a href="Matrix-Nat.html#t:Matrix" title="Matrix.Nat">Matrix</a> e cols1 rows -&gt; <a href="Matrix-Nat.html#t:Matrix" title="Matrix.Nat">Matrix</a> e cols2 rows -&gt; <a href="Matrix-Nat.html#t:Matrix" title="Matrix.Nat">Matrix</a> e cols3 rows</li><li class="src short"><a href="#v:i1">i1</a> :: (<a href="/package/base-4.12.0.0/docs/Prelude.html#t:Num" title="Prelude">Num</a> e, <a href="/package/base-4.12.0.0/docs/GHC-TypeNats.html#t:KnownNat" title="GHC.TypeNats">KnownNat</a> (<a href="Matrix-Nat.html#t:Count" title="Matrix.Nat">Count</a> (<a href="Matrix-Nat.html#t:FromNat" title="Matrix.Nat">FromNat</a> n)), <a href="/package/base-4.12.0.0/docs/GHC-TypeNats.html#t:KnownNat" title="GHC.TypeNats">KnownNat</a> (<a href="Matrix-Nat.html#t:Count" title="Matrix.Nat">Count</a> (<a href="Matrix-Nat.html#t:FromNat" title="Matrix.Nat">FromNat</a> rows)), <a href="Matrix-Nat.html#t:FromLists" title="Matrix.Nat">FromLists</a> e (<a href="Matrix-Nat.html#t:FromNat" title="Matrix.Nat">FromNat</a> n) (<a href="Matrix-Nat.html#t:FromNat" title="Matrix.Nat">FromNat</a> rows), <a href="Matrix-Nat.html#t:FromLists" title="Matrix.Nat">FromLists</a> e (<a href="Matrix-Nat.html#t:FromNat" title="Matrix.Nat">FromNat</a> rows) (<a href="Matrix-Nat.html#t:FromNat" title="Matrix.Nat">FromNat</a> rows), <a href="Matrix-Nat.html#t:FromNat" title="Matrix.Nat">FromNat</a> (rows <a href="/package/base-4.12.0.0/docs/GHC-TypeNats.html#t:-43-" title="GHC.TypeNats">+</a> n) ~ <a href="/package/base-4.12.0.0/docs/Data-Either.html#t:Either" title="Data.Either">Either</a> (<a href="Matrix-Nat.html#t:FromNat" title="Matrix.Nat">FromNat</a> rows) (<a href="Matrix-Nat.html#t:FromNat" title="Matrix.Nat">FromNat</a> n)) =&gt; <a href="Matrix-Nat.html#t:Matrix" title="Matrix.Nat">Matrix</a> e rows (rows <a href="/package/base-4.12.0.0/docs/GHC-TypeNats.html#t:-43-" title="GHC.TypeNats">+</a> n)</li><li class="src short"><a href="#v:i2">i2</a> :: (<a href="/package/base-4.12.0.0/docs/Prelude.html#t:Num" title="Prelude">Num</a> e, <a href="/package/base-4.12.0.0/docs/GHC-TypeNats.html#t:KnownNat" title="GHC.TypeNats">KnownNat</a> (<a href="Matrix-Nat.html#t:Count" title="Matrix.Nat">Count</a> (<a href="Matrix-Nat.html#t:FromNat" title="Matrix.Nat">FromNat</a> rows)), <a href="/package/base-4.12.0.0/docs/GHC-TypeNats.html#t:KnownNat" title="GHC.TypeNats">KnownNat</a> (<a href="Matrix-Nat.html#t:Count" title="Matrix.Nat">Count</a> (<a href="Matrix-Nat.html#t:FromNat" title="Matrix.Nat">FromNat</a> m)), <a href="Matrix-Nat.html#t:FromLists" title="Matrix.Nat">FromLists</a> e (<a href="Matrix-Nat.html#t:FromNat" title="Matrix.Nat">FromNat</a> m) (<a href="Matrix-Nat.html#t:FromNat" title="Matrix.Nat">FromNat</a> rows), <a href="Matrix-Nat.html#t:FromLists" title="Matrix.Nat">FromLists</a> e (<a href="Matrix-Nat.html#t:FromNat" title="Matrix.Nat">FromNat</a> rows) (<a href="Matrix-Nat.html#t:FromNat" title="Matrix.Nat">FromNat</a> rows), <a href="Matrix-Nat.html#t:FromNat" title="Matrix.Nat">FromNat</a> (m <a href="/package/base-4.12.0.0/docs/GHC-TypeNats.html#t:-43-" title="GHC.TypeNats">+</a> rows) ~ <a href="/package/base-4.12.0.0/docs/Data-Either.html#t:Either" title="Data.Either">Either</a> (<a href="Matrix-Nat.html#t:FromNat" title="Matrix.Nat">FromNat</a> m) (<a href="Matrix-Nat.html#t:FromNat" title="Matrix.Nat">FromNat</a> rows)) =&gt; <a href="Matrix-Nat.html#t:Matrix" title="Matrix.Nat">Matrix</a> e rows (m <a href="/package/base-4.12.0.0/docs/GHC-TypeNats.html#t:-43-" title="GHC.TypeNats">+</a> rows)</li><li class="src short"><a href="#v:-45--124--45-">(-|-)</a> :: (<a href="/package/base-4.12.0.0/docs/Prelude.html#t:Num" title="Prelude">Num</a> e, <a href="/package/base-4.12.0.0/docs/GHC-TypeNats.html#t:KnownNat" title="GHC.TypeNats">KnownNat</a> (<a href="Matrix-Nat.html#t:Count" title="Matrix.Nat">Count</a> (<a href="Matrix-Nat.html#t:FromNat" title="Matrix.Nat">FromNat</a> j)), <a href="/package/base-4.12.0.0/docs/GHC-TypeNats.html#t:KnownNat" title="GHC.TypeNats">KnownNat</a> (<a href="Matrix-Nat.html#t:Count" title="Matrix.Nat">Count</a> (<a href="Matrix-Nat.html#t:FromNat" title="Matrix.Nat">FromNat</a> k)), <a href="Matrix-Nat.html#t:FromLists" title="Matrix.Nat">FromLists</a> e (<a href="Matrix-Nat.html#t:FromNat" title="Matrix.Nat">FromNat</a> k) (<a href="Matrix-Nat.html#t:FromNat" title="Matrix.Nat">FromNat</a> k), <a href="Matrix-Nat.html#t:FromLists" title="Matrix.Nat">FromLists</a> e (<a href="Matrix-Nat.html#t:FromNat" title="Matrix.Nat">FromNat</a> j) (<a href="Matrix-Nat.html#t:FromNat" title="Matrix.Nat">FromNat</a> k), <a href="Matrix-Nat.html#t:FromLists" title="Matrix.Nat">FromLists</a> e (<a href="Matrix-Nat.html#t:FromNat" title="Matrix.Nat">FromNat</a> k) (<a href="Matrix-Nat.html#t:FromNat" title="Matrix.Nat">FromNat</a> j), <a href="Matrix-Nat.html#t:FromLists" title="Matrix.Nat">FromLists</a> e (<a href="Matrix-Nat.html#t:FromNat" title="Matrix.Nat">FromNat</a> j) (<a href="Matrix-Nat.html#t:FromNat" title="Matrix.Nat">FromNat</a> j), <a href="Matrix-Nat.html#t:FromNat" title="Matrix.Nat">FromNat</a> (n <a href="/package/base-4.12.0.0/docs/GHC-TypeNats.html#t:-43-" title="GHC.TypeNats">+</a> m) ~ <a href="/package/base-4.12.0.0/docs/Data-Either.html#t:Either" title="Data.Either">Either</a> (<a href="Matrix-Nat.html#t:FromNat" title="Matrix.Nat">FromNat</a> n) (<a href="Matrix-Nat.html#t:FromNat" title="Matrix.Nat">FromNat</a> m), <a href="Matrix-Nat.html#t:FromNat" title="Matrix.Nat">FromNat</a> (k <a href="/package/base-4.12.0.0/docs/GHC-TypeNats.html#t:-43-" title="GHC.TypeNats">+</a> j) ~ <a href="/package/base-4.12.0.0/docs/Data-Either.html#t:Either" title="Data.Either">Either</a> (<a href="Matrix-Nat.html#t:FromNat" title="Matrix.Nat">FromNat</a> k) (<a href="Matrix-Nat.html#t:FromNat" title="Matrix.Nat">FromNat</a> j)) =&gt; <a href="Matrix-Nat.html#t:Matrix" title="Matrix.Nat">Matrix</a> e n k -&gt; <a href="Matrix-Nat.html#t:Matrix" title="Matrix.Nat">Matrix</a> e m j -&gt; <a href="Matrix-Nat.html#t:Matrix" title="Matrix.Nat">Matrix</a> e (n <a href="/package/base-4.12.0.0/docs/GHC-TypeNats.html#t:-43-" title="GHC.TypeNats">+</a> m) (k <a href="/package/base-4.12.0.0/docs/GHC-TypeNats.html#t:-43-" title="GHC.TypeNats">+</a> j)</li><li class="src short"><a href="#v:-62--60-">(&gt;&lt;)</a> :: <span class="keyword">forall</span> e m p n q. (<a href="/package/base-4.12.0.0/docs/Prelude.html#t:Num" title="Prelude">Num</a> e, <a href="/package/base-4.12.0.0/docs/GHC-TypeNats.html#t:KnownNat" title="GHC.TypeNats">KnownNat</a> (<a href="Matrix-Nat.html#t:Count" title="Matrix.Nat">Count</a> (<a href="Matrix-Nat.html#t:FromNat" title="Matrix.Nat">FromNat</a> m)), <a href="/package/base-4.12.0.0/docs/GHC-TypeNats.html#t:KnownNat" title="GHC.TypeNats">KnownNat</a> (<a href="Matrix-Nat.html#t:Count" title="Matrix.Nat">Count</a> (<a href="Matrix-Nat.html#t:FromNat" title="Matrix.Nat">FromNat</a> n)), <a href="/package/base-4.12.0.0/docs/GHC-TypeNats.html#t:KnownNat" title="GHC.TypeNats">KnownNat</a> (<a href="Matrix-Nat.html#t:Count" title="Matrix.Nat">Count</a> (<a href="Matrix-Nat.html#t:FromNat" title="Matrix.Nat">FromNat</a> p)), <a href="/package/base-4.12.0.0/docs/GHC-TypeNats.html#t:KnownNat" title="GHC.TypeNats">KnownNat</a> (<a href="Matrix-Nat.html#t:Count" title="Matrix.Nat">Count</a> (<a href="Matrix-Nat.html#t:FromNat" title="Matrix.Nat">FromNat</a> q)), <a href="/package/base-4.12.0.0/docs/GHC-TypeNats.html#t:KnownNat" title="GHC.TypeNats">KnownNat</a> (<a href="Matrix-Nat.html#t:Count" title="Matrix.Nat">Count</a> (<a href="Matrix-Nat.html#t:FromNat" title="Matrix.Nat">FromNat</a> (m <a href="/package/base-4.12.0.0/docs/GHC-TypeNats.html#t:-42-" title="GHC.TypeNats">*</a> n))), <a href="/package/base-4.12.0.0/docs/GHC-TypeNats.html#t:KnownNat" title="GHC.TypeNats">KnownNat</a> (<a href="Matrix-Nat.html#t:Count" title="Matrix.Nat">Count</a> (<a href="Matrix-Nat.html#t:FromNat" title="Matrix.Nat">FromNat</a> (p <a href="/package/base-4.12.0.0/docs/GHC-TypeNats.html#t:-42-" title="GHC.TypeNats">*</a> q))), <a href="Matrix-Nat.html#t:FromLists" title="Matrix.Nat">FromLists</a> e (<a href="Matrix-Nat.html#t:FromNat" title="Matrix.Nat">FromNat</a> (m <a href="/package/base-4.12.0.0/docs/GHC-TypeNats.html#t:-42-" title="GHC.TypeNats">*</a> n)) (<a href="Matrix-Nat.html#t:FromNat" title="Matrix.Nat">FromNat</a> m), <a href="Matrix-Nat.html#t:FromLists" title="Matrix.Nat">FromLists</a> e (<a href="Matrix-Nat.html#t:FromNat" title="Matrix.Nat">FromNat</a> (m <a href="/package/base-4.12.0.0/docs/GHC-TypeNats.html#t:-42-" title="GHC.TypeNats">*</a> n)) (<a href="Matrix-Nat.html#t:FromNat" title="Matrix.Nat">FromNat</a> n), <a href="Matrix-Nat.html#t:FromLists" title="Matrix.Nat">FromLists</a> e (<a href="Matrix-Nat.html#t:FromNat" title="Matrix.Nat">FromNat</a> (p <a href="/package/base-4.12.0.0/docs/GHC-TypeNats.html#t:-42-" title="GHC.TypeNats">*</a> q)) (<a href="Matrix-Nat.html#t:FromNat" title="Matrix.Nat">FromNat</a> p), <a href="Matrix-Nat.html#t:FromLists" title="Matrix.Nat">FromLists</a> e (<a href="Matrix-Nat.html#t:FromNat" title="Matrix.Nat">FromNat</a> (p <a href="/package/base-4.12.0.0/docs/GHC-TypeNats.html#t:-42-" title="GHC.TypeNats">*</a> q)) (<a href="Matrix-Nat.html#t:FromNat" title="Matrix.Nat">FromNat</a> q), <a href="Matrix-Nat.html#t:FromNat" title="Matrix.Nat">FromNat</a> (m <a href="/package/base-4.12.0.0/docs/GHC-TypeNats.html#t:-42-" title="GHC.TypeNats">*</a> n) ~ <a href="Matrix-Nat.html#t:FromNat" title="Matrix.Nat">FromNat</a> (<a href="Matrix-Nat.html#t:Count" title="Matrix.Nat">Count</a> (<a href="Matrix-Nat.html#t:FromNat" title="Matrix.Nat">FromNat</a> m) <a href="/package/base-4.12.0.0/docs/GHC-TypeNats.html#t:-42-" title="GHC.TypeNats">*</a> <a href="Matrix-Nat.html#t:Count" title="Matrix.Nat">Count</a> (<a href="Matrix-Nat.html#t:FromNat" title="Matrix.Nat">FromNat</a> n)), <a href="Matrix-Nat.html#t:FromNat" title="Matrix.Nat">FromNat</a> (p <a href="/package/base-4.12.0.0/docs/GHC-TypeNats.html#t:-42-" title="GHC.TypeNats">*</a> q) ~ <a href="Matrix-Nat.html#t:FromNat" title="Matrix.Nat">FromNat</a> (<a href="Matrix-Nat.html#t:Count" title="Matrix.Nat">Count</a> (<a href="Matrix-Nat.html#t:FromNat" title="Matrix.Nat">FromNat</a> p) <a href="/package/base-4.12.0.0/docs/GHC-TypeNats.html#t:-42-" title="GHC.TypeNats">*</a> <a href="Matrix-Nat.html#t:Count" title="Matrix.Nat">Count</a> (<a href="Matrix-Nat.html#t:FromNat" title="Matrix.Nat">FromNat</a> q))) =&gt; <a href="Matrix-Nat.html#t:Matrix" title="Matrix.Nat">Matrix</a> e m p -&gt; <a href="Matrix-Nat.html#t:Matrix" title="Matrix.Nat">Matrix</a> e n q -&gt; <a href="Matrix-Nat.html#t:Matrix" title="Matrix.Nat">Matrix</a> e (m <a href="/package/base-4.12.0.0/docs/GHC-TypeNats.html#t:-42-" title="GHC.TypeNats">*</a> n) (p <a href="/package/base-4.12.0.0/docs/GHC-TypeNats.html#t:-42-" title="GHC.TypeNats">*</a> q)</li><li class="src short"><a href="#v:kp1">kp1</a> :: <span class="keyword">forall</span> e m k. (<a href="/package/base-4.12.0.0/docs/Prelude.html#t:Num" title="Prelude">Num</a> e, <a href="/package/base-4.12.0.0/docs/GHC-TypeNats.html#t:KnownNat" title="GHC.TypeNats">KnownNat</a> (<a href="Matrix-Nat.html#t:Count" title="Matrix.Nat">Count</a> (<a href="Matrix-Nat.html#t:FromNat" title="Matrix.Nat">FromNat</a> m)), <a href="/package/base-4.12.0.0/docs/GHC-TypeNats.html#t:KnownNat" title="GHC.TypeNats">KnownNat</a> (<a href="Matrix-Nat.html#t:Count" title="Matrix.Nat">Count</a> (<a href="Matrix-Nat.html#t:FromNat" title="Matrix.Nat">FromNat</a> k)), <a href="/package/base-4.12.0.0/docs/GHC-TypeNats.html#t:KnownNat" title="GHC.TypeNats">KnownNat</a> (<a href="Matrix-Nat.html#t:Count" title="Matrix.Nat">Count</a> (<a href="Matrix-Nat.html#t:FromNat" title="Matrix.Nat">FromNat</a> (m <a href="/package/base-4.12.0.0/docs/GHC-TypeNats.html#t:-42-" title="GHC.TypeNats">*</a> k))), <a href="Matrix-Nat.html#t:FromLists" title="Matrix.Nat">FromLists</a> e (<a href="Matrix-Nat.html#t:FromNat" title="Matrix.Nat">FromNat</a> (m <a href="/package/base-4.12.0.0/docs/GHC-TypeNats.html#t:-42-" title="GHC.TypeNats">*</a> k)) (<a href="Matrix-Nat.html#t:FromNat" title="Matrix.Nat">FromNat</a> m), <a href="Matrix-Nat.html#t:FromNat" title="Matrix.Nat">FromNat</a> (m <a href="/package/base-4.12.0.0/docs/GHC-TypeNats.html#t:-42-" title="GHC.TypeNats">*</a> k) ~ <a href="Matrix-Nat.html#t:FromNat" title="Matrix.Nat">FromNat</a> (<a href="Matrix-Nat.html#t:Count" title="Matrix.Nat">Count</a> (<a href="Matrix-Nat.html#t:FromNat" title="Matrix.Nat">FromNat</a> m) <a href="/package/base-4.12.0.0/docs/GHC-TypeNats.html#t:-42-" title="GHC.TypeNats">*</a> <a href="Matrix-Nat.html#t:Count" title="Matrix.Nat">Count</a> (<a href="Matrix-Nat.html#t:FromNat" title="Matrix.Nat">FromNat</a> k))) =&gt; <a href="Matrix-Nat.html#t:Matrix" title="Matrix.Nat">Matrix</a> e (m <a href="/package/base-4.12.0.0/docs/GHC-TypeNats.html#t:-42-" title="GHC.TypeNats">*</a> k) m</li><li class="src short"><a href="#v:kp2">kp2</a> :: <span class="keyword">forall</span> e m k. (<a href="/package/base-4.12.0.0/docs/Prelude.html#t:Num" title="Prelude">Num</a> e, <a href="/package/base-4.12.0.0/docs/GHC-TypeNats.html#t:KnownNat" title="GHC.TypeNats">KnownNat</a> (<a href="Matrix-Nat.html#t:Count" title="Matrix.Nat">Count</a> (<a href="Matrix-Nat.html#t:FromNat" title="Matrix.Nat">FromNat</a> k)), <a href="Matrix-Nat.html#t:FromLists" title="Matrix.Nat">FromLists</a> e (<a href="Matrix-Nat.html#t:FromNat" title="Matrix.Nat">FromNat</a> (m <a href="/package/base-4.12.0.0/docs/GHC-TypeNats.html#t:-42-" title="GHC.TypeNats">*</a> k)) (<a href="Matrix-Nat.html#t:FromNat" title="Matrix.Nat">FromNat</a> k), <a href="/package/base-4.12.0.0/docs/GHC-TypeNats.html#t:KnownNat" title="GHC.TypeNats">KnownNat</a> (<a href="Matrix-Nat.html#t:Count" title="Matrix.Nat">Count</a> (<a href="Matrix-Nat.html#t:FromNat" title="Matrix.Nat">FromNat</a> m)), <a href="/package/base-4.12.0.0/docs/GHC-TypeNats.html#t:KnownNat" title="GHC.TypeNats">KnownNat</a> (<a href="Matrix-Nat.html#t:Count" title="Matrix.Nat">Count</a> (<a href="Matrix-Nat.html#t:FromNat" title="Matrix.Nat">FromNat</a> (m <a href="/package/base-4.12.0.0/docs/GHC-TypeNats.html#t:-42-" title="GHC.TypeNats">*</a> k))), <a href="Matrix-Nat.html#t:FromNat" title="Matrix.Nat">FromNat</a> (m <a href="/package/base-4.12.0.0/docs/GHC-TypeNats.html#t:-42-" title="GHC.TypeNats">*</a> k) ~ <a href="Matrix-Nat.html#t:FromNat" title="Matrix.Nat">FromNat</a> (<a href="Matrix-Nat.html#t:Count" title="Matrix.Nat">Count</a> (<a href="Matrix-Nat.html#t:FromNat" title="Matrix.Nat">FromNat</a> m) <a href="/package/base-4.12.0.0/docs/GHC-TypeNats.html#t:-42-" title="GHC.TypeNats">*</a> <a href="Matrix-Nat.html#t:Count" title="Matrix.Nat">Count</a> (<a href="Matrix-Nat.html#t:FromNat" title="Matrix.Nat">FromNat</a> k))) =&gt; <a href="Matrix-Nat.html#t:Matrix" title="Matrix.Nat">Matrix</a> e (m <a href="/package/base-4.12.0.0/docs/GHC-TypeNats.html#t:-42-" title="GHC.TypeNats">*</a> k) k</li><li class="src short"><a href="#v:khatri">khatri</a> :: <span class="keyword">forall</span> e cols a b. (<a href="/package/base-4.12.0.0/docs/Prelude.html#t:Num" title="Prelude">Num</a> e, <a href="/package/base-4.12.0.0/docs/GHC-TypeNats.html#t:KnownNat" title="GHC.TypeNats">KnownNat</a> (<a href="Matrix-Nat.html#t:Count" title="Matrix.Nat">Count</a> (<a href="Matrix-Nat.html#t:FromNat" title="Matrix.Nat">FromNat</a> a)), <a href="/package/base-4.12.0.0/docs/GHC-TypeNats.html#t:KnownNat" title="GHC.TypeNats">KnownNat</a> (<a href="Matrix-Nat.html#t:Count" title="Matrix.Nat">Count</a> (<a href="Matrix-Nat.html#t:FromNat" title="Matrix.Nat">FromNat</a> b)), <a href="/package/base-4.12.0.0/docs/GHC-TypeNats.html#t:KnownNat" title="GHC.TypeNats">KnownNat</a> (<a href="Matrix-Nat.html#t:Count" title="Matrix.Nat">Count</a> (<a href="Matrix-Nat.html#t:FromNat" title="Matrix.Nat">FromNat</a> (a <a href="/package/base-4.12.0.0/docs/GHC-TypeNats.html#t:-42-" title="GHC.TypeNats">*</a> b))), <a href="Matrix-Nat.html#t:FromLists" title="Matrix.Nat">FromLists</a> e (<a href="Matrix-Nat.html#t:FromNat" title="Matrix.Nat">FromNat</a> (a <a href="/package/base-4.12.0.0/docs/GHC-TypeNats.html#t:-42-" title="GHC.TypeNats">*</a> b)) (<a href="Matrix-Nat.html#t:FromNat" title="Matrix.Nat">FromNat</a> a), <a href="Matrix-Nat.html#t:FromLists" title="Matrix.Nat">FromLists</a> e (<a href="Matrix-Nat.html#t:FromNat" title="Matrix.Nat">FromNat</a> (a <a href="/package/base-4.12.0.0/docs/GHC-TypeNats.html#t:-42-" title="GHC.TypeNats">*</a> b)) (<a href="Matrix-Nat.html#t:FromNat" title="Matrix.Nat">FromNat</a> b), <a href="Matrix-Nat.html#t:FromNat" title="Matrix.Nat">FromNat</a> (a <a href="/package/base-4.12.0.0/docs/GHC-TypeNats.html#t:-42-" title="GHC.TypeNats">*</a> b) ~ <a href="Matrix-Nat.html#t:FromNat" title="Matrix.Nat">FromNat</a> (<a href="Matrix-Nat.html#t:Count" title="Matrix.Nat">Count</a> (<a href="Matrix-Nat.html#t:FromNat" title="Matrix.Nat">FromNat</a> a) <a href="/package/base-4.12.0.0/docs/GHC-TypeNats.html#t:-42-" title="GHC.TypeNats">*</a> <a href="Matrix-Nat.html#t:Count" title="Matrix.Nat">Count</a> (<a href="Matrix-Nat.html#t:FromNat" title="Matrix.Nat">FromNat</a> b))) =&gt; <a href="Matrix-Nat.html#t:Matrix" title="Matrix.Nat">Matrix</a> e cols a -&gt; <a href="Matrix-Nat.html#t:Matrix" title="Matrix.Nat">Matrix</a> e cols b -&gt; <a href="Matrix-Nat.html#t:Matrix" title="Matrix.Nat">Matrix</a> e cols (a <a href="/package/base-4.12.0.0/docs/GHC-TypeNats.html#t:-42-" title="GHC.TypeNats">*</a> b)</li><li class="src short"><a href="#v:identity">identity</a> :: (<a href="/package/base-4.12.0.0/docs/Prelude.html#t:Num" title="Prelude">Num</a> e, <a href="Matrix-Nat.html#t:FromLists" title="Matrix.Nat">FromLists</a> e (<a href="Matrix-Nat.html#t:FromNat" title="Matrix.Nat">FromNat</a> cols) (<a href="Matrix-Nat.html#t:FromNat" title="Matrix.Nat">FromNat</a> cols), <a href="/package/base-4.12.0.0/docs/GHC-TypeNats.html#t:KnownNat" title="GHC.TypeNats">KnownNat</a> (<a href="Matrix-Nat.html#t:Count" title="Matrix.Nat">Count</a> (<a href="Matrix-Nat.html#t:FromNat" title="Matrix.Nat">FromNat</a> cols))) =&gt; <a href="Matrix-Nat.html#t:Matrix" title="Matrix.Nat">Matrix</a> e cols cols</li><li class="src short"><a href="#v:comp">comp</a> :: <a href="/package/base-4.12.0.0/docs/Prelude.html#t:Num" title="Prelude">Num</a> e =&gt; <a href="Matrix-Nat.html#t:Matrix" title="Matrix.Nat">Matrix</a> e cr rows -&gt; <a href="Matrix-Nat.html#t:Matrix" title="Matrix.Nat">Matrix</a> e cols cr -&gt; <a href="Matrix-Nat.html#t:Matrix" title="Matrix.Nat">Matrix</a> e cols rows</li><li class="src short"><a href="#v:fromF">fromF</a> :: (<a href="/package/base-4.12.0.0/docs/Prelude.html#t:Bounded" title="Prelude">Bounded</a> a, <a href="/package/base-4.12.0.0/docs/Prelude.html#t:Bounded" title="Prelude">Bounded</a> b, <a href="/package/base-4.12.0.0/docs/Prelude.html#t:Enum" title="Prelude">Enum</a> a, <a href="/package/base-4.12.0.0/docs/Prelude.html#t:Enum" title="Prelude">Enum</a> b, <a href="/package/base-4.12.0.0/docs/Data-Eq.html#t:Eq" title="Data.Eq">Eq</a> b, <a href="/package/base-4.12.0.0/docs/Prelude.html#t:Num" title="Prelude">Num</a> e, <a href="/package/base-4.12.0.0/docs/Data-Ord.html#t:Ord" title="Data.Ord">Ord</a> e, <a href="/package/base-4.12.0.0/docs/GHC-TypeNats.html#t:KnownNat" title="GHC.TypeNats">KnownNat</a> (<a href="Matrix-Nat.html#t:Count" title="Matrix.Nat">Count</a> (<a href="Matrix-Nat.html#t:FromNat" title="Matrix.Nat">FromNat</a> cols)), <a href="/package/base-4.12.0.0/docs/GHC-TypeNats.html#t:KnownNat" title="GHC.TypeNats">KnownNat</a> (<a href="Matrix-Nat.html#t:Count" title="Matrix.Nat">Count</a> (<a href="Matrix-Nat.html#t:FromNat" title="Matrix.Nat">FromNat</a> rows)), <a href="Matrix-Nat.html#t:FromLists" title="Matrix.Nat">FromLists</a> e (<a href="Matrix-Nat.html#t:FromNat" title="Matrix.Nat">FromNat</a> rows) (<a href="Matrix-Nat.html#t:FromNat" title="Matrix.Nat">FromNat</a> cols)) =&gt; (a -&gt; b) -&gt; <a href="Matrix-Nat.html#t:Matrix" title="Matrix.Nat">Matrix</a> e cols rows</li><li class="src short"><a href="#v:fromF-39-">fromF'</a> :: (<a href="/package/base-4.12.0.0/docs/Prelude.html#t:Bounded" title="Prelude">Bounded</a> a, <a href="/package/base-4.12.0.0/docs/Prelude.html#t:Bounded" title="Prelude">Bounded</a> b, <a href="/package/base-4.12.0.0/docs/Prelude.html#t:Enum" title="Prelude">Enum</a> a, <a href="/package/base-4.12.0.0/docs/Prelude.html#t:Enum" title="Prelude">Enum</a> b, <a href="/package/base-4.12.0.0/docs/Data-Eq.html#t:Eq" title="Data.Eq">Eq</a> b, <a href="/package/base-4.12.0.0/docs/Prelude.html#t:Num" title="Prelude">Num</a> e, <a href="/package/base-4.12.0.0/docs/Data-Ord.html#t:Ord" title="Data.Ord">Ord</a> e, <a href="/package/base-4.12.0.0/docs/GHC-TypeNats.html#t:KnownNat" title="GHC.TypeNats">KnownNat</a> (<a href="Matrix-Nat.html#t:Count" title="Matrix.Nat">Count</a> (<a href="Matrix-Nat.html#t:Normalize" title="Matrix.Nat">Normalize</a> a)), <a href="/package/base-4.12.0.0/docs/GHC-TypeNats.html#t:KnownNat" title="GHC.TypeNats">KnownNat</a> (<a href="Matrix-Nat.html#t:Count" title="Matrix.Nat">Count</a> (<a href="Matrix-Nat.html#t:Normalize" title="Matrix.Nat">Normalize</a> b)), <a href="Matrix-Nat.html#t:FromLists" title="Matrix.Nat">FromLists</a> e (<a href="Matrix-Nat.html#t:Normalize" title="Matrix.Nat">Normalize</a> b) (<a href="Matrix-Nat.html#t:Normalize" title="Matrix.Nat">Normalize</a> a)) =&gt; (a -&gt; b) -&gt; <a href="Matrix-Nat.html#t:Matrix" title="Matrix.Nat">Matrix</a> e (<a href="Matrix-Nat.html#t:Count" title="Matrix.Nat">Count</a> a) (<a href="Matrix-Nat.html#t:Count" title="Matrix.Nat">Count</a> b)</li><li class="src short"><a href="#v:pretty">pretty</a> :: (<a href="/package/base-4.12.0.0/docs/GHC-TypeNats.html#t:KnownNat" title="GHC.TypeNats">KnownNat</a> (<a href="Matrix-Nat.html#t:Count" title="Matrix.Nat">Count</a> (<a href="Matrix-Nat.html#t:FromNat" title="Matrix.Nat">FromNat</a> cols)), <a href="/package/base-4.12.0.0/docs/Text-Show.html#t:Show" title="Text.Show">Show</a> e) =&gt; <a href="Matrix-Nat.html#t:Matrix" title="Matrix.Nat">Matrix</a> e cols rows -&gt; <a href="/package/base-4.12.0.0/docs/Data-String.html#t:String" title="Data.String">String</a></li><li class="src short"><a href="#v:prettyPrint">prettyPrint</a> :: (<a href="/package/base-4.12.0.0/docs/GHC-TypeNats.html#t:KnownNat" title="GHC.TypeNats">KnownNat</a> (<a href="Matrix-Nat.html#t:Count" title="Matrix.Nat">Count</a> (<a href="Matrix-Nat.html#t:FromNat" title="Matrix.Nat">FromNat</a> cols)), <a href="/package/base-4.12.0.0/docs/Text-Show.html#t:Show" title="Text.Show">Show</a> e) =&gt; <a href="Matrix-Nat.html#t:Matrix" title="Matrix.Nat">Matrix</a> e cols rows -&gt; <a href="/package/base-4.12.0.0/docs/System-IO.html#t:IO" title="System.IO">IO</a> ()</li></ul></details></div><div id="interface"><h1>Documentation</h1><div class="doc"><p>LAoP (Linear Algebra of Programming) Inductive Matrix definition.</p><p>LAoP generalises relations and functions treating them as
7+ Boolean matrices and in turn consider these as arrows.
8+ This library offers many of the combinators mentioned in the work of
9+ Macedo (2012) and Oliveira (2012).</p><p>This definition is a wrapper around <code><a href="Matrix.html#v:Type" title="Matrix">Type</a></code> but
10+ dimensions are type level Naturals. Type inference might not
11+ be as desired.</p><p>There exists two type families that make it easier to write
12+ matrix dimensions: <code>FromNat</code> and <code>Count</code>. This approach
13+ leads to a very straightforward implementation
14+ of LAoP combinators. </p></div><a href="#g:1" id="g:1"><h1>Type safe matrix representation</h1></a><div class="top"><p class="src"><span class="keyword">newtype</span> <a id="t:Matrix" class="def">Matrix</a> e (cols :: <a href="/package/base-4.12.0.0/docs/GHC-TypeNats.html#t:Nat" title="GHC.TypeNats">Nat</a>) (rows :: <a href="/package/base-4.12.0.0/docs/GHC-TypeNats.html#t:Nat" title="GHC.TypeNats">Nat</a>) <a href="src/Matrix.Nat.html#Matrix" class="link">Source</a> <a href="#t:Matrix" class="selflink">#</a></p><div class="subs constructors"><p class="caption">Constructors</p><table><tr><td class="src"><a id="v:M" class="def">M</a> (Matrix e (<a href="Matrix-Nat.html#t:FromNat" title="Matrix.Nat">FromNat</a> cols) (<a href="Matrix-Nat.html#t:FromNat" title="Matrix.Nat">FromNat</a> rows))</td><td class="doc empty">&nbsp;</td></tr></table></div><div class="subs instances"><details id="i:Matrix" open="open"><summary>Instances</summary><table><tr><td class="src clearfix"><span class="inst-left"><span class="instance details-toggle-control details-toggle" data-details-id="i:id:Matrix:Category:1"></span> <a href="/package/base-4.12.0.0/docs/Prelude.html#t:Num" title="Prelude">Num</a> e =&gt; <a href="/package/base-4.12.0.0/docs/Control-Category.html#t:Category" title="Control.Category">Category</a> (<a href="Matrix-Nat.html#t:Matrix" title="Matrix.Nat">Matrix</a> e :: <a href="/package/base-4.12.0.0/docs/GHC-TypeNats.html#t:Nat" title="GHC.TypeNats">Nat</a> -&gt; <a href="/package/base-4.12.0.0/docs/GHC-TypeNats.html#t:Nat" title="GHC.TypeNats">Nat</a> -&gt; <a href="/package/base-4.12.0.0/docs/Data-Kind.html#t:Type" title="Data.Kind">Type</a>)</span> <a href="src/Matrix.Nat.html#line-155" class="link">Source</a> <a href="#t:Matrix" class="selflink">#</a></td><td class="doc"><p>It isn't possible to implement the <code><a href="/package/base-4.12.0.0/docs/Data-Function.html#v:id" title="Data.Function">id</a></code> function so it's
15+ implementation is <code><a href="/package/base-4.12.0.0/docs/Prelude.html#v:undefined" title="Prelude">undefined</a></code>. However <code><a href="Matrix-Nat.html#v:comp" title="Matrix.Nat">comp</a></code> can be and this partial
16+ class implementation exists just to make the code more readable.</p><p>Please use <code><a href="Matrix-Nat.html#v:identity" title="Matrix.Nat">identity</a></code> instead.</p></td></tr><tr><td colspan="2"><details id="i:id:Matrix:Category:1"><summary class="hide-when-js-enabled">Instance details</summary><p>Defined in <a href="Matrix-Nat.html">Matrix.Nat</a></p> <div class="subs methods"><p class="caption">Methods</p><p class="src"><a href="#v:id">id</a> :: <a href="Matrix-Nat.html#t:Matrix" title="Matrix.Nat">Matrix</a> e a a <a href="#v:id" class="selflink">#</a></p><p class="src"><a href="#v:.">(.)</a> :: <a href="Matrix-Nat.html#t:Matrix" title="Matrix.Nat">Matrix</a> e b c -&gt; <a href="Matrix-Nat.html#t:Matrix" title="Matrix.Nat">Matrix</a> e a b -&gt; <a href="Matrix-Nat.html#t:Matrix" title="Matrix.Nat">Matrix</a> e a c <a href="#v:." class="selflink">#</a></p></div></details></td></tr><tr><td class="src clearfix"><span class="inst-left"><span class="instance details-toggle-control details-toggle" data-details-id="i:id:Matrix:Eq:2"></span> <a href="/package/base-4.12.0.0/docs/Data-Eq.html#t:Eq" title="Data.Eq">Eq</a> e =&gt; <a href="/package/base-4.12.0.0/docs/Data-Eq.html#t:Eq" title="Data.Eq">Eq</a> (<a href="Matrix-Nat.html#t:Matrix" title="Matrix.Nat">Matrix</a> e cols rows)</span> <a href="src/Matrix.Nat.html#line-148" class="link">Source</a> <a href="#t:Matrix" class="selflink">#</a></td><td class="doc empty">&nbsp;</td></tr><tr><td colspan="2"><details id="i:id:Matrix:Eq:2"><summary class="hide-when-js-enabled">Instance details</summary><p>Defined in <a href="Matrix-Nat.html">Matrix.Nat</a></p> <div class="subs methods"><p class="caption">Methods</p><p class="src"><a href="#v:-61--61-">(==)</a> :: <a href="Matrix-Nat.html#t:Matrix" title="Matrix.Nat">Matrix</a> e cols rows -&gt; <a href="Matrix-Nat.html#t:Matrix" title="Matrix.Nat">Matrix</a> e cols rows -&gt; <a href="/package/base-4.12.0.0/docs/Data-Bool.html#t:Bool" title="Data.Bool">Bool</a> <a href="#v:-61--61-" class="selflink">#</a></p><p class="src"><a href="#v:-47--61-">(/=)</a> :: <a href="Matrix-Nat.html#t:Matrix" title="Matrix.Nat">Matrix</a> e cols rows -&gt; <a href="Matrix-Nat.html#t:Matrix" title="Matrix.Nat">Matrix</a> e cols rows -&gt; <a href="/package/base-4.12.0.0/docs/Data-Bool.html#t:Bool" title="Data.Bool">Bool</a> <a href="#v:-47--61-" class="selflink">#</a></p></div></details></td></tr><tr><td class="src clearfix"><span class="inst-left"><span class="instance details-toggle-control details-toggle" data-details-id="i:id:Matrix:Num:3"></span> <a href="/package/base-4.12.0.0/docs/Prelude.html#t:Num" title="Prelude">Num</a> e =&gt; <a href="/package/base-4.12.0.0/docs/Prelude.html#t:Num" title="Prelude">Num</a> (<a href="Matrix-Nat.html#t:Matrix" title="Matrix.Nat">Matrix</a> e cols rows)</span> <a href="src/Matrix.Nat.html#line-148" class="link">Source</a> <a href="#t:Matrix" class="selflink">#</a></td><td class="doc empty">&nbsp;</td></tr><tr><td colspan="2"><details id="i:id:Matrix:Num:3"><summary class="hide-when-js-enabled">Instance details</summary><p>Defined in <a href="Matrix-Nat.html">Matrix.Nat</a></p> <div class="subs methods"><p class="caption">Methods</p><p class="src"><a href="#v:-43-">(+)</a> :: <a href="Matrix-Nat.html#t:Matrix" title="Matrix.Nat">Matrix</a> e cols rows -&gt; <a href="Matrix-Nat.html#t:Matrix" title="Matrix.Nat">Matrix</a> e cols rows -&gt; <a href="Matrix-Nat.html#t:Matrix" title="Matrix.Nat">Matrix</a> e cols rows <a href="#v:-43-" class="selflink">#</a></p><p class="src"><a href="#v:-45-">(-)</a> :: <a href="Matrix-Nat.html#t:Matrix" title="Matrix.Nat">Matrix</a> e cols rows -&gt; <a href="Matrix-Nat.html#t:Matrix" title="Matrix.Nat">Matrix</a> e cols rows -&gt; <a href="Matrix-Nat.html#t:Matrix" title="Matrix.Nat">Matrix</a> e cols rows <a href="#v:-45-" class="selflink">#</a></p><p class="src"><a href="#v:-42-">(*)</a> :: <a href="Matrix-Nat.html#t:Matrix" title="Matrix.Nat">Matrix</a> e cols rows -&gt; <a href="Matrix-Nat.html#t:Matrix" title="Matrix.Nat">Matrix</a> e cols rows -&gt; <a href="Matrix-Nat.html#t:Matrix" title="Matrix.Nat">Matrix</a> e cols rows <a href="#v:-42-" class="selflink">#</a></p><p class="src"><a href="#v:negate">negate</a> :: <a href="Matrix-Nat.html#t:Matrix" title="Matrix.Nat">Matrix</a> e cols rows -&gt; <a href="Matrix-Nat.html#t:Matrix" title="Matrix.Nat">Matrix</a> e cols rows <a href="#v:negate" class="selflink">#</a></p><p class="src"><a href="#v:abs">abs</a> :: <a href="Matrix-Nat.html#t:Matrix" title="Matrix.Nat">Matrix</a> e cols rows -&gt; <a href="Matrix-Nat.html#t:Matrix" title="Matrix.Nat">Matrix</a> e cols rows <a href="#v:abs" class="selflink">#</a></p><p class="src"><a href="#v:signum">signum</a> :: <a href="Matrix-Nat.html#t:Matrix" title="Matrix.Nat">Matrix</a> e cols rows -&gt; <a href="Matrix-Nat.html#t:Matrix" title="Matrix.Nat">Matrix</a> e cols rows <a href="#v:signum" class="selflink">#</a></p><p class="src"><a href="#v:fromInteger">fromInteger</a> :: <a href="/package/base-4.12.0.0/docs/Prelude.html#t:Integer" title="Prelude">Integer</a> -&gt; <a href="Matrix-Nat.html#t:Matrix" title="Matrix.Nat">Matrix</a> e cols rows <a href="#v:fromInteger" class="selflink">#</a></p></div></details></td></tr><tr><td class="src clearfix"><span class="inst-left"><span class="instance details-toggle-control details-toggle" data-details-id="i:id:Matrix:Ord:4"></span> <a href="/package/base-4.12.0.0/docs/Data-Ord.html#t:Ord" title="Data.Ord">Ord</a> e =&gt; <a href="/package/base-4.12.0.0/docs/Data-Ord.html#t:Ord" title="Data.Ord">Ord</a> (<a href="Matrix-Nat.html#t:Matrix" title="Matrix.Nat">Matrix</a> e cols rows)</span> <a href="src/Matrix.Nat.html#line-148" class="link">Source</a> <a href="#t:Matrix" class="selflink">#</a></td><td class="doc empty">&nbsp;</td></tr><tr><td colspan="2"><details id="i:id:Matrix:Ord:4"><summary class="hide-when-js-enabled">Instance details</summary><p>Defined in <a href="Matrix-Nat.html">Matrix.Nat</a></p> <div class="subs methods"><p class="caption">Methods</p><p class="src"><a href="#v:compare">compare</a> :: <a href="Matrix-Nat.html#t:Matrix" title="Matrix.Nat">Matrix</a> e cols rows -&gt; <a href="Matrix-Nat.html#t:Matrix" title="Matrix.Nat">Matrix</a> e cols rows -&gt; <a href="/package/base-4.12.0.0/docs/Data-Ord.html#t:Ordering" title="Data.Ord">Ordering</a> <a href="#v:compare" class="selflink">#</a></p><p class="src"><a href="#v:-60-">(&lt;)</a> :: <a href="Matrix-Nat.html#t:Matrix" title="Matrix.Nat">Matrix</a> e cols rows -&gt; <a href="Matrix-Nat.html#t:Matrix" title="Matrix.Nat">Matrix</a> e cols rows -&gt; <a href="/package/base-4.12.0.0/docs/Data-Bool.html#t:Bool" title="Data.Bool">Bool</a> <a href="#v:-60-" class="selflink">#</a></p><p class="src"><a href="#v:-60--61-">(&lt;=)</a> :: <a href="Matrix-Nat.html#t:Matrix" title="Matrix.Nat">Matrix</a> e cols rows -&gt; <a href="Matrix-Nat.html#t:Matrix" title="Matrix.Nat">Matrix</a> e cols rows -&gt; <a href="/package/base-4.12.0.0/docs/Data-Bool.html#t:Bool" title="Data.Bool">Bool</a> <a href="#v:-60--61-" class="selflink">#</a></p><p class="src"><a href="#v:-62-">(&gt;)</a> :: <a href="Matrix-Nat.html#t:Matrix" title="Matrix.Nat">Matrix</a> e cols rows -&gt; <a href="Matrix-Nat.html#t:Matrix" title="Matrix.Nat">Matrix</a> e cols rows -&gt; <a href="/package/base-4.12.0.0/docs/Data-Bool.html#t:Bool" title="Data.Bool">Bool</a> <a href="#v:-62-" class="selflink">#</a></p><p class="src"><a href="#v:-62--61-">(&gt;=)</a> :: <a href="Matrix-Nat.html#t:Matrix" title="Matrix.Nat">Matrix</a> e cols rows -&gt; <a href="Matrix-Nat.html#t:Matrix" title="Matrix.Nat">Matrix</a> e cols rows -&gt; <a href="/package/base-4.12.0.0/docs/Data-Bool.html#t:Bool" title="Data.Bool">Bool</a> <a href="#v:-62--61-" class="selflink">#</a></p><p class="src"><a href="#v:max">max</a> :: <a href="Matrix-Nat.html#t:Matrix" title="Matrix.Nat">Matrix</a> e cols rows -&gt; <a href="Matrix-Nat.html#t:Matrix" title="Matrix.Nat">Matrix</a> e cols rows -&gt; <a href="Matrix-Nat.html#t:Matrix" title="Matrix.Nat">Matrix</a> e cols rows <a href="#v:max" class="selflink">#</a></p><p class="src"><a href="#v:min">min</a> :: <a href="Matrix-Nat.html#t:Matrix" title="Matrix.Nat">Matrix</a> e cols rows -&gt; <a href="Matrix-Nat.html#t:Matrix" title="Matrix.Nat">Matrix</a> e cols rows -&gt; <a href="Matrix-Nat.html#t:Matrix" title="Matrix.Nat">Matrix</a> e cols rows <a href="#v:min" class="selflink">#</a></p></div></details></td></tr><tr><td class="src clearfix"><span class="inst-left"><span class="instance details-toggle-control details-toggle" data-details-id="i:id:Matrix:Show:5"></span> <a href="/package/base-4.12.0.0/docs/Text-Show.html#t:Show" title="Text.Show">Show</a> e =&gt; <a href="/package/base-4.12.0.0/docs/Text-Show.html#t:Show" title="Text.Show">Show</a> (<a href="Matrix-Nat.html#t:Matrix" title="Matrix.Nat">Matrix</a> e cols rows)</span> <a href="src/Matrix.Nat.html#line-148" class="link">Source</a> <a href="#t:Matrix" class="selflink">#</a></td><td class="doc empty">&nbsp;</td></tr><tr><td colspan="2"><details id="i:id:Matrix:Show:5"><summary class="hide-when-js-enabled">Instance details</summary><p>Defined in <a href="Matrix-Nat.html">Matrix.Nat</a></p> <div class="subs methods"><p class="caption">Methods</p><p class="src"><a href="#v:showsPrec">showsPrec</a> :: <a href="/package/base-4.12.0.0/docs/Data-Int.html#t:Int" title="Data.Int">Int</a> -&gt; <a href="Matrix-Nat.html#t:Matrix" title="Matrix.Nat">Matrix</a> e cols rows -&gt; <a href="/package/base-4.12.0.0/docs/Text-Show.html#t:ShowS" title="Text.Show">ShowS</a> <a href="#v:showsPrec" class="selflink">#</a></p><p class="src"><a href="#v:show">show</a> :: <a href="Matrix-Nat.html#t:Matrix" title="Matrix.Nat">Matrix</a> e cols rows -&gt; <a href="/package/base-4.12.0.0/docs/Data-String.html#t:String" title="Data.String">String</a> <a href="#v:show" class="selflink">#</a></p><p class="src"><a href="#v:showList">showList</a> :: [<a href="Matrix-Nat.html#t:Matrix" title="Matrix.Nat">Matrix</a> e cols rows] -&gt; <a href="/package/base-4.12.0.0/docs/Text-Show.html#t:ShowS" title="Text.Show">ShowS</a> <a href="#v:showList" class="selflink">#</a></p></div></details></td></tr><tr><td class="src clearfix"><span class="inst-left"><span class="instance details-toggle-control details-toggle" data-details-id="i:id:Matrix:NFData:6"></span> <a href="/package/deepseq-1.4.4.0/docs/Control-DeepSeq.html#t:NFData" title="Control.DeepSeq">NFData</a> e =&gt; <a href="/package/deepseq-1.4.4.0/docs/Control-DeepSeq.html#t:NFData" title="Control.DeepSeq">NFData</a> (<a href="Matrix-Nat.html#t:Matrix" title="Matrix.Nat">Matrix</a> e cols rows)</span> <a href="src/Matrix.Nat.html#line-148" class="link">Source</a> <a href="#t:Matrix" class="selflink">#</a></td><td class="doc empty">&nbsp;</td></tr><tr><td colspan="2"><details id="i:id:Matrix:NFData:6"><summary class="hide-when-js-enabled">Instance details</summary><p>Defined in <a href="Matrix-Nat.html">Matrix.Nat</a></p> <div class="subs methods"><p class="caption">Methods</p><p class="src"><a href="#v:rnf">rnf</a> :: <a href="Matrix-Nat.html#t:Matrix" title="Matrix.Nat">Matrix</a> e cols rows -&gt; () <a href="#v:rnf" class="selflink">#</a></p></div></details></td></tr></table></details></div></div><a href="#g:2" id="g:2"><h1>Primitives</h1></a><div class="top"><p class="src"><a id="v:empty" class="def">empty</a> :: <a href="Matrix-Nat.html#t:Matrix" title="Matrix.Nat">Matrix</a> e 0 0 <a href="src/Matrix.Nat.html#empty" class="link">Source</a> <a href="#v:empty" class="selflink">#</a></p></div><div class="top"><p class="src"><a id="v:one" class="def">one</a> :: e -&gt; <a href="Matrix-Nat.html#t:Matrix" title="Matrix.Nat">Matrix</a> e 1 1 <a href="src/Matrix.Nat.html#one" class="link">Source</a> <a href="#v:one" class="selflink">#</a></p></div><div class="top"><p class="src"><a id="v:junc" class="def">junc</a> :: <a href="Matrix-Nat.html#t:FromNat" title="Matrix.Nat">FromNat</a> cols3 ~ <a href="/package/base-4.12.0.0/docs/Data-Either.html#t:Either" title="Data.Either">Either</a> (<a href="Matrix-Nat.html#t:FromNat" title="Matrix.Nat">FromNat</a> cols1) (<a href="Matrix-Nat.html#t:FromNat" title="Matrix.Nat">FromNat</a> cols2) =&gt; <a href="Matrix-Nat.html#t:Matrix" title="Matrix.Nat">Matrix</a> e cols1 rows -&gt; <a href="Matrix-Nat.html#t:Matrix" title="Matrix.Nat">Matrix</a> e cols2 rows -&gt; <a href="Matrix-Nat.html#t:Matrix" title="Matrix.Nat">Matrix</a> e cols3 rows <a href="src/Matrix.Nat.html#junc" class="link">Source</a> <a href="#v:junc" class="selflink">#</a></p></div><div class="top"><p class="src"><a id="v:split" class="def">split</a> :: <a href="Matrix-Nat.html#t:FromNat" title="Matrix.Nat">FromNat</a> rows3 ~ <a href="/package/base-4.12.0.0/docs/Data-Either.html#t:Either" title="Data.Either">Either</a> (<a href="Matrix-Nat.html#t:FromNat" title="Matrix.Nat">FromNat</a> rows1) (<a href="Matrix-Nat.html#t:FromNat" title="Matrix.Nat">FromNat</a> rows2) =&gt; <a href="Matrix-Nat.html#t:Matrix" title="Matrix.Nat">Matrix</a> e cols rows1 -&gt; <a href="Matrix-Nat.html#t:Matrix" title="Matrix.Nat">Matrix</a> e cols rows2 -&gt; <a href="Matrix-Nat.html#t:Matrix" title="Matrix.Nat">Matrix</a> e cols rows3 <a href="src/Matrix.Nat.html#split" class="link">Source</a> <a href="#v:split" class="selflink">#</a></p></div><a href="#g:3" id="g:3"><h1>Auxiliary type families</h1></a><div class="top"><p class="src"><span class="keyword">type family</span> <a id="t:FromNat" class="def">FromNat</a> (n :: <a href="/package/base-4.12.0.0/docs/GHC-TypeNats.html#t:Nat" title="GHC.TypeNats">Nat</a>) :: <a href="/package/base-4.12.0.0/docs/Data-Kind.html#t:Type" title="Data.Kind">Type</a> <span class="keyword">where ...</span> <a href="src/Matrix.Internal.html#FromNat" class="link">Source</a> <a href="#t:FromNat" class="selflink">#</a></p><div class="doc"><p>Type family that computes of a given type dimension from a given natural</p><p>Thanks to Li-Yao Xia this type family is super fast.</p></div><div class="subs equations"><p class="caption">Equations</p><table><tr><td class="src"><a href="Matrix-Nat.html#t:FromNat" title="Matrix.Nat">FromNat</a> 0 = <a href="/package/base-4.12.0.0/docs/Data-Void.html#t:Void" title="Data.Void">Void</a></td><td class="doc empty">&nbsp;</td></tr><tr><td class="src"><a href="Matrix-Nat.html#t:FromNat" title="Matrix.Nat">FromNat</a> 1 = ()</td><td class="doc empty">&nbsp;</td></tr><tr><td class="src"><a href="Matrix-Nat.html#t:FromNat" title="Matrix.Nat">FromNat</a> n = FromNat' (<a href="/package/base-4.12.0.0/docs/GHC-TypeNats.html#t:Mod" title="GHC.TypeNats">Mod</a> n 2 <a href="/package/base-4.12.0.0/docs/Data-Type-Equality.html#t:-61--61-" title="Data.Type.Equality">==</a> 0) (<a href="Matrix-Nat.html#t:FromNat" title="Matrix.Nat">FromNat</a> (<a href="/package/base-4.12.0.0/docs/GHC-TypeNats.html#t:Div" title="GHC.TypeNats">Div</a> n 2))</td><td class="doc empty">&nbsp;</td></tr></table></div></div><div class="top"><p class="src"><span class="keyword">type family</span> <a id="t:Count" class="def">Count</a> (d :: <a href="/package/base-4.12.0.0/docs/Data-Kind.html#t:Type" title="Data.Kind">Type</a>) :: <a href="/package/base-4.12.0.0/docs/GHC-TypeNats.html#t:Nat" title="GHC.TypeNats">Nat</a> <span class="keyword">where ...</span> <a href="src/Matrix.Internal.html#Count" class="link">Source</a> <a href="#t:Count" class="selflink">#</a></p><div class="doc"><p>Type family that computes the cardinality of a given type dimension.</p><p>It can also count the cardinality of custom types that implement the
17+ <code><a href="/package/base-4.12.0.0/docs/GHC-Generics.html#t:Generic" title="GHC.Generics">Generic</a></code> instance.</p></div><div class="subs equations"><p class="caption">Equations</p><table><tr><td class="src"><a href="Matrix-Nat.html#t:Count" title="Matrix.Nat">Count</a> (<a href="Utils.html#t:Natural" title="Utils">Natural</a> n m) = (m <a href="/package/base-4.12.0.0/docs/GHC-TypeNats.html#t:-45-" title="GHC.TypeNats">-</a> n) <a href="/package/base-4.12.0.0/docs/GHC-TypeNats.html#t:-43-" title="GHC.TypeNats">+</a> 1</td><td class="doc empty">&nbsp;</td></tr><tr><td class="src"><a href="Matrix-Nat.html#t:Count" title="Matrix.Nat">Count</a> (<a href="/package/base-4.12.0.0/docs/Data-Either.html#t:Either" title="Data.Either">Either</a> a b) = <a href="/package/base-4.12.0.0/docs/GHC-TypeNats.html#t:-43-" title="GHC.TypeNats">(+)</a> (<a href="Matrix-Nat.html#t:Count" title="Matrix.Nat">Count</a> a) (<a href="Matrix-Nat.html#t:Count" title="Matrix.Nat">Count</a> b)</td><td class="doc empty">&nbsp;</td></tr><tr><td class="src"><a href="Matrix-Nat.html#t:Count" title="Matrix.Nat">Count</a> (a, b) = <a href="/package/base-4.12.0.0/docs/GHC-TypeNats.html#t:-42-" title="GHC.TypeNats">*</a> (<a href="Matrix-Nat.html#t:Count" title="Matrix.Nat">Count</a> a) (<a href="Matrix-Nat.html#t:Count" title="Matrix.Nat">Count</a> b)</td><td class="doc empty">&nbsp;</td></tr><tr><td class="src"><a href="Matrix-Nat.html#t:Count" title="Matrix.Nat">Count</a> (a -&gt; b) = <a href="/package/base-4.12.0.0/docs/GHC-TypeNats.html#t:-94-" title="GHC.TypeNats">(^)</a> (<a href="Matrix-Nat.html#t:Count" title="Matrix.Nat">Count</a> b) (<a href="Matrix-Nat.html#t:Count" title="Matrix.Nat">Count</a> a)</td><td class="doc empty">&nbsp;</td></tr><tr><td class="src"><a href="Matrix-Nat.html#t:Count" title="Matrix.Nat">Count</a> (<a href="/package/base-4.12.0.0/docs/GHC-Generics.html#t:M1" title="GHC.Generics">M1</a> _ _ f p) = <a href="Matrix-Nat.html#t:Count" title="Matrix.Nat">Count</a> (f p)</td><td class="doc empty">&nbsp;</td></tr><tr><td class="src"><a href="Matrix-Nat.html#t:Count" title="Matrix.Nat">Count</a> (<a href="/package/base-4.12.0.0/docs/GHC-Generics.html#t:K1" title="GHC.Generics">K1</a> _ _ _) = 1</td><td class="doc empty">&nbsp;</td></tr><tr><td class="src"><a href="Matrix-Nat.html#t:Count" title="Matrix.Nat">Count</a> (<a href="/package/base-4.12.0.0/docs/GHC-Generics.html#t:V1" title="GHC.Generics">V1</a> _) = 0</td><td class="doc empty">&nbsp;</td></tr><tr><td class="src"><a href="Matrix-Nat.html#t:Count" title="Matrix.Nat">Count</a> (<a href="/package/base-4.12.0.0/docs/GHC-Generics.html#t:U1" title="GHC.Generics">U1</a> _) = 1</td><td class="doc empty">&nbsp;</td></tr><tr><td class="src"><a href="Matrix-Nat.html#t:Count" title="Matrix.Nat">Count</a> (<a href="/package/base-4.12.0.0/docs/GHC-Generics.html#t::-42-:" title="GHC.Generics">(:*:)</a> a b p) = <a href="Matrix-Nat.html#t:Count" title="Matrix.Nat">Count</a> (a p) <a href="/package/base-4.12.0.0/docs/GHC-TypeNats.html#t:-42-" title="GHC.TypeNats">*</a> <a href="Matrix-Nat.html#t:Count" title="Matrix.Nat">Count</a> (b p)</td><td class="doc empty">&nbsp;</td></tr><tr><td class="src"><a href="Matrix-Nat.html#t:Count" title="Matrix.Nat">Count</a> (<a href="/package/base-4.12.0.0/docs/GHC-Generics.html#t::-43-:" title="GHC.Generics">(:+:)</a> a b p) = <a href="Matrix-Nat.html#t:Count" title="Matrix.Nat">Count</a> (a p) <a href="/package/base-4.12.0.0/docs/GHC-TypeNats.html#t:-43-" title="GHC.TypeNats">+</a> <a href="Matrix-Nat.html#t:Count" title="Matrix.Nat">Count</a> (b p)</td><td class="doc empty">&nbsp;</td></tr><tr><td class="src"><a href="Matrix-Nat.html#t:Count" title="Matrix.Nat">Count</a> d = <a href="Matrix-Nat.html#t:Count" title="Matrix.Nat">Count</a> (<a href="/package/base-4.12.0.0/docs/GHC-Generics.html#t:Rep" title="GHC.Generics">Rep</a> d <a href="/package/base-4.12.0.0/docs/GHC-Generics.html#t:R" title="GHC.Generics">R</a>)</td><td class="doc empty">&nbsp;</td></tr></table></div></div><div class="top"><p class="src"><span class="keyword">type family</span> <a id="t:Normalize" class="def">Normalize</a> (d :: <a href="/package/base-4.12.0.0/docs/Data-Kind.html#t:Type" title="Data.Kind">Type</a>) :: <a href="/package/base-4.12.0.0/docs/Data-Kind.html#t:Type" title="Data.Kind">Type</a> <span class="keyword">where ...</span> <a href="src/Matrix.Internal.html#Normalize" class="link">Source</a> <a href="#t:Normalize" class="selflink">#</a></p><div class="doc"><p>Type family that normalizes the representation of a given data
18+ structure</p></div><div class="subs equations"><p class="caption">Equations</p><table><tr><td class="src"><a href="Matrix-Nat.html#t:Normalize" title="Matrix.Nat">Normalize</a> d = <a href="Matrix-Nat.html#t:FromNat" title="Matrix.Nat">FromNat</a> (<a href="Matrix-Nat.html#t:Count" title="Matrix.Nat">Count</a> d)</td><td class="doc empty">&nbsp;</td></tr></table></div></div><a href="#g:4" id="g:4"><h1>Matrix construction and conversion</h1></a><div class="top"><p class="src"><span class="keyword">class</span> <a id="t:FromLists" class="def">FromLists</a> e cols rows <a href="src/Matrix.Internal.html#FromLists" class="link">Source</a> <a href="#t:FromLists" class="selflink">#</a></p><div class="doc"><p>Type class for defining the <code>fromList</code> conversion function.</p><p>Given that it is not possible to branch on types at the term level type
19+ classes are needed bery much like an inductive definition but on types.</p></div><div class="subs minimal"><p class="caption">Minimal complete definition</p><p class="src">fromLists</p></div><div class="subs instances"><details id="i:FromLists" open="open"><summary>Instances</summary><table><tr><td class="src clearfix"><span class="inst-left"><span class="instance details-toggle-control details-toggle" data-details-id="i:ic:FromLists:FromLists:1"></span> <a href="Matrix-Nat.html#t:FromLists" title="Matrix.Nat">FromLists</a> e () ()</span> <a href="src/Matrix.Internal.html#line-311" class="link">Source</a> <a href="#t:FromLists" class="selflink">#</a></td><td class="doc empty">&nbsp;</td></tr><tr><td colspan="2"><details id="i:ic:FromLists:FromLists:1"><summary class="hide-when-js-enabled">Instance details</summary><p>Defined in <a href="Matrix-Internal.html">Matrix.Internal</a></p> <div class="subs methods"><p class="caption">Methods</p><p class="src"><a href="#v:fromLists">fromLists</a> :: [[e]] -&gt; Matrix e () ()</p></div></details></td></tr><tr><td class="src clearfix"><span class="inst-left"><span class="instance details-toggle-control details-toggle" data-details-id="i:ic:FromLists:FromLists:2"></span> <a href="Matrix-Nat.html#t:FromLists" title="Matrix.Nat">FromLists</a> e <a href="/package/base-4.12.0.0/docs/Data-Void.html#t:Void" title="Data.Void">Void</a> <a href="/package/base-4.12.0.0/docs/Data-Void.html#t:Void" title="Data.Void">Void</a></span> <a href="src/Matrix.Internal.html#line-307" class="link">Source</a> <a href="#t:FromLists" class="selflink">#</a></td><td class="doc empty">&nbsp;</td></tr><tr><td colspan="2"><details id="i:ic:FromLists:FromLists:2"><summary class="hide-when-js-enabled">Instance details</summary><p>Defined in <a href="Matrix-Internal.html">Matrix.Internal</a></p> <div class="subs methods"><p class="caption">Methods</p><p class="src"><a href="#v:fromLists">fromLists</a> :: [[e]] -&gt; Matrix e <a href="/package/base-4.12.0.0/docs/Data-Void.html#t:Void" title="Data.Void">Void</a> <a href="/package/base-4.12.0.0/docs/Data-Void.html#t:Void" title="Data.Void">Void</a></p></div></details></td></tr><tr><td class="src clearfix"><span class="inst-left"><span class="instance details-toggle-control details-toggle" data-details-id="i:ic:FromLists:FromLists:3"></span> (<a href="Matrix-Nat.html#t:FromLists" title="Matrix.Nat">FromLists</a> e () a, <a href="Matrix-Nat.html#t:FromLists" title="Matrix.Nat">FromLists</a> e () b, <a href="/package/base-4.12.0.0/docs/GHC-TypeNats.html#t:KnownNat" title="GHC.TypeNats">KnownNat</a> (<a href="Matrix-Nat.html#t:Count" title="Matrix.Nat">Count</a> a)) =&gt; <a href="Matrix-Nat.html#t:FromLists" title="Matrix.Nat">FromLists</a> e () (<a href="/package/base-4.12.0.0/docs/Data-Either.html#t:Either" title="Data.Either">Either</a> a b)</span> <a href="src/Matrix.Internal.html#line-329" class="link">Source</a> <a href="#t:FromLists" class="selflink">#</a></td><td class="doc empty">&nbsp;</td></tr><tr><td colspan="2"><details id="i:ic:FromLists:FromLists:3"><summary class="hide-when-js-enabled">Instance details</summary><p>Defined in <a href="Matrix-Internal.html">Matrix.Internal</a></p> <div class="subs methods"><p class="caption">Methods</p><p class="src"><a href="#v:fromLists">fromLists</a> :: [[e]] -&gt; Matrix e () (<a href="/package/base-4.12.0.0/docs/Data-Either.html#t:Either" title="Data.Either">Either</a> a b)</p></div></details></td></tr><tr><td class="src clearfix"><span class="inst-left"><span class="instance details-toggle-control details-toggle" data-details-id="i:ic:FromLists:FromLists:4"></span> <a href="Matrix-Nat.html#t:FromLists" title="Matrix.Nat">FromLists</a> e () rows =&gt; <a href="Matrix-Nat.html#t:FromLists" title="Matrix.Nat">FromLists</a> e () (<a href="/package/base-4.12.0.0/docs/Data-Either.html#t:Either" title="Data.Either">Either</a> () rows)</span> <a href="src/Matrix.Internal.html#line-325" class="link">Source</a> <a href="#t:FromLists" class="selflink">#</a></td><td class="doc empty">&nbsp;</td></tr><tr><td colspan="2"><details id="i:ic:FromLists:FromLists:4"><summary class="hide-when-js-enabled">Instance details</summary><p>Defined in <a href="Matrix-Internal.html">Matrix.Internal</a></p> <div class="subs methods"><p class="caption">Methods</p><p class="src"><a href="#v:fromLists">fromLists</a> :: [[e]] -&gt; Matrix e () (<a href="/package/base-4.12.0.0/docs/Data-Either.html#t:Either" title="Data.Either">Either</a> () rows)</p></div></details></td></tr><tr><td class="src clearfix"><span class="inst-left"><span class="instance details-toggle-control details-toggle" data-details-id="i:ic:FromLists:FromLists:5"></span> (<a href="Matrix-Nat.html#t:FromLists" title="Matrix.Nat">FromLists</a> e a (), <a href="Matrix-Nat.html#t:FromLists" title="Matrix.Nat">FromLists</a> e b (), <a href="/package/base-4.12.0.0/docs/GHC-TypeNats.html#t:KnownNat" title="GHC.TypeNats">KnownNat</a> (<a href="Matrix-Nat.html#t:Count" title="Matrix.Nat">Count</a> a)) =&gt; <a href="Matrix-Nat.html#t:FromLists" title="Matrix.Nat">FromLists</a> e (<a href="/package/base-4.12.0.0/docs/Data-Either.html#t:Either" title="Data.Either">Either</a> a b) ()</span> <a href="src/Matrix.Internal.html#line-319" class="link">Source</a> <a href="#t:FromLists" class="selflink">#</a></td><td class="doc empty">&nbsp;</td></tr><tr><td colspan="2"><details id="i:ic:FromLists:FromLists:5"><summary class="hide-when-js-enabled">Instance details</summary><p>Defined in <a href="Matrix-Internal.html">Matrix.Internal</a></p> <div class="subs methods"><p class="caption">Methods</p><p class="src"><a href="#v:fromLists">fromLists</a> :: [[e]] -&gt; Matrix e (<a href="/package/base-4.12.0.0/docs/Data-Either.html#t:Either" title="Data.Either">Either</a> a b) ()</p></div></details></td></tr><tr><td class="src clearfix"><span class="inst-left"><span class="instance details-toggle-control details-toggle" data-details-id="i:ic:FromLists:FromLists:6"></span> <a href="Matrix-Nat.html#t:FromLists" title="Matrix.Nat">FromLists</a> e cols () =&gt; <a href="Matrix-Nat.html#t:FromLists" title="Matrix.Nat">FromLists</a> e (<a href="/package/base-4.12.0.0/docs/Data-Either.html#t:Either" title="Data.Either">Either</a> () cols) ()</span> <a href="src/Matrix.Internal.html#line-315" class="link">Source</a> <a href="#t:FromLists" class="selflink">#</a></td><td class="doc empty">&nbsp;</td></tr><tr><td colspan="2"><details id="i:ic:FromLists:FromLists:6"><summary class="hide-when-js-enabled">Instance details</summary><p>Defined in <a href="Matrix-Internal.html">Matrix.Internal</a></p> <div class="subs methods"><p class="caption">Methods</p><p class="src"><a href="#v:fromLists">fromLists</a> :: [[e]] -&gt; Matrix e (<a href="/package/base-4.12.0.0/docs/Data-Either.html#t:Either" title="Data.Either">Either</a> () cols) ()</p></div></details></td></tr><tr><td class="src clearfix"><span class="inst-left"><span class="instance details-toggle-control details-toggle" data-details-id="i:ic:FromLists:FromLists:7"></span> (<a href="Matrix-Nat.html#t:FromLists" title="Matrix.Nat">FromLists</a> e (<a href="/package/base-4.12.0.0/docs/Data-Either.html#t:Either" title="Data.Either">Either</a> a b) c, <a href="Matrix-Nat.html#t:FromLists" title="Matrix.Nat">FromLists</a> e (<a href="/package/base-4.12.0.0/docs/Data-Either.html#t:Either" title="Data.Either">Either</a> a b) d, <a href="/package/base-4.12.0.0/docs/GHC-TypeNats.html#t:KnownNat" title="GHC.TypeNats">KnownNat</a> (<a href="Matrix-Nat.html#t:Count" title="Matrix.Nat">Count</a> c)) =&gt; <a href="Matrix-Nat.html#t:FromLists" title="Matrix.Nat">FromLists</a> e (<a href="/package/base-4.12.0.0/docs/Data-Either.html#t:Either" title="Data.Either">Either</a> a b) (<a href="/package/base-4.12.0.0/docs/Data-Either.html#t:Either" title="Data.Either">Either</a> c d)</span> <a href="src/Matrix.Internal.html#line-335" class="link">Source</a> <a href="#t:FromLists" class="selflink">#</a></td><td class="doc empty">&nbsp;</td></tr><tr><td colspan="2"><details id="i:ic:FromLists:FromLists:7"><summary class="hide-when-js-enabled">Instance details</summary><p>Defined in <a href="Matrix-Internal.html">Matrix.Internal</a></p> <div class="subs methods"><p class="caption">Methods</p><p class="src"><a href="#v:fromLists">fromLists</a> :: [[e]] -&gt; Matrix e (<a href="/package/base-4.12.0.0/docs/Data-Either.html#t:Either" title="Data.Either">Either</a> a b) (<a href="/package/base-4.12.0.0/docs/Data-Either.html#t:Either" title="Data.Either">Either</a> c d)</p></div></details></td></tr></table></details></div></div><div class="top"><p class="src"><a id="v:fromLists" class="def">fromLists</a> :: <a href="Matrix-Nat.html#t:FromLists" title="Matrix.Nat">FromLists</a> e (<a href="Matrix-Nat.html#t:FromNat" title="Matrix.Nat">FromNat</a> cols) (<a href="Matrix-Nat.html#t:FromNat" title="Matrix.Nat">FromNat</a> rows) =&gt; [[e]] -&gt; <a href="Matrix-Nat.html#t:Matrix" title="Matrix.Nat">Matrix</a> e cols rows <a href="src/Matrix.Nat.html#fromLists" class="link">Source</a> <a href="#v:fromLists" class="selflink">#</a></p></div><div class="top"><p class="src"><a id="v:toLists" class="def">toLists</a> :: <a href="Matrix-Nat.html#t:Matrix" title="Matrix.Nat">Matrix</a> e cols rows -&gt; [[e]] <a href="src/Matrix.Nat.html#toLists" class="link">Source</a> <a href="#v:toLists" class="selflink">#</a></p></div><div class="top"><p class="src"><a id="v:toList" class="def">toList</a> :: <a href="Matrix-Nat.html#t:Matrix" title="Matrix.Nat">Matrix</a> e cols rows -&gt; [e] <a href="src/Matrix.Nat.html#toList" class="link">Source</a> <a href="#v:toList" class="selflink">#</a></p></div><div class="top"><p class="src"><a id="v:matrixBuilder" class="def">matrixBuilder</a> :: (<a href="Matrix-Nat.html#t:FromLists" title="Matrix.Nat">FromLists</a> e (<a href="Matrix-Nat.html#t:FromNat" title="Matrix.Nat">FromNat</a> cols) (<a href="Matrix-Nat.html#t:FromNat" title="Matrix.Nat">FromNat</a> rows), <a href="/package/base-4.12.0.0/docs/GHC-TypeNats.html#t:KnownNat" title="GHC.TypeNats">KnownNat</a> (<a href="Matrix-Nat.html#t:Count" title="Matrix.Nat">Count</a> (<a href="Matrix-Nat.html#t:FromNat" title="Matrix.Nat">FromNat</a> cols)), <a href="/package/base-4.12.0.0/docs/GHC-TypeNats.html#t:KnownNat" title="GHC.TypeNats">KnownNat</a> (<a href="Matrix-Nat.html#t:Count" title="Matrix.Nat">Count</a> (<a href="Matrix-Nat.html#t:FromNat" title="Matrix.Nat">FromNat</a> rows))) =&gt; ((<a href="/package/base-4.12.0.0/docs/Data-Int.html#t:Int" title="Data.Int">Int</a>, <a href="/package/base-4.12.0.0/docs/Data-Int.html#t:Int" title="Data.Int">Int</a>) -&gt; e) -&gt; <a href="Matrix-Nat.html#t:Matrix" title="Matrix.Nat">Matrix</a> e cols rows <a href="src/Matrix.Nat.html#matrixBuilder" class="link">Source</a> <a href="#v:matrixBuilder" class="selflink">#</a></p></div><div class="top"><p class="src"><a id="v:row" class="def">row</a> :: <a href="Matrix-Nat.html#t:FromLists" title="Matrix.Nat">FromLists</a> e (<a href="Matrix-Nat.html#t:FromNat" title="Matrix.Nat">FromNat</a> cols) () =&gt; [e] -&gt; <a href="Matrix-Nat.html#t:Matrix" title="Matrix.Nat">Matrix</a> e cols 1 <a href="src/Matrix.Nat.html#row" class="link">Source</a> <a href="#v:row" class="selflink">#</a></p></div><div class="top"><p class="src"><a id="v:col" class="def">col</a> :: <a href="Matrix-Nat.html#t:FromLists" title="Matrix.Nat">FromLists</a> e () (<a href="Matrix-Nat.html#t:FromNat" title="Matrix.Nat">FromNat</a> rows) =&gt; [e] -&gt; <a href="Matrix-Nat.html#t:Matrix" title="Matrix.Nat">Matrix</a> e 1 rows <a href="src/Matrix.Nat.html#col" class="link">Source</a> <a href="#v:col" class="selflink">#</a></p></div><div class="top"><p class="src"><a id="v:zeros" class="def">zeros</a> :: (<a href="/package/base-4.12.0.0/docs/Prelude.html#t:Num" title="Prelude">Num</a> e, <a href="Matrix-Nat.html#t:FromLists" title="Matrix.Nat">FromLists</a> e (<a href="Matrix-Nat.html#t:FromNat" title="Matrix.Nat">FromNat</a> cols) (<a href="Matrix-Nat.html#t:FromNat" title="Matrix.Nat">FromNat</a> rows), <a href="/package/base-4.12.0.0/docs/GHC-TypeNats.html#t:KnownNat" title="GHC.TypeNats">KnownNat</a> (<a href="Matrix-Nat.html#t:Count" title="Matrix.Nat">Count</a> (<a href="Matrix-Nat.html#t:FromNat" title="Matrix.Nat">FromNat</a> cols)), <a href="/package/base-4.12.0.0/docs/GHC-TypeNats.html#t:KnownNat" title="GHC.TypeNats">KnownNat</a> (<a href="Matrix-Nat.html#t:Count" title="Matrix.Nat">Count</a> (<a href="Matrix-Nat.html#t:FromNat" title="Matrix.Nat">FromNat</a> rows))) =&gt; <a href="Matrix-Nat.html#t:Matrix" title="Matrix.Nat">Matrix</a> e cols rows <a href="src/Matrix.Nat.html#zeros" class="link">Source</a> <a href="#v:zeros" class="selflink">#</a></p></div><div class="top"><p class="src"><a id="v:ones" class="def">ones</a> :: (<a href="/package/base-4.12.0.0/docs/Prelude.html#t:Num" title="Prelude">Num</a> e, <a href="Matrix-Nat.html#t:FromLists" title="Matrix.Nat">FromLists</a> e (<a href="Matrix-Nat.html#t:FromNat" title="Matrix.Nat">FromNat</a> cols) (<a href="Matrix-Nat.html#t:FromNat" title="Matrix.Nat">FromNat</a> rows), <a href="/package/base-4.12.0.0/docs/GHC-TypeNats.html#t:KnownNat" title="GHC.TypeNats">KnownNat</a> (<a href="Matrix-Nat.html#t:Count" title="Matrix.Nat">Count</a> (<a href="Matrix-Nat.html#t:FromNat" title="Matrix.Nat">FromNat</a> cols)), <a href="/package/base-4.12.0.0/docs/GHC-TypeNats.html#t:KnownNat" title="GHC.TypeNats">KnownNat</a> (<a href="Matrix-Nat.html#t:Count" title="Matrix.Nat">Count</a> (<a href="Matrix-Nat.html#t:FromNat" title="Matrix.Nat">FromNat</a> rows))) =&gt; <a href="Matrix-Nat.html#t:Matrix" title="Matrix.Nat">Matrix</a> e cols rows <a href="src/Matrix.Nat.html#ones" class="link">Source</a> <a href="#v:ones" class="selflink">#</a></p></div><div class="top"><p class="src"><a id="v:bang" class="def">bang</a> :: <span class="keyword">forall</span> e cols. (<a href="/package/base-4.12.0.0/docs/Prelude.html#t:Num" title="Prelude">Num</a> e, <a href="/package/base-4.12.0.0/docs/Prelude.html#t:Enum" title="Prelude">Enum</a> e, <a href="Matrix-Nat.html#t:FromLists" title="Matrix.Nat">FromLists</a> e (<a href="Matrix-Nat.html#t:FromNat" title="Matrix.Nat">FromNat</a> cols) (), <a href="/package/base-4.12.0.0/docs/GHC-TypeNats.html#t:KnownNat" title="GHC.TypeNats">KnownNat</a> (<a href="Matrix-Nat.html#t:Count" title="Matrix.Nat">Count</a> (<a href="Matrix-Nat.html#t:FromNat" title="Matrix.Nat">FromNat</a> cols))) =&gt; <a href="Matrix-Nat.html#t:Matrix" title="Matrix.Nat">Matrix</a> e cols 1 <a href="src/Matrix.Nat.html#bang" class="link">Source</a> <a href="#v:bang" class="selflink">#</a></p></div><div class="top"><p class="src"><a id="v:constant" class="def">constant</a> :: (<a href="/package/base-4.12.0.0/docs/Prelude.html#t:Num" title="Prelude">Num</a> e, <a href="Matrix-Nat.html#t:FromLists" title="Matrix.Nat">FromLists</a> e (<a href="Matrix-Nat.html#t:FromNat" title="Matrix.Nat">FromNat</a> cols) (<a href="Matrix-Nat.html#t:FromNat" title="Matrix.Nat">FromNat</a> rows), <a href="/package/base-4.12.0.0/docs/GHC-TypeNats.html#t:KnownNat" title="GHC.TypeNats">KnownNat</a> (<a href="Matrix-Nat.html#t:Count" title="Matrix.Nat">Count</a> (<a href="Matrix-Nat.html#t:FromNat" title="Matrix.Nat">FromNat</a> cols)), <a href="/package/base-4.12.0.0/docs/GHC-TypeNats.html#t:KnownNat" title="GHC.TypeNats">KnownNat</a> (<a href="Matrix-Nat.html#t:Count" title="Matrix.Nat">Count</a> (<a href="Matrix-Nat.html#t:FromNat" title="Matrix.Nat">FromNat</a> rows))) =&gt; e -&gt; <a href="Matrix-Nat.html#t:Matrix" title="Matrix.Nat">Matrix</a> e cols rows <a href="src/Matrix.Nat.html#constant" class="link">Source</a> <a href="#v:constant" class="selflink">#</a></p></div><a href="#g:5" id="g:5"><h1>Misc</h1></a><a href="#g:6" id="g:6"><h2>Get dimensions</h2></a><div class="top"><p class="src"><a id="v:columns" class="def">columns</a> :: <a href="/package/base-4.12.0.0/docs/GHC-TypeNats.html#t:KnownNat" title="GHC.TypeNats">KnownNat</a> (<a href="Matrix-Nat.html#t:Count" title="Matrix.Nat">Count</a> (<a href="Matrix-Nat.html#t:FromNat" title="Matrix.Nat">FromNat</a> cols)) =&gt; <a href="Matrix-Nat.html#t:Matrix" title="Matrix.Nat">Matrix</a> e cols rows -&gt; <a href="/package/base-4.12.0.0/docs/Data-Int.html#t:Int" title="Data.Int">Int</a> <a href="src/Matrix.Nat.html#columns" class="link">Source</a> <a href="#v:columns" class="selflink">#</a></p></div><div class="top"><p class="src"><a id="v:rows" class="def">rows</a> :: <a href="/package/base-4.12.0.0/docs/GHC-TypeNats.html#t:KnownNat" title="GHC.TypeNats">KnownNat</a> (<a href="Matrix-Nat.html#t:Count" title="Matrix.Nat">Count</a> (<a href="Matrix-Nat.html#t:FromNat" title="Matrix.Nat">FromNat</a> rows)) =&gt; <a href="Matrix-Nat.html#t:Matrix" title="Matrix.Nat">Matrix</a> e cols rows -&gt; <a href="/package/base-4.12.0.0/docs/Data-Int.html#t:Int" title="Data.Int">Int</a> <a href="src/Matrix.Nat.html#rows" class="link">Source</a> <a href="#v:rows" class="selflink">#</a></p></div><a href="#g:7" id="g:7"><h2>Matrix Transposition</h2></a><div class="top"><p class="src"><a id="v:tr" class="def">tr</a> :: <a href="Matrix-Nat.html#t:Matrix" title="Matrix.Nat">Matrix</a> e cols rows -&gt; <a href="Matrix-Nat.html#t:Matrix" title="Matrix.Nat">Matrix</a> e rows cols <a href="src/Matrix.Nat.html#tr" class="link">Source</a> <a href="#v:tr" class="selflink">#</a></p></div><a href="#g:8" id="g:8"><h2>Selective operator</h2></a><div class="top"><p class="src"><a id="v:select" class="def">select</a> :: (<a href="/package/base-4.12.0.0/docs/Prelude.html#t:Num" title="Prelude">Num</a> e, <a href="Matrix-Nat.html#t:FromLists" title="Matrix.Nat">FromLists</a> e (<a href="Matrix-Nat.html#t:FromNat" title="Matrix.Nat">FromNat</a> rows1) (<a href="Matrix-Nat.html#t:FromNat" title="Matrix.Nat">FromNat</a> rows1), <a href="/package/base-4.12.0.0/docs/GHC-TypeNats.html#t:KnownNat" title="GHC.TypeNats">KnownNat</a> (<a href="Matrix-Nat.html#t:Count" title="Matrix.Nat">Count</a> (<a href="Matrix-Nat.html#t:FromNat" title="Matrix.Nat">FromNat</a> rows1)), <a href="Matrix-Nat.html#t:FromNat" title="Matrix.Nat">FromNat</a> rows2 ~ <a href="Matrix-Nat.html#t:FromNat" title="Matrix.Nat">FromNat</a> rows1, <a href="Matrix-Nat.html#t:FromNat" title="Matrix.Nat">FromNat</a> cols1 ~ <a href="Matrix-Nat.html#t:FromNat" title="Matrix.Nat">FromNat</a> cols2, <a href="Matrix-Nat.html#t:FromNat" title="Matrix.Nat">FromNat</a> rows3 ~ <a href="/package/base-4.12.0.0/docs/Data-Either.html#t:Either" title="Data.Either">Either</a> (<a href="Matrix-Nat.html#t:FromNat" title="Matrix.Nat">FromNat</a> cols3) (<a href="Matrix-Nat.html#t:FromNat" title="Matrix.Nat">FromNat</a> rows1)) =&gt; <a href="Matrix-Nat.html#t:Matrix" title="Matrix.Nat">Matrix</a> e cols1 rows3 -&gt; <a href="Matrix-Nat.html#t:Matrix" title="Matrix.Nat">Matrix</a> e cols3 rows1 -&gt; <a href="Matrix-Nat.html#t:Matrix" title="Matrix.Nat">Matrix</a> e cols2 rows2 <a href="src/Matrix.Nat.html#select" class="link">Source</a> <a href="#v:select" class="selflink">#</a></p></div><a href="#g:9" id="g:9"><h2>McCarthy's Conditional</h2></a><div class="top"><p class="src"><a id="v:cond" class="def">cond</a> :: (<a href="Matrix-Nat.html#t:FromNat" title="Matrix.Nat">FromNat</a> (<a href="Matrix-Nat.html#t:Count" title="Matrix.Nat">Count</a> (<a href="Matrix-Nat.html#t:FromNat" title="Matrix.Nat">FromNat</a> cols)) ~ <a href="Matrix-Nat.html#t:FromNat" title="Matrix.Nat">FromNat</a> cols, <a href="/package/base-4.12.0.0/docs/GHC-TypeNats.html#t:KnownNat" title="GHC.TypeNats">KnownNat</a> (<a href="Matrix-Nat.html#t:Count" title="Matrix.Nat">Count</a> (<a href="Matrix-Nat.html#t:FromNat" title="Matrix.Nat">FromNat</a> cols)), <a href="Matrix-Nat.html#t:FromLists" title="Matrix.Nat">FromLists</a> e () (<a href="Matrix-Nat.html#t:FromNat" title="Matrix.Nat">FromNat</a> cols), <a href="Matrix-Nat.html#t:FromLists" title="Matrix.Nat">FromLists</a> e (<a href="Matrix-Nat.html#t:FromNat" title="Matrix.Nat">FromNat</a> cols) (), <a href="Matrix-Nat.html#t:FromLists" title="Matrix.Nat">FromLists</a> e (<a href="Matrix-Nat.html#t:FromNat" title="Matrix.Nat">FromNat</a> cols) (<a href="Matrix-Nat.html#t:FromNat" title="Matrix.Nat">FromNat</a> cols), <a href="/package/base-4.12.0.0/docs/Prelude.html#t:Bounded" title="Prelude">Bounded</a> a, <a href="/package/base-4.12.0.0/docs/Prelude.html#t:Enum" title="Prelude">Enum</a> a, <a href="/package/base-4.12.0.0/docs/Prelude.html#t:Num" title="Prelude">Num</a> e, <a href="/package/base-4.12.0.0/docs/Data-Ord.html#t:Ord" title="Data.Ord">Ord</a> e) =&gt; (a -&gt; <a href="/package/base-4.12.0.0/docs/Data-Bool.html#t:Bool" title="Data.Bool">Bool</a>) -&gt; <a href="Matrix-Nat.html#t:Matrix" title="Matrix.Nat">Matrix</a> e cols rows -&gt; <a href="Matrix-Nat.html#t:Matrix" title="Matrix.Nat">Matrix</a> e cols rows -&gt; <a href="Matrix-Nat.html#t:Matrix" title="Matrix.Nat">Matrix</a> e cols rows <a href="src/Matrix.Nat.html#cond" class="link">Source</a> <a href="#v:cond" class="selflink">#</a></p></div><a href="#g:10" id="g:10"><h2>Matrix &quot;abiding&quot;</h2></a><div class="top"><p class="src"><a id="v:abideJS" class="def">abideJS</a> :: <a href="Matrix-Nat.html#t:Matrix" title="Matrix.Nat">Matrix</a> e cols rows -&gt; <a href="Matrix-Nat.html#t:Matrix" title="Matrix.Nat">Matrix</a> e cols rows <a href="src/Matrix.Nat.html#abideJS" class="link">Source</a> <a href="#v:abideJS" class="selflink">#</a></p></div><div class="top"><p class="src"><a id="v:abideSJ" class="def">abideSJ</a> :: <a href="Matrix-Nat.html#t:Matrix" title="Matrix.Nat">Matrix</a> e cols rows -&gt; <a href="Matrix-Nat.html#t:Matrix" title="Matrix.Nat">Matrix</a> e cols rows <a href="src/Matrix.Nat.html#abideSJ" class="link">Source</a> <a href="#v:abideSJ" class="selflink">#</a></p></div><a href="#g:11" id="g:11"><h1>Biproduct approach</h1></a><a href="#g:12" id="g:12"><h2>Split</h2></a><div class="top"><p class="src"><a id="v:-61--61--61-" class="def">(===)</a> :: <a href="Matrix-Nat.html#t:FromNat" title="Matrix.Nat">FromNat</a> rows3 ~ <a href="/package/base-4.12.0.0/docs/Data-Either.html#t:Either" title="Data.Either">Either</a> (<a href="Matrix-Nat.html#t:FromNat" title="Matrix.Nat">FromNat</a> rows1) (<a href="Matrix-Nat.html#t:FromNat" title="Matrix.Nat">FromNat</a> rows2) =&gt; <a href="Matrix-Nat.html#t:Matrix" title="Matrix.Nat">Matrix</a> e cols rows1 -&gt; <a href="Matrix-Nat.html#t:Matrix" title="Matrix.Nat">Matrix</a> e cols rows2 -&gt; <a href="Matrix-Nat.html#t:Matrix" title="Matrix.Nat">Matrix</a> e cols rows3 <span class="fixity">infixl 2</span><span class="rightedge"></span> <a href="src/Matrix.Nat.html#%3D%3D%3D" class="link">Source</a> <a href="#v:-61--61--61-" class="selflink">#</a></p></div><a href="#g:13" id="g:13"><h3>Projections</h3></a><div class="top"><p class="src"><a id="v:p1" class="def">p1</a> :: (<a href="/package/base-4.12.0.0/docs/Prelude.html#t:Num" title="Prelude">Num</a> e, <a href="/package/base-4.12.0.0/docs/GHC-TypeNats.html#t:KnownNat" title="GHC.TypeNats">KnownNat</a> (<a href="Matrix-Nat.html#t:Count" title="Matrix.Nat">Count</a> (<a href="Matrix-Nat.html#t:FromNat" title="Matrix.Nat">FromNat</a> n)), <a href="/package/base-4.12.0.0/docs/GHC-TypeNats.html#t:KnownNat" title="GHC.TypeNats">KnownNat</a> (<a href="Matrix-Nat.html#t:Count" title="Matrix.Nat">Count</a> (<a href="Matrix-Nat.html#t:FromNat" title="Matrix.Nat">FromNat</a> m)), <a href="Matrix-Nat.html#t:FromLists" title="Matrix.Nat">FromLists</a> e (<a href="Matrix-Nat.html#t:FromNat" title="Matrix.Nat">FromNat</a> n) (<a href="Matrix-Nat.html#t:FromNat" title="Matrix.Nat">FromNat</a> m), <a href="Matrix-Nat.html#t:FromLists" title="Matrix.Nat">FromLists</a> e (<a href="Matrix-Nat.html#t:FromNat" title="Matrix.Nat">FromNat</a> m) (<a href="Matrix-Nat.html#t:FromNat" title="Matrix.Nat">FromNat</a> m), <a href="Matrix-Nat.html#t:FromNat" title="Matrix.Nat">FromNat</a> (m <a href="/package/base-4.12.0.0/docs/GHC-TypeNats.html#t:-43-" title="GHC.TypeNats">+</a> n) ~ <a href="/package/base-4.12.0.0/docs/Data-Either.html#t:Either" title="Data.Either">Either</a> (<a href="Matrix-Nat.html#t:FromNat" title="Matrix.Nat">FromNat</a> m) (<a href="Matrix-Nat.html#t:FromNat" title="Matrix.Nat">FromNat</a> n)) =&gt; <a href="Matrix-Nat.html#t:Matrix" title="Matrix.Nat">Matrix</a> e (m <a href="/package/base-4.12.0.0/docs/GHC-TypeNats.html#t:-43-" title="GHC.TypeNats">+</a> n) m <a href="src/Matrix.Nat.html#p1" class="link">Source</a> <a href="#v:p1" class="selflink">#</a></p></div><div class="top"><p class="src"><a id="v:p2" class="def">p2</a> :: (<a href="/package/base-4.12.0.0/docs/Prelude.html#t:Num" title="Prelude">Num</a> e, <a href="/package/base-4.12.0.0/docs/GHC-TypeNats.html#t:KnownNat" title="GHC.TypeNats">KnownNat</a> (<a href="Matrix-Nat.html#t:Count" title="Matrix.Nat">Count</a> (<a href="Matrix-Nat.html#t:FromNat" title="Matrix.Nat">FromNat</a> n)), <a href="/package/base-4.12.0.0/docs/GHC-TypeNats.html#t:KnownNat" title="GHC.TypeNats">KnownNat</a> (<a href="Matrix-Nat.html#t:Count" title="Matrix.Nat">Count</a> (<a href="Matrix-Nat.html#t:FromNat" title="Matrix.Nat">FromNat</a> m)), <a href="Matrix-Nat.html#t:FromLists" title="Matrix.Nat">FromLists</a> e (<a href="Matrix-Nat.html#t:FromNat" title="Matrix.Nat">FromNat</a> m) (<a href="Matrix-Nat.html#t:FromNat" title="Matrix.Nat">FromNat</a> n), <a href="Matrix-Nat.html#t:FromLists" title="Matrix.Nat">FromLists</a> e (<a href="Matrix-Nat.html#t:FromNat" title="Matrix.Nat">FromNat</a> n) (<a href="Matrix-Nat.html#t:FromNat" title="Matrix.Nat">FromNat</a> n), <a href="Matrix-Nat.html#t:FromNat" title="Matrix.Nat">FromNat</a> (m <a href="/package/base-4.12.0.0/docs/GHC-TypeNats.html#t:-43-" title="GHC.TypeNats">+</a> n) ~ <a href="/package/base-4.12.0.0/docs/Data-Either.html#t:Either" title="Data.Either">Either</a> (<a href="Matrix-Nat.html#t:FromNat" title="Matrix.Nat">FromNat</a> m) (<a href="Matrix-Nat.html#t:FromNat" title="Matrix.Nat">FromNat</a> n)) =&gt; <a href="Matrix-Nat.html#t:Matrix" title="Matrix.Nat">Matrix</a> e (m <a href="/package/base-4.12.0.0/docs/GHC-TypeNats.html#t:-43-" title="GHC.TypeNats">+</a> n) n <a href="src/Matrix.Nat.html#p2" class="link">Source</a> <a href="#v:p2" class="selflink">#</a></p></div><a href="#g:14" id="g:14"><h2>Junc</h2></a><div class="top"><p class="src"><a id="v:-124--124--124-" class="def">(|||)</a> :: <a href="Matrix-Nat.html#t:FromNat" title="Matrix.Nat">FromNat</a> cols3 ~ <a href="/package/base-4.12.0.0/docs/Data-Either.html#t:Either" title="Data.Either">Either</a> (<a href="Matrix-Nat.html#t:FromNat" title="Matrix.Nat">FromNat</a> cols1) (<a href="Matrix-Nat.html#t:FromNat" title="Matrix.Nat">FromNat</a> cols2) =&gt; <a href="Matrix-Nat.html#t:Matrix" title="Matrix.Nat">Matrix</a> e cols1 rows -&gt; <a href="Matrix-Nat.html#t:Matrix" title="Matrix.Nat">Matrix</a> e cols2 rows -&gt; <a href="Matrix-Nat.html#t:Matrix" title="Matrix.Nat">Matrix</a> e cols3 rows <span class="fixity">infixl 3</span><span class="rightedge"></span> <a href="src/Matrix.Nat.html#%7C%7C%7C" class="link">Source</a> <a href="#v:-124--124--124-" class="selflink">#</a></p></div><a href="#g:15" id="g:15"><h3>Injections</h3></a><div class="top"><p class="src"><a id="v:i1" class="def">i1</a> :: (<a href="/package/base-4.12.0.0/docs/Prelude.html#t:Num" title="Prelude">Num</a> e, <a href="/package/base-4.12.0.0/docs/GHC-TypeNats.html#t:KnownNat" title="GHC.TypeNats">KnownNat</a> (<a href="Matrix-Nat.html#t:Count" title="Matrix.Nat">Count</a> (<a href="Matrix-Nat.html#t:FromNat" title="Matrix.Nat">FromNat</a> n)), <a href="/package/base-4.12.0.0/docs/GHC-TypeNats.html#t:KnownNat" title="GHC.TypeNats">KnownNat</a> (<a href="Matrix-Nat.html#t:Count" title="Matrix.Nat">Count</a> (<a href="Matrix-Nat.html#t:FromNat" title="Matrix.Nat">FromNat</a> rows)), <a href="Matrix-Nat.html#t:FromLists" title="Matrix.Nat">FromLists</a> e (<a href="Matrix-Nat.html#t:FromNat" title="Matrix.Nat">FromNat</a> n) (<a href="Matrix-Nat.html#t:FromNat" title="Matrix.Nat">FromNat</a> rows), <a href="Matrix-Nat.html#t:FromLists" title="Matrix.Nat">FromLists</a> e (<a href="Matrix-Nat.html#t:FromNat" title="Matrix.Nat">FromNat</a> rows) (<a href="Matrix-Nat.html#t:FromNat" title="Matrix.Nat">FromNat</a> rows), <a href="Matrix-Nat.html#t:FromNat" title="Matrix.Nat">FromNat</a> (rows <a href="/package/base-4.12.0.0/docs/GHC-TypeNats.html#t:-43-" title="GHC.TypeNats">+</a> n) ~ <a href="/package/base-4.12.0.0/docs/Data-Either.html#t:Either" title="Data.Either">Either</a> (<a href="Matrix-Nat.html#t:FromNat" title="Matrix.Nat">FromNat</a> rows) (<a href="Matrix-Nat.html#t:FromNat" title="Matrix.Nat">FromNat</a> n)) =&gt; <a href="Matrix-Nat.html#t:Matrix" title="Matrix.Nat">Matrix</a> e rows (rows <a href="/package/base-4.12.0.0/docs/GHC-TypeNats.html#t:-43-" title="GHC.TypeNats">+</a> n) <a href="src/Matrix.Nat.html#i1" class="link">Source</a> <a href="#v:i1" class="selflink">#</a></p></div><div class="top"><p class="src"><a id="v:i2" class="def">i2</a> :: (<a href="/package/base-4.12.0.0/docs/Prelude.html#t:Num" title="Prelude">Num</a> e, <a href="/package/base-4.12.0.0/docs/GHC-TypeNats.html#t:KnownNat" title="GHC.TypeNats">KnownNat</a> (<a href="Matrix-Nat.html#t:Count" title="Matrix.Nat">Count</a> (<a href="Matrix-Nat.html#t:FromNat" title="Matrix.Nat">FromNat</a> rows)), <a href="/package/base-4.12.0.0/docs/GHC-TypeNats.html#t:KnownNat" title="GHC.TypeNats">KnownNat</a> (<a href="Matrix-Nat.html#t:Count" title="Matrix.Nat">Count</a> (<a href="Matrix-Nat.html#t:FromNat" title="Matrix.Nat">FromNat</a> m)), <a href="Matrix-Nat.html#t:FromLists" title="Matrix.Nat">FromLists</a> e (<a href="Matrix-Nat.html#t:FromNat" title="Matrix.Nat">FromNat</a> m) (<a href="Matrix-Nat.html#t:FromNat" title="Matrix.Nat">FromNat</a> rows), <a href="Matrix-Nat.html#t:FromLists" title="Matrix.Nat">FromLists</a> e (<a href="Matrix-Nat.html#t:FromNat" title="Matrix.Nat">FromNat</a> rows) (<a href="Matrix-Nat.html#t:FromNat" title="Matrix.Nat">FromNat</a> rows), <a href="Matrix-Nat.html#t:FromNat" title="Matrix.Nat">FromNat</a> (m <a href="/package/base-4.12.0.0/docs/GHC-TypeNats.html#t:-43-" title="GHC.TypeNats">+</a> rows) ~ <a href="/package/base-4.12.0.0/docs/Data-Either.html#t:Either" title="Data.Either">Either</a> (<a href="Matrix-Nat.html#t:FromNat" title="Matrix.Nat">FromNat</a> m) (<a href="Matrix-Nat.html#t:FromNat" title="Matrix.Nat">FromNat</a> rows)) =&gt; <a href="Matrix-Nat.html#t:Matrix" title="Matrix.Nat">Matrix</a> e rows (m <a href="/package/base-4.12.0.0/docs/GHC-TypeNats.html#t:-43-" title="GHC.TypeNats">+</a> rows) <a href="src/Matrix.Nat.html#i2" class="link">Source</a> <a href="#v:i2" class="selflink">#</a></p></div><a href="#g:16" id="g:16"><h2>Bifunctors</h2></a><div class="top"><p class="src"><a id="v:-45--124--45-" class="def">(-|-)</a> :: (<a href="/package/base-4.12.0.0/docs/Prelude.html#t:Num" title="Prelude">Num</a> e, <a href="/package/base-4.12.0.0/docs/GHC-TypeNats.html#t:KnownNat" title="GHC.TypeNats">KnownNat</a> (<a href="Matrix-Nat.html#t:Count" title="Matrix.Nat">Count</a> (<a href="Matrix-Nat.html#t:FromNat" title="Matrix.Nat">FromNat</a> j)), <a href="/package/base-4.12.0.0/docs/GHC-TypeNats.html#t:KnownNat" title="GHC.TypeNats">KnownNat</a> (<a href="Matrix-Nat.html#t:Count" title="Matrix.Nat">Count</a> (<a href="Matrix-Nat.html#t:FromNat" title="Matrix.Nat">FromNat</a> k)), <a href="Matrix-Nat.html#t:FromLists" title="Matrix.Nat">FromLists</a> e (<a href="Matrix-Nat.html#t:FromNat" title="Matrix.Nat">FromNat</a> k) (<a href="Matrix-Nat.html#t:FromNat" title="Matrix.Nat">FromNat</a> k), <a href="Matrix-Nat.html#t:FromLists" title="Matrix.Nat">FromLists</a> e (<a href="Matrix-Nat.html#t:FromNat" title="Matrix.Nat">FromNat</a> j) (<a href="Matrix-Nat.html#t:FromNat" title="Matrix.Nat">FromNat</a> k), <a href="Matrix-Nat.html#t:FromLists" title="Matrix.Nat">FromLists</a> e (<a href="Matrix-Nat.html#t:FromNat" title="Matrix.Nat">FromNat</a> k) (<a href="Matrix-Nat.html#t:FromNat" title="Matrix.Nat">FromNat</a> j), <a href="Matrix-Nat.html#t:FromLists" title="Matrix.Nat">FromLists</a> e (<a href="Matrix-Nat.html#t:FromNat" title="Matrix.Nat">FromNat</a> j) (<a href="Matrix-Nat.html#t:FromNat" title="Matrix.Nat">FromNat</a> j), <a href="Matrix-Nat.html#t:FromNat" title="Matrix.Nat">FromNat</a> (n <a href="/package/base-4.12.0.0/docs/GHC-TypeNats.html#t:-43-" title="GHC.TypeNats">+</a> m) ~ <a href="/package/base-4.12.0.0/docs/Data-Either.html#t:Either" title="Data.Either">Either</a> (<a href="Matrix-Nat.html#t:FromNat" title="Matrix.Nat">FromNat</a> n) (<a href="Matrix-Nat.html#t:FromNat" title="Matrix.Nat">FromNat</a> m), <a href="Matrix-Nat.html#t:FromNat" title="Matrix.Nat">FromNat</a> (k <a href="/package/base-4.12.0.0/docs/GHC-TypeNats.html#t:-43-" title="GHC.TypeNats">+</a> j) ~ <a href="/package/base-4.12.0.0/docs/Data-Either.html#t:Either" title="Data.Either">Either</a> (<a href="Matrix-Nat.html#t:FromNat" title="Matrix.Nat">FromNat</a> k) (<a href="Matrix-Nat.html#t:FromNat" title="Matrix.Nat">FromNat</a> j)) =&gt; <a href="Matrix-Nat.html#t:Matrix" title="Matrix.Nat">Matrix</a> e n k -&gt; <a href="Matrix-Nat.html#t:Matrix" title="Matrix.Nat">Matrix</a> e m j -&gt; <a href="Matrix-Nat.html#t:Matrix" title="Matrix.Nat">Matrix</a> e (n <a href="/package/base-4.12.0.0/docs/GHC-TypeNats.html#t:-43-" title="GHC.TypeNats">+</a> m) (k <a href="/package/base-4.12.0.0/docs/GHC-TypeNats.html#t:-43-" title="GHC.TypeNats">+</a> j) <span class="fixity">infixl 5</span><span class="rightedge"></span> <a href="src/Matrix.Nat.html#-%7C-" class="link">Source</a> <a href="#v:-45--124--45-" class="selflink">#</a></p></div><div class="top"><p class="src"><a id="v:-62--60-" class="def">(&gt;&lt;)</a> :: <span class="keyword">forall</span> e m p n q. (<a href="/package/base-4.12.0.0/docs/Prelude.html#t:Num" title="Prelude">Num</a> e, <a href="/package/base-4.12.0.0/docs/GHC-TypeNats.html#t:KnownNat" title="GHC.TypeNats">KnownNat</a> (<a href="Matrix-Nat.html#t:Count" title="Matrix.Nat">Count</a> (<a href="Matrix-Nat.html#t:FromNat" title="Matrix.Nat">FromNat</a> m)), <a href="/package/base-4.12.0.0/docs/GHC-TypeNats.html#t:KnownNat" title="GHC.TypeNats">KnownNat</a> (<a href="Matrix-Nat.html#t:Count" title="Matrix.Nat">Count</a> (<a href="Matrix-Nat.html#t:FromNat" title="Matrix.Nat">FromNat</a> n)), <a href="/package/base-4.12.0.0/docs/GHC-TypeNats.html#t:KnownNat" title="GHC.TypeNats">KnownNat</a> (<a href="Matrix-Nat.html#t:Count" title="Matrix.Nat">Count</a> (<a href="Matrix-Nat.html#t:FromNat" title="Matrix.Nat">FromNat</a> p)), <a href="/package/base-4.12.0.0/docs/GHC-TypeNats.html#t:KnownNat" title="GHC.TypeNats">KnownNat</a> (<a href="Matrix-Nat.html#t:Count" title="Matrix.Nat">Count</a> (<a href="Matrix-Nat.html#t:FromNat" title="Matrix.Nat">FromNat</a> q)), <a href="/package/base-4.12.0.0/docs/GHC-TypeNats.html#t:KnownNat" title="GHC.TypeNats">KnownNat</a> (<a href="Matrix-Nat.html#t:Count" title="Matrix.Nat">Count</a> (<a href="Matrix-Nat.html#t:FromNat" title="Matrix.Nat">FromNat</a> (m <a href="/package/base-4.12.0.0/docs/GHC-TypeNats.html#t:-42-" title="GHC.TypeNats">*</a> n))), <a href="/package/base-4.12.0.0/docs/GHC-TypeNats.html#t:KnownNat" title="GHC.TypeNats">KnownNat</a> (<a href="Matrix-Nat.html#t:Count" title="Matrix.Nat">Count</a> (<a href="Matrix-Nat.html#t:FromNat" title="Matrix.Nat">FromNat</a> (p <a href="/package/base-4.12.0.0/docs/GHC-TypeNats.html#t:-42-" title="GHC.TypeNats">*</a> q))), <a href="Matrix-Nat.html#t:FromLists" title="Matrix.Nat">FromLists</a> e (<a href="Matrix-Nat.html#t:FromNat" title="Matrix.Nat">FromNat</a> (m <a href="/package/base-4.12.0.0/docs/GHC-TypeNats.html#t:-42-" title="GHC.TypeNats">*</a> n)) (<a href="Matrix-Nat.html#t:FromNat" title="Matrix.Nat">FromNat</a> m), <a href="Matrix-Nat.html#t:FromLists" title="Matrix.Nat">FromLists</a> e (<a href="Matrix-Nat.html#t:FromNat" title="Matrix.Nat">FromNat</a> (m <a href="/package/base-4.12.0.0/docs/GHC-TypeNats.html#t:-42-" title="GHC.TypeNats">*</a> n)) (<a href="Matrix-Nat.html#t:FromNat" title="Matrix.Nat">FromNat</a> n), <a href="Matrix-Nat.html#t:FromLists" title="Matrix.Nat">FromLists</a> e (<a href="Matrix-Nat.html#t:FromNat" title="Matrix.Nat">FromNat</a> (p <a href="/package/base-4.12.0.0/docs/GHC-TypeNats.html#t:-42-" title="GHC.TypeNats">*</a> q)) (<a href="Matrix-Nat.html#t:FromNat" title="Matrix.Nat">FromNat</a> p), <a href="Matrix-Nat.html#t:FromLists" title="Matrix.Nat">FromLists</a> e (<a href="Matrix-Nat.html#t:FromNat" title="Matrix.Nat">FromNat</a> (p <a href="/package/base-4.12.0.0/docs/GHC-TypeNats.html#t:-42-" title="GHC.TypeNats">*</a> q)) (<a href="Matrix-Nat.html#t:FromNat" title="Matrix.Nat">FromNat</a> q), <a href="Matrix-Nat.html#t:FromNat" title="Matrix.Nat">FromNat</a> (m <a href="/package/base-4.12.0.0/docs/GHC-TypeNats.html#t:-42-" title="GHC.TypeNats">*</a> n) ~ <a href="Matrix-Nat.html#t:FromNat" title="Matrix.Nat">FromNat</a> (<a href="Matrix-Nat.html#t:Count" title="Matrix.Nat">Count</a> (<a href="Matrix-Nat.html#t:FromNat" title="Matrix.Nat">FromNat</a> m) <a href="/package/base-4.12.0.0/docs/GHC-TypeNats.html#t:-42-" title="GHC.TypeNats">*</a> <a href="Matrix-Nat.html#t:Count" title="Matrix.Nat">Count</a> (<a href="Matrix-Nat.html#t:FromNat" title="Matrix.Nat">FromNat</a> n)), <a href="Matrix-Nat.html#t:FromNat" title="Matrix.Nat">FromNat</a> (p <a href="/package/base-4.12.0.0/docs/GHC-TypeNats.html#t:-42-" title="GHC.TypeNats">*</a> q) ~ <a href="Matrix-Nat.html#t:FromNat" title="Matrix.Nat">FromNat</a> (<a href="Matrix-Nat.html#t:Count" title="Matrix.Nat">Count</a> (<a href="Matrix-Nat.html#t:FromNat" title="Matrix.Nat">FromNat</a> p) <a href="/package/base-4.12.0.0/docs/GHC-TypeNats.html#t:-42-" title="GHC.TypeNats">*</a> <a href="Matrix-Nat.html#t:Count" title="Matrix.Nat">Count</a> (<a href="Matrix-Nat.html#t:FromNat" title="Matrix.Nat">FromNat</a> q))) =&gt; <a href="Matrix-Nat.html#t:Matrix" title="Matrix.Nat">Matrix</a> e m p -&gt; <a href="Matrix-Nat.html#t:Matrix" title="Matrix.Nat">Matrix</a> e n q -&gt; <a href="Matrix-Nat.html#t:Matrix" title="Matrix.Nat">Matrix</a> e (m <a href="/package/base-4.12.0.0/docs/GHC-TypeNats.html#t:-42-" title="GHC.TypeNats">*</a> n) (p <a href="/package/base-4.12.0.0/docs/GHC-TypeNats.html#t:-42-" title="GHC.TypeNats">*</a> q) <span class="fixity">infixl 4</span><span class="rightedge"></span> <a href="src/Matrix.Nat.html#%3E%3C" class="link">Source</a> <a href="#v:-62--60-" class="selflink">#</a></p></div><a href="#g:17" id="g:17"><h2>Applicative matrix combinators</h2></a><div class="doc"><p>Note that given the restrictions imposed it is not possible to
20+ implement the standard type classes present in standard Haskell.
21+ *** Matrix pairing projections</p></div><div class="top"><p class="src"><a id="v:kp1" class="def">kp1</a> :: <span class="keyword">forall</span> e m k. (<a href="/package/base-4.12.0.0/docs/Prelude.html#t:Num" title="Prelude">Num</a> e, <a href="/package/base-4.12.0.0/docs/GHC-TypeNats.html#t:KnownNat" title="GHC.TypeNats">KnownNat</a> (<a href="Matrix-Nat.html#t:Count" title="Matrix.Nat">Count</a> (<a href="Matrix-Nat.html#t:FromNat" title="Matrix.Nat">FromNat</a> m)), <a href="/package/base-4.12.0.0/docs/GHC-TypeNats.html#t:KnownNat" title="GHC.TypeNats">KnownNat</a> (<a href="Matrix-Nat.html#t:Count" title="Matrix.Nat">Count</a> (<a href="Matrix-Nat.html#t:FromNat" title="Matrix.Nat">FromNat</a> k)), <a href="/package/base-4.12.0.0/docs/GHC-TypeNats.html#t:KnownNat" title="GHC.TypeNats">KnownNat</a> (<a href="Matrix-Nat.html#t:Count" title="Matrix.Nat">Count</a> (<a href="Matrix-Nat.html#t:FromNat" title="Matrix.Nat">FromNat</a> (m <a href="/package/base-4.12.0.0/docs/GHC-TypeNats.html#t:-42-" title="GHC.TypeNats">*</a> k))), <a href="Matrix-Nat.html#t:FromLists" title="Matrix.Nat">FromLists</a> e (<a href="Matrix-Nat.html#t:FromNat" title="Matrix.Nat">FromNat</a> (m <a href="/package/base-4.12.0.0/docs/GHC-TypeNats.html#t:-42-" title="GHC.TypeNats">*</a> k)) (<a href="Matrix-Nat.html#t:FromNat" title="Matrix.Nat">FromNat</a> m), <a href="Matrix-Nat.html#t:FromNat" title="Matrix.Nat">FromNat</a> (m <a href="/package/base-4.12.0.0/docs/GHC-TypeNats.html#t:-42-" title="GHC.TypeNats">*</a> k) ~ <a href="Matrix-Nat.html#t:FromNat" title="Matrix.Nat">FromNat</a> (<a href="Matrix-Nat.html#t:Count" title="Matrix.Nat">Count</a> (<a href="Matrix-Nat.html#t:FromNat" title="Matrix.Nat">FromNat</a> m) <a href="/package/base-4.12.0.0/docs/GHC-TypeNats.html#t:-42-" title="GHC.TypeNats">*</a> <a href="Matrix-Nat.html#t:Count" title="Matrix.Nat">Count</a> (<a href="Matrix-Nat.html#t:FromNat" title="Matrix.Nat">FromNat</a> k))) =&gt; <a href="Matrix-Nat.html#t:Matrix" title="Matrix.Nat">Matrix</a> e (m <a href="/package/base-4.12.0.0/docs/GHC-TypeNats.html#t:-42-" title="GHC.TypeNats">*</a> k) m <a href="src/Matrix.Nat.html#kp1" class="link">Source</a> <a href="#v:kp1" class="selflink">#</a></p></div><div class="top"><p class="src"><a id="v:kp2" class="def">kp2</a> :: <span class="keyword">forall</span> e m k. (<a href="/package/base-4.12.0.0/docs/Prelude.html#t:Num" title="Prelude">Num</a> e, <a href="/package/base-4.12.0.0/docs/GHC-TypeNats.html#t:KnownNat" title="GHC.TypeNats">KnownNat</a> (<a href="Matrix-Nat.html#t:Count" title="Matrix.Nat">Count</a> (<a href="Matrix-Nat.html#t:FromNat" title="Matrix.Nat">FromNat</a> k)), <a href="Matrix-Nat.html#t:FromLists" title="Matrix.Nat">FromLists</a> e (<a href="Matrix-Nat.html#t:FromNat" title="Matrix.Nat">FromNat</a> (m <a href="/package/base-4.12.0.0/docs/GHC-TypeNats.html#t:-42-" title="GHC.TypeNats">*</a> k)) (<a href="Matrix-Nat.html#t:FromNat" title="Matrix.Nat">FromNat</a> k), <a href="/package/base-4.12.0.0/docs/GHC-TypeNats.html#t:KnownNat" title="GHC.TypeNats">KnownNat</a> (<a href="Matrix-Nat.html#t:Count" title="Matrix.Nat">Count</a> (<a href="Matrix-Nat.html#t:FromNat" title="Matrix.Nat">FromNat</a> m)), <a href="/package/base-4.12.0.0/docs/GHC-TypeNats.html#t:KnownNat" title="GHC.TypeNats">KnownNat</a> (<a href="Matrix-Nat.html#t:Count" title="Matrix.Nat">Count</a> (<a href="Matrix-Nat.html#t:FromNat" title="Matrix.Nat">FromNat</a> (m <a href="/package/base-4.12.0.0/docs/GHC-TypeNats.html#t:-42-" title="GHC.TypeNats">*</a> k))), <a href="Matrix-Nat.html#t:FromNat" title="Matrix.Nat">FromNat</a> (m <a href="/package/base-4.12.0.0/docs/GHC-TypeNats.html#t:-42-" title="GHC.TypeNats">*</a> k) ~ <a href="Matrix-Nat.html#t:FromNat" title="Matrix.Nat">FromNat</a> (<a href="Matrix-Nat.html#t:Count" title="Matrix.Nat">Count</a> (<a href="Matrix-Nat.html#t:FromNat" title="Matrix.Nat">FromNat</a> m) <a href="/package/base-4.12.0.0/docs/GHC-TypeNats.html#t:-42-" title="GHC.TypeNats">*</a> <a href="Matrix-Nat.html#t:Count" title="Matrix.Nat">Count</a> (<a href="Matrix-Nat.html#t:FromNat" title="Matrix.Nat">FromNat</a> k))) =&gt; <a href="Matrix-Nat.html#t:Matrix" title="Matrix.Nat">Matrix</a> e (m <a href="/package/base-4.12.0.0/docs/GHC-TypeNats.html#t:-42-" title="GHC.TypeNats">*</a> k) k <a href="src/Matrix.Nat.html#kp2" class="link">Source</a> <a href="#v:kp2" class="selflink">#</a></p></div><a href="#g:18" id="g:18"><h3>Matrix pairing</h3></a><div class="top"><p class="src"><a id="v:khatri" class="def">khatri</a> :: <span class="keyword">forall</span> e cols a b. (<a href="/package/base-4.12.0.0/docs/Prelude.html#t:Num" title="Prelude">Num</a> e, <a href="/package/base-4.12.0.0/docs/GHC-TypeNats.html#t:KnownNat" title="GHC.TypeNats">KnownNat</a> (<a href="Matrix-Nat.html#t:Count" title="Matrix.Nat">Count</a> (<a href="Matrix-Nat.html#t:FromNat" title="Matrix.Nat">FromNat</a> a)), <a href="/package/base-4.12.0.0/docs/GHC-TypeNats.html#t:KnownNat" title="GHC.TypeNats">KnownNat</a> (<a href="Matrix-Nat.html#t:Count" title="Matrix.Nat">Count</a> (<a href="Matrix-Nat.html#t:FromNat" title="Matrix.Nat">FromNat</a> b)), <a href="/package/base-4.12.0.0/docs/GHC-TypeNats.html#t:KnownNat" title="GHC.TypeNats">KnownNat</a> (<a href="Matrix-Nat.html#t:Count" title="Matrix.Nat">Count</a> (<a href="Matrix-Nat.html#t:FromNat" title="Matrix.Nat">FromNat</a> (a <a href="/package/base-4.12.0.0/docs/GHC-TypeNats.html#t:-42-" title="GHC.TypeNats">*</a> b))), <a href="Matrix-Nat.html#t:FromLists" title="Matrix.Nat">FromLists</a> e (<a href="Matrix-Nat.html#t:FromNat" title="Matrix.Nat">FromNat</a> (a <a href="/package/base-4.12.0.0/docs/GHC-TypeNats.html#t:-42-" title="GHC.TypeNats">*</a> b)) (<a href="Matrix-Nat.html#t:FromNat" title="Matrix.Nat">FromNat</a> a), <a href="Matrix-Nat.html#t:FromLists" title="Matrix.Nat">FromLists</a> e (<a href="Matrix-Nat.html#t:FromNat" title="Matrix.Nat">FromNat</a> (a <a href="/package/base-4.12.0.0/docs/GHC-TypeNats.html#t:-42-" title="GHC.TypeNats">*</a> b)) (<a href="Matrix-Nat.html#t:FromNat" title="Matrix.Nat">FromNat</a> b), <a href="Matrix-Nat.html#t:FromNat" title="Matrix.Nat">FromNat</a> (a <a href="/package/base-4.12.0.0/docs/GHC-TypeNats.html#t:-42-" title="GHC.TypeNats">*</a> b) ~ <a href="Matrix-Nat.html#t:FromNat" title="Matrix.Nat">FromNat</a> (<a href="Matrix-Nat.html#t:Count" title="Matrix.Nat">Count</a> (<a href="Matrix-Nat.html#t:FromNat" title="Matrix.Nat">FromNat</a> a) <a href="/package/base-4.12.0.0/docs/GHC-TypeNats.html#t:-42-" title="GHC.TypeNats">*</a> <a href="Matrix-Nat.html#t:Count" title="Matrix.Nat">Count</a> (<a href="Matrix-Nat.html#t:FromNat" title="Matrix.Nat">FromNat</a> b))) =&gt; <a href="Matrix-Nat.html#t:Matrix" title="Matrix.Nat">Matrix</a> e cols a -&gt; <a href="Matrix-Nat.html#t:Matrix" title="Matrix.Nat">Matrix</a> e cols b -&gt; <a href="Matrix-Nat.html#t:Matrix" title="Matrix.Nat">Matrix</a> e cols (a <a href="/package/base-4.12.0.0/docs/GHC-TypeNats.html#t:-42-" title="GHC.TypeNats">*</a> b) <a href="src/Matrix.Nat.html#khatri" class="link">Source</a> <a href="#v:khatri" class="selflink">#</a></p></div><a href="#g:19" id="g:19"><h1>Matrix composition and lifting</h1></a><a href="#g:20" id="g:20"><h2>Arrow matrix combinators</h2></a><div class="doc"><p>Note that given the restrictions imposed it is not possible to
22+ implement the standard type classes present in standard Haskell.</p></div><div class="top"><p class="src"><a id="v:identity" class="def">identity</a> :: (<a href="/package/base-4.12.0.0/docs/Prelude.html#t:Num" title="Prelude">Num</a> e, <a href="Matrix-Nat.html#t:FromLists" title="Matrix.Nat">FromLists</a> e (<a href="Matrix-Nat.html#t:FromNat" title="Matrix.Nat">FromNat</a> cols) (<a href="Matrix-Nat.html#t:FromNat" title="Matrix.Nat">FromNat</a> cols), <a href="/package/base-4.12.0.0/docs/GHC-TypeNats.html#t:KnownNat" title="GHC.TypeNats">KnownNat</a> (<a href="Matrix-Nat.html#t:Count" title="Matrix.Nat">Count</a> (<a href="Matrix-Nat.html#t:FromNat" title="Matrix.Nat">FromNat</a> cols))) =&gt; <a href="Matrix-Nat.html#t:Matrix" title="Matrix.Nat">Matrix</a> e cols cols <a href="src/Matrix.Nat.html#identity" class="link">Source</a> <a href="#v:identity" class="selflink">#</a></p></div><div class="top"><p class="src"><a id="v:comp" class="def">comp</a> :: <a href="/package/base-4.12.0.0/docs/Prelude.html#t:Num" title="Prelude">Num</a> e =&gt; <a href="Matrix-Nat.html#t:Matrix" title="Matrix.Nat">Matrix</a> e cr rows -&gt; <a href="Matrix-Nat.html#t:Matrix" title="Matrix.Nat">Matrix</a> e cols cr -&gt; <a href="Matrix-Nat.html#t:Matrix" title="Matrix.Nat">Matrix</a> e cols rows <a href="src/Matrix.Nat.html#comp" class="link">Source</a> <a href="#v:comp" class="selflink">#</a></p></div><div class="top"><p class="src"><a id="v:fromF" class="def">fromF</a> :: (<a href="/package/base-4.12.0.0/docs/Prelude.html#t:Bounded" title="Prelude">Bounded</a> a, <a href="/package/base-4.12.0.0/docs/Prelude.html#t:Bounded" title="Prelude">Bounded</a> b, <a href="/package/base-4.12.0.0/docs/Prelude.html#t:Enum" title="Prelude">Enum</a> a, <a href="/package/base-4.12.0.0/docs/Prelude.html#t:Enum" title="Prelude">Enum</a> b, <a href="/package/base-4.12.0.0/docs/Data-Eq.html#t:Eq" title="Data.Eq">Eq</a> b, <a href="/package/base-4.12.0.0/docs/Prelude.html#t:Num" title="Prelude">Num</a> e, <a href="/package/base-4.12.0.0/docs/Data-Ord.html#t:Ord" title="Data.Ord">Ord</a> e, <a href="/package/base-4.12.0.0/docs/GHC-TypeNats.html#t:KnownNat" title="GHC.TypeNats">KnownNat</a> (<a href="Matrix-Nat.html#t:Count" title="Matrix.Nat">Count</a> (<a href="Matrix-Nat.html#t:FromNat" title="Matrix.Nat">FromNat</a> cols)), <a href="/package/base-4.12.0.0/docs/GHC-TypeNats.html#t:KnownNat" title="GHC.TypeNats">KnownNat</a> (<a href="Matrix-Nat.html#t:Count" title="Matrix.Nat">Count</a> (<a href="Matrix-Nat.html#t:FromNat" title="Matrix.Nat">FromNat</a> rows)), <a href="Matrix-Nat.html#t:FromLists" title="Matrix.Nat">FromLists</a> e (<a href="Matrix-Nat.html#t:FromNat" title="Matrix.Nat">FromNat</a> rows) (<a href="Matrix-Nat.html#t:FromNat" title="Matrix.Nat">FromNat</a> cols)) =&gt; (a -&gt; b) -&gt; <a href="Matrix-Nat.html#t:Matrix" title="Matrix.Nat">Matrix</a> e cols rows <a href="src/Matrix.Nat.html#fromF" class="link">Source</a> <a href="#v:fromF" class="selflink">#</a></p></div><div class="top"><p class="src"><a id="v:fromF-39-" class="def">fromF'</a> :: (<a href="/package/base-4.12.0.0/docs/Prelude.html#t:Bounded" title="Prelude">Bounded</a> a, <a href="/package/base-4.12.0.0/docs/Prelude.html#t:Bounded" title="Prelude">Bounded</a> b, <a href="/package/base-4.12.0.0/docs/Prelude.html#t:Enum" title="Prelude">Enum</a> a, <a href="/package/base-4.12.0.0/docs/Prelude.html#t:Enum" title="Prelude">Enum</a> b, <a href="/package/base-4.12.0.0/docs/Data-Eq.html#t:Eq" title="Data.Eq">Eq</a> b, <a href="/package/base-4.12.0.0/docs/Prelude.html#t:Num" title="Prelude">Num</a> e, <a href="/package/base-4.12.0.0/docs/Data-Ord.html#t:Ord" title="Data.Ord">Ord</a> e, <a href="/package/base-4.12.0.0/docs/GHC-TypeNats.html#t:KnownNat" title="GHC.TypeNats">KnownNat</a> (<a href="Matrix-Nat.html#t:Count" title="Matrix.Nat">Count</a> (<a href="Matrix-Nat.html#t:Normalize" title="Matrix.Nat">Normalize</a> a)), <a href="/package/base-4.12.0.0/docs/GHC-TypeNats.html#t:KnownNat" title="GHC.TypeNats">KnownNat</a> (<a href="Matrix-Nat.html#t:Count" title="Matrix.Nat">Count</a> (<a href="Matrix-Nat.html#t:Normalize" title="Matrix.Nat">Normalize</a> b)), <a href="Matrix-Nat.html#t:FromLists" title="Matrix.Nat">FromLists</a> e (<a href="Matrix-Nat.html#t:Normalize" title="Matrix.Nat">Normalize</a> b) (<a href="Matrix-Nat.html#t:Normalize" title="Matrix.Nat">Normalize</a> a)) =&gt; (a -&gt; b) -&gt; <a href="Matrix-Nat.html#t:Matrix" title="Matrix.Nat">Matrix</a> e (<a href="Matrix-Nat.html#t:Count" title="Matrix.Nat">Count</a> a) (<a href="Matrix-Nat.html#t:Count" title="Matrix.Nat">Count</a> b) <a href="src/Matrix.Nat.html#fromF%27" class="link">Source</a> <a href="#v:fromF-39-" class="selflink">#</a></p></div><a href="#g:21" id="g:21"><h1>Matrix printing</h1></a><div class="top"><p class="src"><a id="v:pretty" class="def">pretty</a> :: (<a href="/package/base-4.12.0.0/docs/GHC-TypeNats.html#t:KnownNat" title="GHC.TypeNats">KnownNat</a> (<a href="Matrix-Nat.html#t:Count" title="Matrix.Nat">Count</a> (<a href="Matrix-Nat.html#t:FromNat" title="Matrix.Nat">FromNat</a> cols)), <a href="/package/base-4.12.0.0/docs/Text-Show.html#t:Show" title="Text.Show">Show</a> e) =&gt; <a href="Matrix-Nat.html#t:Matrix" title="Matrix.Nat">Matrix</a> e cols rows -&gt; <a href="/package/base-4.12.0.0/docs/Data-String.html#t:String" title="Data.String">String</a> <a href="src/Matrix.Nat.html#pretty" class="link">Source</a> <a href="#v:pretty" class="selflink">#</a></p></div><div class="top"><p class="src"><a id="v:prettyPrint" class="def">prettyPrint</a> :: (<a href="/package/base-4.12.0.0/docs/GHC-TypeNats.html#t:KnownNat" title="GHC.TypeNats">KnownNat</a> (<a href="Matrix-Nat.html#t:Count" title="Matrix.Nat">Count</a> (<a href="Matrix-Nat.html#t:FromNat" title="Matrix.Nat">FromNat</a> cols)), <a href="/package/base-4.12.0.0/docs/Text-Show.html#t:Show" title="Text.Show">Show</a> e) =&gt; <a href="Matrix-Nat.html#t:Matrix" title="Matrix.Nat">Matrix</a> e cols rows -&gt; <a href="/package/base-4.12.0.0/docs/System-IO.html#t:IO" title="System.IO">IO</a> () <a href="src/Matrix.Nat.html#prettyPrint" class="link">Source</a> <a href="#v:prettyPrint" class="selflink">#</a></p></div></div></div><div id="footer"><p>Produced by <a href="http://www.haskell.org/haddock/">Haddock</a> version 2.22.0</p></div></body></html>
build/x86_64-linux/ghc-8.6.5/laop-0.1.0.0/doc/html/laop-0.1.0.0-docs/Matrix-Type.htmlnew file+36
@@ -0,0 +1,36 @@
1+<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"><html xmlns="http://www.w3.org/1999/xhtml"><head><meta http-equiv="Content-Type" content="text/html; charset=UTF-8" /><title>Matrix.Type</title><link href="ocean.css" rel="stylesheet" type="text/css" title="Ocean" /><link rel="stylesheet" type="text/css" href="quick-jump.css" /><script src="haddock-bundle.min.js" async="async" type="text/javascript"></script><script src="https://cdnjs.cloudflare.com/ajax/libs/mathjax/2.7.0/MathJax.js?config=TeX-AMS-MML_HTMLorMML" type="text/javascript"></script></head><body><div id="package-header"><ul class="links" id="page-menu"><li><a href="src/Matrix.Type.html">Source</a></li><li><a href="/package/laop-0.1.0.0">Contents</a></li><li><a href="doc-index.html">Index</a></li></ul><p class="caption">laop-0.1.0.0: An inductive matrix definition library &#224; la LAoP</p></div><div id="content"><div id="module-header"><table class="info"><tr><th valign="top">Copyright</th><td>(c) Armando Santos 2019-2020</td></tr><tr><th>Maintainer</th><td>armandoifsantos@gmail.com</td></tr><tr><th>Stability</th><td>experimental</td></tr><tr><th>Safe Haskell</th><td>None</td></tr><tr><th>Language</th><td>Haskell2010</td></tr></table><p class="caption">Matrix.Type</p></div><div id="table-of-contents"><p class="caption">Contents</p><ul><li><a href="#g:1">Type safe matrix representation</a></li><li><a href="#g:2">Type aliases</a></li><li><a href="#g:3">Primitives</a></li><li><a href="#g:4">Auxiliary type families</a></li><li><a href="#g:5">Matrix construction and conversion</a></li><li><a href="#g:6">Functor instance equivalent function</a></li><li><a href="#g:7">Applicative/Monoidal instance equivalent functions</a></li><li><a href="#g:8">Selective equivalent instance function</a></li><li><a href="#g:9">Monad equivalent instance function</a></li><li><a href="#g:10">Misc</a><ul><li><a href="#g:11">Get dimensions</a></li><li><a href="#g:12">Matrix Transposition</a></li><li><a href="#g:13">McCarthy's Conditional</a></li><li><a href="#g:14">Matrix &quot;abiding&quot;</a></li></ul></li><li><a href="#g:15">Biproduct approach</a><ul><li><a href="#g:16">Split</a><ul><li><a href="#g:17">Projections</a></li></ul></li><li><a href="#g:18">Junc</a><ul><li><a href="#g:19">Injections</a></li></ul></li><li><a href="#g:20">Bifunctors</a></li><li><a href="#g:21">Applicative matrix combinators</a><ul><li><a href="#g:22">Matrix pairing</a></li></ul></li></ul></li><li><a href="#g:23">Matrix composition and lifting</a><ul><li><a href="#g:24">Arrow matrix combinators</a></li></ul></li><li><a href="#g:25">Matrix printing</a></li></ul></div><div id="description"><p class="caption">Description</p><div class="doc"><p>The LAoP discipline generalises relations and functions treating them as
2+ Boolean matrices and in turn consider these as arrows.</p><p><strong>LAoP</strong> is a library for algebraic (inductive) construction and manipulation of matrices
3+ in Haskell. See <a href="https://github.com/bolt12/master-thesis">my Msc Thesis</a> for the
4+ motivation behind the library, the underlying theory, and implementation details.</p><p>This module offers a newtype wrapper around <code><a href="Matrix-Type.html#t:Matrix" title="Matrix.Type">Matrix</a></code> that
5+ uses arbitrary types instead of canonical data types for the matrices
6+ dimensions.</p><p><strong>NOTE</strong>: If the types in the dimensions are custom they must need to
7+ implement a <code>Generic</code> instance.</p></div></div><div id="synopsis"><details id="syn"><summary>Synopsis</summary><ul class="details-toggle" data-details-id="syn"><li class="src short"><span class="keyword">newtype</span> <a href="#t:Matrix">Matrix</a> e (cols :: <a href="/package/base-4.12.0.0/docs/Data-Kind.html#t:Type" title="Data.Kind">Type</a>) (rows :: <a href="/package/base-4.12.0.0/docs/Data-Kind.html#t:Type" title="Data.Kind">Type</a>) = <a href="#v:M">M</a> (Matrix e (<a href="Matrix-Type.html#t:Normalize" title="Matrix.Type">Normalize</a> cols) (<a href="Matrix-Type.html#t:Normalize" title="Matrix.Type">Normalize</a> rows))</li><li class="src short"><span class="keyword">type</span> <a href="#t:Zero">Zero</a> = <a href="/package/base-4.12.0.0/docs/Data-Void.html#t:Void" title="Data.Void">Void</a></li><li class="src short"><span class="keyword">type</span> <a href="#t:One">One</a> = ()</li><li class="src short"><a href="#v:empty">empty</a> :: <a href="Matrix-Type.html#t:Matrix" title="Matrix.Type">Matrix</a> e <a href="Matrix-Type.html#t:Zero" title="Matrix.Type">Zero</a> <a href="Matrix-Type.html#t:Zero" title="Matrix.Type">Zero</a></li><li class="src short"><a href="#v:one">one</a> :: e -&gt; <a href="Matrix-Type.html#t:Matrix" title="Matrix.Type">Matrix</a> e <a href="Matrix-Type.html#t:One" title="Matrix.Type">One</a> <a href="Matrix-Type.html#t:One" title="Matrix.Type">One</a></li><li class="src short"><a href="#v:junc">junc</a> :: <a href="Matrix-Type.html#t:Normalize" title="Matrix.Type">Normalize</a> (<a href="/package/base-4.12.0.0/docs/Data-Either.html#t:Either" title="Data.Either">Either</a> a b) ~ <a href="/package/base-4.12.0.0/docs/Data-Either.html#t:Either" title="Data.Either">Either</a> (<a href="Matrix-Type.html#t:Normalize" title="Matrix.Type">Normalize</a> a) (<a href="Matrix-Type.html#t:Normalize" title="Matrix.Type">Normalize</a> b) =&gt; <a href="Matrix-Type.html#t:Matrix" title="Matrix.Type">Matrix</a> e a rows -&gt; <a href="Matrix-Type.html#t:Matrix" title="Matrix.Type">Matrix</a> e b rows -&gt; <a href="Matrix-Type.html#t:Matrix" title="Matrix.Type">Matrix</a> e (<a href="/package/base-4.12.0.0/docs/Data-Either.html#t:Either" title="Data.Either">Either</a> a b) rows</li><li class="src short"><a href="#v:split">split</a> :: <a href="Matrix-Type.html#t:Normalize" title="Matrix.Type">Normalize</a> (<a href="/package/base-4.12.0.0/docs/Data-Either.html#t:Either" title="Data.Either">Either</a> a b) ~ <a href="/package/base-4.12.0.0/docs/Data-Either.html#t:Either" title="Data.Either">Either</a> (<a href="Matrix-Type.html#t:Normalize" title="Matrix.Type">Normalize</a> a) (<a href="Matrix-Type.html#t:Normalize" title="Matrix.Type">Normalize</a> b) =&gt; <a href="Matrix-Type.html#t:Matrix" title="Matrix.Type">Matrix</a> e cols a -&gt; <a href="Matrix-Type.html#t:Matrix" title="Matrix.Type">Matrix</a> e cols b -&gt; <a href="Matrix-Type.html#t:Matrix" title="Matrix.Type">Matrix</a> e cols (<a href="/package/base-4.12.0.0/docs/Data-Either.html#t:Either" title="Data.Either">Either</a> a b)</li><li class="src short"><span class="keyword">type family</span> <a href="#t:FromNat">FromNat</a> (n :: <a href="/package/base-4.12.0.0/docs/GHC-TypeNats.html#t:Nat" title="GHC.TypeNats">Nat</a>) :: <a href="/package/base-4.12.0.0/docs/Data-Kind.html#t:Type" title="Data.Kind">Type</a> <span class="keyword">where ...</span></li><li class="src short"><span class="keyword">type family</span> <a href="#t:Count">Count</a> (d :: <a href="/package/base-4.12.0.0/docs/Data-Kind.html#t:Type" title="Data.Kind">Type</a>) :: <a href="/package/base-4.12.0.0/docs/GHC-TypeNats.html#t:Nat" title="GHC.TypeNats">Nat</a> <span class="keyword">where ...</span></li><li class="src short"><span class="keyword">type family</span> <a href="#t:Normalize">Normalize</a> (d :: <a href="/package/base-4.12.0.0/docs/Data-Kind.html#t:Type" title="Data.Kind">Type</a>) :: <a href="/package/base-4.12.0.0/docs/Data-Kind.html#t:Type" title="Data.Kind">Type</a> <span class="keyword">where ...</span></li><li class="src short"><span class="keyword">class</span> <a href="#t:FromLists">FromLists</a> e cols rows</li><li class="src short"><a href="#v:fromLists">fromLists</a> :: <a href="Matrix-Type.html#t:FromLists" title="Matrix.Type">FromLists</a> e (<a href="Matrix-Type.html#t:Normalize" title="Matrix.Type">Normalize</a> cols) (<a href="Matrix-Type.html#t:Normalize" title="Matrix.Type">Normalize</a> rows) =&gt; [[e]] -&gt; <a href="Matrix-Type.html#t:Matrix" title="Matrix.Type">Matrix</a> e cols rows</li><li class="src short"><a href="#v:toLists">toLists</a> :: <a href="Matrix-Type.html#t:Matrix" title="Matrix.Type">Matrix</a> e cols rows -&gt; [[e]]</li><li class="src short"><a href="#v:toList">toList</a> :: <a href="Matrix-Type.html#t:Matrix" title="Matrix.Type">Matrix</a> e cols rows -&gt; [e]</li><li class="src short"><a href="#v:matrixBuilder">matrixBuilder</a> :: (<a href="Matrix-Type.html#t:FromLists" title="Matrix.Type">FromLists</a> e (<a href="Matrix-Type.html#t:Normalize" title="Matrix.Type">Normalize</a> cols) (<a href="Matrix-Type.html#t:Normalize" title="Matrix.Type">Normalize</a> rows), <a href="/package/base-4.12.0.0/docs/GHC-TypeNats.html#t:KnownNat" title="GHC.TypeNats">KnownNat</a> (<a href="Matrix-Type.html#t:Count" title="Matrix.Type">Count</a> (<a href="Matrix-Type.html#t:Normalize" title="Matrix.Type">Normalize</a> cols)), <a href="/package/base-4.12.0.0/docs/GHC-TypeNats.html#t:KnownNat" title="GHC.TypeNats">KnownNat</a> (<a href="Matrix-Type.html#t:Count" title="Matrix.Type">Count</a> (<a href="Matrix-Type.html#t:Normalize" title="Matrix.Type">Normalize</a> rows))) =&gt; ((<a href="/package/base-4.12.0.0/docs/Data-Int.html#t:Int" title="Data.Int">Int</a>, <a href="/package/base-4.12.0.0/docs/Data-Int.html#t:Int" title="Data.Int">Int</a>) -&gt; e) -&gt; <a href="Matrix-Type.html#t:Matrix" title="Matrix.Type">Matrix</a> e cols rows</li><li class="src short"><a href="#v:row">row</a> :: <a href="Matrix-Type.html#t:FromLists" title="Matrix.Type">FromLists</a> e (<a href="Matrix-Type.html#t:Normalize" title="Matrix.Type">Normalize</a> cols) () =&gt; [e] -&gt; <a href="Matrix-Type.html#t:Matrix" title="Matrix.Type">Matrix</a> e cols <a href="Matrix-Type.html#t:One" title="Matrix.Type">One</a></li><li class="src short"><a href="#v:col">col</a> :: <a href="Matrix-Type.html#t:FromLists" title="Matrix.Type">FromLists</a> e () (<a href="Matrix-Type.html#t:Normalize" title="Matrix.Type">Normalize</a> rows) =&gt; [e] -&gt; <a href="Matrix-Type.html#t:Matrix" title="Matrix.Type">Matrix</a> e <a href="Matrix-Type.html#t:One" title="Matrix.Type">One</a> rows</li><li class="src short"><a href="#v:zeros">zeros</a> :: (<a href="/package/base-4.12.0.0/docs/Prelude.html#t:Num" title="Prelude">Num</a> e, <a href="Matrix-Type.html#t:FromLists" title="Matrix.Type">FromLists</a> e (<a href="Matrix-Type.html#t:Normalize" title="Matrix.Type">Normalize</a> cols) (<a href="Matrix-Type.html#t:Normalize" title="Matrix.Type">Normalize</a> rows), <a href="/package/base-4.12.0.0/docs/GHC-TypeNats.html#t:KnownNat" title="GHC.TypeNats">KnownNat</a> (<a href="Matrix-Type.html#t:Count" title="Matrix.Type">Count</a> (<a href="Matrix-Type.html#t:Normalize" title="Matrix.Type">Normalize</a> cols)), <a href="/package/base-4.12.0.0/docs/GHC-TypeNats.html#t:KnownNat" title="GHC.TypeNats">KnownNat</a> (<a href="Matrix-Type.html#t:Count" title="Matrix.Type">Count</a> (<a href="Matrix-Type.html#t:Normalize" title="Matrix.Type">Normalize</a> rows))) =&gt; <a href="Matrix-Type.html#t:Matrix" title="Matrix.Type">Matrix</a> e cols rows</li><li class="src short"><a href="#v:ones">ones</a> :: (<a href="/package/base-4.12.0.0/docs/Prelude.html#t:Num" title="Prelude">Num</a> e, <a href="Matrix-Type.html#t:FromLists" title="Matrix.Type">FromLists</a> e (<a href="Matrix-Type.html#t:Normalize" title="Matrix.Type">Normalize</a> cols) (<a href="Matrix-Type.html#t:Normalize" title="Matrix.Type">Normalize</a> rows), <a href="/package/base-4.12.0.0/docs/GHC-TypeNats.html#t:KnownNat" title="GHC.TypeNats">KnownNat</a> (<a href="Matrix-Type.html#t:Count" title="Matrix.Type">Count</a> (<a href="Matrix-Type.html#t:Normalize" title="Matrix.Type">Normalize</a> cols)), <a href="/package/base-4.12.0.0/docs/GHC-TypeNats.html#t:KnownNat" title="GHC.TypeNats">KnownNat</a> (<a href="Matrix-Type.html#t:Count" title="Matrix.Type">Count</a> (<a href="Matrix-Type.html#t:Normalize" title="Matrix.Type">Normalize</a> rows))) =&gt; <a href="Matrix-Type.html#t:Matrix" title="Matrix.Type">Matrix</a> e cols rows</li><li class="src short"><a href="#v:bang">bang</a> :: <span class="keyword">forall</span> e cols. (<a href="/package/base-4.12.0.0/docs/Prelude.html#t:Num" title="Prelude">Num</a> e, <a href="/package/base-4.12.0.0/docs/Prelude.html#t:Enum" title="Prelude">Enum</a> e, <a href="Matrix-Type.html#t:FromLists" title="Matrix.Type">FromLists</a> e (<a href="Matrix-Type.html#t:Normalize" title="Matrix.Type">Normalize</a> cols) (), <a href="/package/base-4.12.0.0/docs/GHC-TypeNats.html#t:KnownNat" title="GHC.TypeNats">KnownNat</a> (<a href="Matrix-Type.html#t:Count" title="Matrix.Type">Count</a> (<a href="Matrix-Type.html#t:Normalize" title="Matrix.Type">Normalize</a> cols))) =&gt; <a href="Matrix-Type.html#t:Matrix" title="Matrix.Type">Matrix</a> e cols <a href="Matrix-Type.html#t:One" title="Matrix.Type">One</a></li><li class="src short"><a href="#v:constant">constant</a> :: (<a href="/package/base-4.12.0.0/docs/Prelude.html#t:Num" title="Prelude">Num</a> e, <a href="Matrix-Type.html#t:FromLists" title="Matrix.Type">FromLists</a> e (<a href="Matrix-Type.html#t:Normalize" title="Matrix.Type">Normalize</a> cols) (<a href="Matrix-Type.html#t:Normalize" title="Matrix.Type">Normalize</a> rows), <a href="/package/base-4.12.0.0/docs/GHC-TypeNats.html#t:KnownNat" title="GHC.TypeNats">KnownNat</a> (<a href="Matrix-Type.html#t:Count" title="Matrix.Type">Count</a> (<a href="Matrix-Type.html#t:Normalize" title="Matrix.Type">Normalize</a> cols)), <a href="/package/base-4.12.0.0/docs/GHC-TypeNats.html#t:KnownNat" title="GHC.TypeNats">KnownNat</a> (<a href="Matrix-Type.html#t:Count" title="Matrix.Type">Count</a> (<a href="Matrix-Type.html#t:Normalize" title="Matrix.Type">Normalize</a> rows))) =&gt; e -&gt; <a href="Matrix-Type.html#t:Matrix" title="Matrix.Type">Matrix</a> e cols rows</li><li class="src short"><a href="#v:fmapM">fmapM</a> :: (<a href="/package/base-4.12.0.0/docs/Prelude.html#t:Bounded" title="Prelude">Bounded</a> a, <a href="/package/base-4.12.0.0/docs/Prelude.html#t:Bounded" title="Prelude">Bounded</a> b, <a href="/package/base-4.12.0.0/docs/Prelude.html#t:Enum" title="Prelude">Enum</a> a, <a href="/package/base-4.12.0.0/docs/Prelude.html#t:Enum" title="Prelude">Enum</a> b, <a href="/package/base-4.12.0.0/docs/Data-Eq.html#t:Eq" title="Data.Eq">Eq</a> b, <a href="/package/base-4.12.0.0/docs/Prelude.html#t:Num" title="Prelude">Num</a> e, <a href="/package/base-4.12.0.0/docs/Data-Ord.html#t:Ord" title="Data.Ord">Ord</a> e, <a href="/package/base-4.12.0.0/docs/GHC-TypeNats.html#t:KnownNat" title="GHC.TypeNats">KnownNat</a> (<a href="Matrix-Type.html#t:Count" title="Matrix.Type">Count</a> (<a href="Matrix-Type.html#t:Normalize" title="Matrix.Type">Normalize</a> a)), <a href="/package/base-4.12.0.0/docs/GHC-TypeNats.html#t:KnownNat" title="GHC.TypeNats">KnownNat</a> (<a href="Matrix-Type.html#t:Count" title="Matrix.Type">Count</a> (<a href="Matrix-Type.html#t:Normalize" title="Matrix.Type">Normalize</a> b)), <a href="Matrix-Type.html#t:FromLists" title="Matrix.Type">FromLists</a> e (<a href="Matrix-Type.html#t:Normalize" title="Matrix.Type">Normalize</a> b) (<a href="Matrix-Type.html#t:Normalize" title="Matrix.Type">Normalize</a> a)) =&gt; (a -&gt; b) -&gt; <a href="Matrix-Type.html#t:Matrix" title="Matrix.Type">Matrix</a> e c a -&gt; <a href="Matrix-Type.html#t:Matrix" title="Matrix.Type">Matrix</a> e c b</li><li class="src short"><a href="#v:unitM">unitM</a> :: <a href="/package/base-4.12.0.0/docs/Prelude.html#t:Num" title="Prelude">Num</a> e =&gt; <a href="Matrix-Type.html#t:Matrix" title="Matrix.Type">Matrix</a> e () ()</li><li class="src short"><a href="#v:multM">multM</a> :: (<a href="/package/base-4.12.0.0/docs/GHC-TypeNats.html#t:KnownNat" title="GHC.TypeNats">KnownNat</a> (<a href="Matrix-Type.html#t:Count" title="Matrix.Type">Count</a> (<a href="Matrix-Type.html#t:Normalize" title="Matrix.Type">Normalize</a> a)), <a href="/package/base-4.12.0.0/docs/GHC-TypeNats.html#t:KnownNat" title="GHC.TypeNats">KnownNat</a> (<a href="Matrix-Type.html#t:Count" title="Matrix.Type">Count</a> (<a href="Matrix-Type.html#t:Normalize" title="Matrix.Type">Normalize</a> b)), <a href="/package/base-4.12.0.0/docs/GHC-TypeNats.html#t:KnownNat" title="GHC.TypeNats">KnownNat</a> (<a href="Matrix-Type.html#t:Count" title="Matrix.Type">Count</a> (<a href="Matrix-Type.html#t:Normalize" title="Matrix.Type">Normalize</a> (a, b))), <a href="/package/base-4.12.0.0/docs/Prelude.html#t:Num" title="Prelude">Num</a> e, <a href="Matrix-Type.html#t:FromLists" title="Matrix.Type">FromLists</a> e (<a href="Matrix-Type.html#t:Normalize" title="Matrix.Type">Normalize</a> (a, b)) (<a href="Matrix-Type.html#t:Normalize" title="Matrix.Type">Normalize</a> a), <a href="Matrix-Type.html#t:FromLists" title="Matrix.Type">FromLists</a> e (<a href="Matrix-Type.html#t:Normalize" title="Matrix.Type">Normalize</a> (a, b)) (<a href="Matrix-Type.html#t:Normalize" title="Matrix.Type">Normalize</a> b), <a href="Matrix-Type.html#t:Normalize" title="Matrix.Type">Normalize</a> (a, b) ~ <a href="Matrix-Type.html#t:Normalize" title="Matrix.Type">Normalize</a> (<a href="Matrix-Type.html#t:Normalize" title="Matrix.Type">Normalize</a> a, <a href="Matrix-Type.html#t:Normalize" title="Matrix.Type">Normalize</a> b)) =&gt; <a href="Matrix-Type.html#t:Matrix" title="Matrix.Type">Matrix</a> e c a -&gt; <a href="Matrix-Type.html#t:Matrix" title="Matrix.Type">Matrix</a> e c b -&gt; <a href="Matrix-Type.html#t:Matrix" title="Matrix.Type">Matrix</a> e c (a, b)</li><li class="src short"><a href="#v:selectM">selectM</a> :: (<a href="/package/base-4.12.0.0/docs/Prelude.html#t:Num" title="Prelude">Num</a> e, <a href="Matrix-Type.html#t:FromLists" title="Matrix.Type">FromLists</a> e (<a href="Matrix-Type.html#t:Normalize" title="Matrix.Type">Normalize</a> b) (<a href="Matrix-Type.html#t:Normalize" title="Matrix.Type">Normalize</a> b), <a href="/package/base-4.12.0.0/docs/GHC-TypeNats.html#t:KnownNat" title="GHC.TypeNats">KnownNat</a> (<a href="Matrix-Type.html#t:Count" title="Matrix.Type">Count</a> (<a href="Matrix-Type.html#t:Normalize" title="Matrix.Type">Normalize</a> b)), <a href="Matrix-Type.html#t:Normalize" title="Matrix.Type">Normalize</a> (<a href="/package/base-4.12.0.0/docs/Data-Either.html#t:Either" title="Data.Either">Either</a> a b) ~ <a href="/package/base-4.12.0.0/docs/Data-Either.html#t:Either" title="Data.Either">Either</a> (<a href="Matrix-Type.html#t:Normalize" title="Matrix.Type">Normalize</a> a) (<a href="Matrix-Type.html#t:Normalize" title="Matrix.Type">Normalize</a> b)) =&gt; <a href="Matrix-Type.html#t:Matrix" title="Matrix.Type">Matrix</a> e cols (<a href="/package/base-4.12.0.0/docs/Data-Either.html#t:Either" title="Data.Either">Either</a> a b) -&gt; <a href="Matrix-Type.html#t:Matrix" title="Matrix.Type">Matrix</a> e a b -&gt; <a href="Matrix-Type.html#t:Matrix" title="Matrix.Type">Matrix</a> e cols b</li><li class="src short"><a href="#v:returnM">returnM</a> :: <span class="keyword">forall</span> e a. (<a href="/package/base-4.12.0.0/docs/Prelude.html#t:Num" title="Prelude">Num</a> e, <a href="/package/base-4.12.0.0/docs/Prelude.html#t:Enum" title="Prelude">Enum</a> e, <a href="/package/base-4.12.0.0/docs/Prelude.html#t:Enum" title="Prelude">Enum</a> a, <a href="Matrix-Type.html#t:FromLists" title="Matrix.Type">FromLists</a> e () (<a href="Matrix-Type.html#t:Normalize" title="Matrix.Type">Normalize</a> a), <a href="/package/base-4.12.0.0/docs/GHC-TypeNats.html#t:KnownNat" title="GHC.TypeNats">KnownNat</a> (<a href="Matrix-Type.html#t:Count" title="Matrix.Type">Count</a> a)) =&gt; a -&gt; <a href="Matrix-Type.html#t:Matrix" title="Matrix.Type">Matrix</a> e <a href="Matrix-Type.html#t:One" title="Matrix.Type">One</a> a</li><li class="src short"><a href="#v:bindM">bindM</a> :: <a href="/package/base-4.12.0.0/docs/Prelude.html#t:Num" title="Prelude">Num</a> e =&gt; <a href="Matrix-Type.html#t:Matrix" title="Matrix.Type">Matrix</a> e a b -&gt; <a href="Matrix-Type.html#t:Matrix" title="Matrix.Type">Matrix</a> e b c -&gt; <a href="Matrix-Type.html#t:Matrix" title="Matrix.Type">Matrix</a> e a c</li><li class="src short"><a href="#v:columns">columns</a> :: <a href="/package/base-4.12.0.0/docs/GHC-TypeNats.html#t:KnownNat" title="GHC.TypeNats">KnownNat</a> (<a href="Matrix-Type.html#t:Count" title="Matrix.Type">Count</a> (<a href="Matrix-Type.html#t:Normalize" title="Matrix.Type">Normalize</a> cols)) =&gt; <a href="Matrix-Type.html#t:Matrix" title="Matrix.Type">Matrix</a> e cols rows -&gt; <a href="/package/base-4.12.0.0/docs/Data-Int.html#t:Int" title="Data.Int">Int</a></li><li class="src short"><a href="#v:rows">rows</a> :: <a href="/package/base-4.12.0.0/docs/GHC-TypeNats.html#t:KnownNat" title="GHC.TypeNats">KnownNat</a> (<a href="Matrix-Type.html#t:Count" title="Matrix.Type">Count</a> (<a href="Matrix-Type.html#t:Normalize" title="Matrix.Type">Normalize</a> rows)) =&gt; <a href="Matrix-Type.html#t:Matrix" title="Matrix.Type">Matrix</a> e cols rows -&gt; <a href="/package/base-4.12.0.0/docs/Data-Int.html#t:Int" title="Data.Int">Int</a></li><li class="src short"><a href="#v:tr">tr</a> :: <a href="Matrix-Type.html#t:Matrix" title="Matrix.Type">Matrix</a> e cols rows -&gt; <a href="Matrix-Type.html#t:Matrix" title="Matrix.Type">Matrix</a> e rows cols</li><li class="src short"><a href="#v:cond">cond</a> :: (<a href="Matrix-Type.html#t:Normalize" title="Matrix.Type">Normalize</a> (<a href="Matrix-Type.html#t:Normalize" title="Matrix.Type">Normalize</a> a) ~ <a href="Matrix-Type.html#t:Normalize" title="Matrix.Type">Normalize</a> a, <a href="/package/base-4.12.0.0/docs/GHC-TypeNats.html#t:KnownNat" title="GHC.TypeNats">KnownNat</a> (<a href="Matrix-Type.html#t:Count" title="Matrix.Type">Count</a> (<a href="Matrix-Type.html#t:Normalize" title="Matrix.Type">Normalize</a> a)), <a href="Matrix-Type.html#t:FromLists" title="Matrix.Type">FromLists</a> e () (<a href="Matrix-Type.html#t:Normalize" title="Matrix.Type">Normalize</a> a), <a href="Matrix-Type.html#t:FromLists" title="Matrix.Type">FromLists</a> e (<a href="Matrix-Type.html#t:Normalize" title="Matrix.Type">Normalize</a> a) (), <a href="Matrix-Type.html#t:FromLists" title="Matrix.Type">FromLists</a> e (<a href="Matrix-Type.html#t:Normalize" title="Matrix.Type">Normalize</a> a) (<a href="Matrix-Type.html#t:Normalize" title="Matrix.Type">Normalize</a> a), <a href="/package/base-4.12.0.0/docs/Prelude.html#t:Bounded" title="Prelude">Bounded</a> a, <a href="/package/base-4.12.0.0/docs/Prelude.html#t:Enum" title="Prelude">Enum</a> a, <a href="/package/base-4.12.0.0/docs/Prelude.html#t:Num" title="Prelude">Num</a> e, <a href="/package/base-4.12.0.0/docs/Data-Ord.html#t:Ord" title="Data.Ord">Ord</a> e) =&gt; (a -&gt; <a href="/package/base-4.12.0.0/docs/Data-Bool.html#t:Bool" title="Data.Bool">Bool</a>) -&gt; <a href="Matrix-Type.html#t:Matrix" title="Matrix.Type">Matrix</a> e a b -&gt; <a href="Matrix-Type.html#t:Matrix" title="Matrix.Type">Matrix</a> e a b -&gt; <a href="Matrix-Type.html#t:Matrix" title="Matrix.Type">Matrix</a> e a b</li><li class="src short"><a href="#v:abideJS">abideJS</a> :: <a href="Matrix-Type.html#t:Matrix" title="Matrix.Type">Matrix</a> e cols rows -&gt; <a href="Matrix-Type.html#t:Matrix" title="Matrix.Type">Matrix</a> e cols rows</li><li class="src short"><a href="#v:abideSJ">abideSJ</a> :: <a href="Matrix-Type.html#t:Matrix" title="Matrix.Type">Matrix</a> e cols rows -&gt; <a href="Matrix-Type.html#t:Matrix" title="Matrix.Type">Matrix</a> e cols rows</li><li class="src short"><a href="#v:-61--61--61-">(===)</a> :: <a href="Matrix-Type.html#t:Normalize" title="Matrix.Type">Normalize</a> (<a href="/package/base-4.12.0.0/docs/Data-Either.html#t:Either" title="Data.Either">Either</a> a b) ~ <a href="/package/base-4.12.0.0/docs/Data-Either.html#t:Either" title="Data.Either">Either</a> (<a href="Matrix-Type.html#t:Normalize" title="Matrix.Type">Normalize</a> a) (<a href="Matrix-Type.html#t:Normalize" title="Matrix.Type">Normalize</a> b) =&gt; <a href="Matrix-Type.html#t:Matrix" title="Matrix.Type">Matrix</a> e cols a -&gt; <a href="Matrix-Type.html#t:Matrix" title="Matrix.Type">Matrix</a> e cols b -&gt; <a href="Matrix-Type.html#t:Matrix" title="Matrix.Type">Matrix</a> e cols (<a href="/package/base-4.12.0.0/docs/Data-Either.html#t:Either" title="Data.Either">Either</a> a b)</li><li class="src short"><a href="#v:p1">p1</a> :: (<a href="/package/base-4.12.0.0/docs/Prelude.html#t:Num" title="Prelude">Num</a> e, <a href="/package/base-4.12.0.0/docs/GHC-TypeNats.html#t:KnownNat" title="GHC.TypeNats">KnownNat</a> (<a href="Matrix-Type.html#t:Count" title="Matrix.Type">Count</a> (<a href="Matrix-Type.html#t:Normalize" title="Matrix.Type">Normalize</a> n)), <a href="/package/base-4.12.0.0/docs/GHC-TypeNats.html#t:KnownNat" title="GHC.TypeNats">KnownNat</a> (<a href="Matrix-Type.html#t:Count" title="Matrix.Type">Count</a> (<a href="Matrix-Type.html#t:Normalize" title="Matrix.Type">Normalize</a> m)), <a href="Matrix-Type.html#t:FromLists" title="Matrix.Type">FromLists</a> e (<a href="Matrix-Type.html#t:Normalize" title="Matrix.Type">Normalize</a> n) (<a href="Matrix-Type.html#t:Normalize" title="Matrix.Type">Normalize</a> m), <a href="Matrix-Type.html#t:FromLists" title="Matrix.Type">FromLists</a> e (<a href="Matrix-Type.html#t:Normalize" title="Matrix.Type">Normalize</a> m) (<a href="Matrix-Type.html#t:Normalize" title="Matrix.Type">Normalize</a> m), <a href="Matrix-Type.html#t:Normalize" title="Matrix.Type">Normalize</a> (<a href="/package/base-4.12.0.0/docs/Data-Either.html#t:Either" title="Data.Either">Either</a> m n) ~ <a href="/package/base-4.12.0.0/docs/Data-Either.html#t:Either" title="Data.Either">Either</a> (<a href="Matrix-Type.html#t:Normalize" title="Matrix.Type">Normalize</a> m) (<a href="Matrix-Type.html#t:Normalize" title="Matrix.Type">Normalize</a> n)) =&gt; <a href="Matrix-Type.html#t:Matrix" title="Matrix.Type">Matrix</a> e (<a href="/package/base-4.12.0.0/docs/Data-Either.html#t:Either" title="Data.Either">Either</a> m n) m</li><li class="src short"><a href="#v:p2">p2</a> :: (<a href="/package/base-4.12.0.0/docs/Prelude.html#t:Num" title="Prelude">Num</a> e, <a href="/package/base-4.12.0.0/docs/GHC-TypeNats.html#t:KnownNat" title="GHC.TypeNats">KnownNat</a> (<a href="Matrix-Type.html#t:Count" title="Matrix.Type">Count</a> (<a href="Matrix-Type.html#t:Normalize" title="Matrix.Type">Normalize</a> n)), <a href="/package/base-4.12.0.0/docs/GHC-TypeNats.html#t:KnownNat" title="GHC.TypeNats">KnownNat</a> (<a href="Matrix-Type.html#t:Count" title="Matrix.Type">Count</a> (<a href="Matrix-Type.html#t:Normalize" title="Matrix.Type">Normalize</a> m)), <a href="Matrix-Type.html#t:FromLists" title="Matrix.Type">FromLists</a> e (<a href="Matrix-Type.html#t:Normalize" title="Matrix.Type">Normalize</a> m) (<a href="Matrix-Type.html#t:Normalize" title="Matrix.Type">Normalize</a> n), <a href="Matrix-Type.html#t:FromLists" title="Matrix.Type">FromLists</a> e (<a href="Matrix-Type.html#t:Normalize" title="Matrix.Type">Normalize</a> n) (<a href="Matrix-Type.html#t:Normalize" title="Matrix.Type">Normalize</a> n), <a href="Matrix-Type.html#t:Normalize" title="Matrix.Type">Normalize</a> (<a href="/package/base-4.12.0.0/docs/Data-Either.html#t:Either" title="Data.Either">Either</a> m n) ~ <a href="/package/base-4.12.0.0/docs/Data-Either.html#t:Either" title="Data.Either">Either</a> (<a href="Matrix-Type.html#t:Normalize" title="Matrix.Type">Normalize</a> m) (<a href="Matrix-Type.html#t:Normalize" title="Matrix.Type">Normalize</a> n)) =&gt; <a href="Matrix-Type.html#t:Matrix" title="Matrix.Type">Matrix</a> e (<a href="/package/base-4.12.0.0/docs/Data-Either.html#t:Either" title="Data.Either">Either</a> m n) n</li><li class="src short"><a href="#v:-124--124--124-">(|||)</a> :: <a href="Matrix-Type.html#t:Normalize" title="Matrix.Type">Normalize</a> (<a href="/package/base-4.12.0.0/docs/Data-Either.html#t:Either" title="Data.Either">Either</a> a b) ~ <a href="/package/base-4.12.0.0/docs/Data-Either.html#t:Either" title="Data.Either">Either</a> (<a href="Matrix-Type.html#t:Normalize" title="Matrix.Type">Normalize</a> a) (<a href="Matrix-Type.html#t:Normalize" title="Matrix.Type">Normalize</a> b) =&gt; <a href="Matrix-Type.html#t:Matrix" title="Matrix.Type">Matrix</a> e a rows -&gt; <a href="Matrix-Type.html#t:Matrix" title="Matrix.Type">Matrix</a> e b rows -&gt; <a href="Matrix-Type.html#t:Matrix" title="Matrix.Type">Matrix</a> e (<a href="/package/base-4.12.0.0/docs/Data-Either.html#t:Either" title="Data.Either">Either</a> a b) rows</li><li class="src short"><a href="#v:i1">i1</a> :: (<a href="/package/base-4.12.0.0/docs/Prelude.html#t:Num" title="Prelude">Num</a> e, <a href="/package/base-4.12.0.0/docs/GHC-TypeNats.html#t:KnownNat" title="GHC.TypeNats">KnownNat</a> (<a href="Matrix-Type.html#t:Count" title="Matrix.Type">Count</a> (<a href="Matrix-Type.html#t:Normalize" title="Matrix.Type">Normalize</a> n)), <a href="/package/base-4.12.0.0/docs/GHC-TypeNats.html#t:KnownNat" title="GHC.TypeNats">KnownNat</a> (<a href="Matrix-Type.html#t:Count" title="Matrix.Type">Count</a> (<a href="Matrix-Type.html#t:Normalize" title="Matrix.Type">Normalize</a> m)), <a href="Matrix-Type.html#t:FromLists" title="Matrix.Type">FromLists</a> e (<a href="Matrix-Type.html#t:Normalize" title="Matrix.Type">Normalize</a> n) (<a href="Matrix-Type.html#t:Normalize" title="Matrix.Type">Normalize</a> m), <a href="Matrix-Type.html#t:FromLists" title="Matrix.Type">FromLists</a> e (<a href="Matrix-Type.html#t:Normalize" title="Matrix.Type">Normalize</a> m) (<a href="Matrix-Type.html#t:Normalize" title="Matrix.Type">Normalize</a> m), <a href="Matrix-Type.html#t:Normalize" title="Matrix.Type">Normalize</a> (<a href="/package/base-4.12.0.0/docs/Data-Either.html#t:Either" title="Data.Either">Either</a> m n) ~ <a href="/package/base-4.12.0.0/docs/Data-Either.html#t:Either" title="Data.Either">Either</a> (<a href="Matrix-Type.html#t:Normalize" title="Matrix.Type">Normalize</a> m) (<a href="Matrix-Type.html#t:Normalize" title="Matrix.Type">Normalize</a> n)) =&gt; <a href="Matrix-Type.html#t:Matrix" title="Matrix.Type">Matrix</a> e m (<a href="/package/base-4.12.0.0/docs/Data-Either.html#t:Either" title="Data.Either">Either</a> m n)</li><li class="src short"><a href="#v:i2">i2</a> :: (<a href="/package/base-4.12.0.0/docs/Prelude.html#t:Num" title="Prelude">Num</a> e, <a href="/package/base-4.12.0.0/docs/GHC-TypeNats.html#t:KnownNat" title="GHC.TypeNats">KnownNat</a> (<a href="Matrix-Type.html#t:Count" title="Matrix.Type">Count</a> (<a href="Matrix-Type.html#t:Normalize" title="Matrix.Type">Normalize</a> n)), <a href="/package/base-4.12.0.0/docs/GHC-TypeNats.html#t:KnownNat" title="GHC.TypeNats">KnownNat</a> (<a href="Matrix-Type.html#t:Count" title="Matrix.Type">Count</a> (<a href="Matrix-Type.html#t:Normalize" title="Matrix.Type">Normalize</a> m)), <a href="Matrix-Type.html#t:FromLists" title="Matrix.Type">FromLists</a> e (<a href="Matrix-Type.html#t:Normalize" title="Matrix.Type">Normalize</a> m) (<a href="Matrix-Type.html#t:Normalize" title="Matrix.Type">Normalize</a> n), <a href="Matrix-Type.html#t:FromLists" title="Matrix.Type">FromLists</a> e (<a href="Matrix-Type.html#t:Normalize" title="Matrix.Type">Normalize</a> n) (<a href="Matrix-Type.html#t:Normalize" title="Matrix.Type">Normalize</a> n), <a href="Matrix-Type.html#t:Normalize" title="Matrix.Type">Normalize</a> (<a href="/package/base-4.12.0.0/docs/Data-Either.html#t:Either" title="Data.Either">Either</a> m n) ~ <a href="/package/base-4.12.0.0/docs/Data-Either.html#t:Either" title="Data.Either">Either</a> (<a href="Matrix-Type.html#t:Normalize" title="Matrix.Type">Normalize</a> m) (<a href="Matrix-Type.html#t:Normalize" title="Matrix.Type">Normalize</a> n)) =&gt; <a href="Matrix-Type.html#t:Matrix" title="Matrix.Type">Matrix</a> e n (<a href="/package/base-4.12.0.0/docs/Data-Either.html#t:Either" title="Data.Either">Either</a> m n)</li><li class="src short"><a href="#v:-45--124--45-">(-|-)</a> :: (<a href="/package/base-4.12.0.0/docs/Prelude.html#t:Num" title="Prelude">Num</a> e, <a href="/package/base-4.12.0.0/docs/GHC-TypeNats.html#t:KnownNat" title="GHC.TypeNats">KnownNat</a> (<a href="Matrix-Type.html#t:Count" title="Matrix.Type">Count</a> (<a href="Matrix-Type.html#t:Normalize" title="Matrix.Type">Normalize</a> j)), <a href="/package/base-4.12.0.0/docs/GHC-TypeNats.html#t:KnownNat" title="GHC.TypeNats">KnownNat</a> (<a href="Matrix-Type.html#t:Count" title="Matrix.Type">Count</a> (<a href="Matrix-Type.html#t:Normalize" title="Matrix.Type">Normalize</a> k)), <a href="Matrix-Type.html#t:FromLists" title="Matrix.Type">FromLists</a> e (<a href="Matrix-Type.html#t:Normalize" title="Matrix.Type">Normalize</a> k) (<a href="Matrix-Type.html#t:Normalize" title="Matrix.Type">Normalize</a> k), <a href="Matrix-Type.html#t:FromLists" title="Matrix.Type">FromLists</a> e (<a href="Matrix-Type.html#t:Normalize" title="Matrix.Type">Normalize</a> j) (<a href="Matrix-Type.html#t:Normalize" title="Matrix.Type">Normalize</a> k), <a href="Matrix-Type.html#t:FromLists" title="Matrix.Type">FromLists</a> e (<a href="Matrix-Type.html#t:Normalize" title="Matrix.Type">Normalize</a> k) (<a href="Matrix-Type.html#t:Normalize" title="Matrix.Type">Normalize</a> j), <a href="Matrix-Type.html#t:FromLists" title="Matrix.Type">FromLists</a> e (<a href="Matrix-Type.html#t:Normalize" title="Matrix.Type">Normalize</a> j) (<a href="Matrix-Type.html#t:Normalize" title="Matrix.Type">Normalize</a> j), <a href="Matrix-Type.html#t:Normalize" title="Matrix.Type">Normalize</a> (<a href="/package/base-4.12.0.0/docs/Data-Either.html#t:Either" title="Data.Either">Either</a> n m) ~ <a href="/package/base-4.12.0.0/docs/Data-Either.html#t:Either" title="Data.Either">Either</a> (<a href="Matrix-Type.html#t:Normalize" title="Matrix.Type">Normalize</a> n) (<a href="Matrix-Type.html#t:Normalize" title="Matrix.Type">Normalize</a> m), <a href="Matrix-Type.html#t:Normalize" title="Matrix.Type">Normalize</a> (<a href="/package/base-4.12.0.0/docs/Data-Either.html#t:Either" title="Data.Either">Either</a> k j) ~ <a href="/package/base-4.12.0.0/docs/Data-Either.html#t:Either" title="Data.Either">Either</a> (<a href="Matrix-Type.html#t:Normalize" title="Matrix.Type">Normalize</a> k) (<a href="Matrix-Type.html#t:Normalize" title="Matrix.Type">Normalize</a> j)) =&gt; <a href="Matrix-Type.html#t:Matrix" title="Matrix.Type">Matrix</a> e n k -&gt; <a href="Matrix-Type.html#t:Matrix" title="Matrix.Type">Matrix</a> e m j -&gt; <a href="Matrix-Type.html#t:Matrix" title="Matrix.Type">Matrix</a> e (<a href="/package/base-4.12.0.0/docs/Data-Either.html#t:Either" title="Data.Either">Either</a> n m) (<a href="/package/base-4.12.0.0/docs/Data-Either.html#t:Either" title="Data.Either">Either</a> k j)</li><li class="src short"><a href="#v:-62--60-">(&gt;&lt;)</a> :: <span class="keyword">forall</span> e m p n q. (<a href="/package/base-4.12.0.0/docs/Prelude.html#t:Num" title="Prelude">Num</a> e, <a href="/package/base-4.12.0.0/docs/GHC-TypeNats.html#t:KnownNat" title="GHC.TypeNats">KnownNat</a> (<a href="Matrix-Type.html#t:Count" title="Matrix.Type">Count</a> (<a href="Matrix-Type.html#t:Normalize" title="Matrix.Type">Normalize</a> m)), <a href="/package/base-4.12.0.0/docs/GHC-TypeNats.html#t:KnownNat" title="GHC.TypeNats">KnownNat</a> (<a href="Matrix-Type.html#t:Count" title="Matrix.Type">Count</a> (<a href="Matrix-Type.html#t:Normalize" title="Matrix.Type">Normalize</a> n)), <a href="/package/base-4.12.0.0/docs/GHC-TypeNats.html#t:KnownNat" title="GHC.TypeNats">KnownNat</a> (<a href="Matrix-Type.html#t:Count" title="Matrix.Type">Count</a> (<a href="Matrix-Type.html#t:Normalize" title="Matrix.Type">Normalize</a> p)), <a href="/package/base-4.12.0.0/docs/GHC-TypeNats.html#t:KnownNat" title="GHC.TypeNats">KnownNat</a> (<a href="Matrix-Type.html#t:Count" title="Matrix.Type">Count</a> (<a href="Matrix-Type.html#t:Normalize" title="Matrix.Type">Normalize</a> q)), <a href="/package/base-4.12.0.0/docs/GHC-TypeNats.html#t:KnownNat" title="GHC.TypeNats">KnownNat</a> (<a href="Matrix-Type.html#t:Count" title="Matrix.Type">Count</a> (<a href="Matrix-Type.html#t:Normalize" title="Matrix.Type">Normalize</a> (m, n))), <a href="/package/base-4.12.0.0/docs/GHC-TypeNats.html#t:KnownNat" title="GHC.TypeNats">KnownNat</a> (<a href="Matrix-Type.html#t:Count" title="Matrix.Type">Count</a> (<a href="Matrix-Type.html#t:Normalize" title="Matrix.Type">Normalize</a> (p, q))), <a href="Matrix-Type.html#t:FromLists" title="Matrix.Type">FromLists</a> e (<a href="Matrix-Type.html#t:Normalize" title="Matrix.Type">Normalize</a> (m, n)) (<a href="Matrix-Type.html#t:Normalize" title="Matrix.Type">Normalize</a> m), <a href="Matrix-Type.html#t:FromLists" title="Matrix.Type">FromLists</a> e (<a href="Matrix-Type.html#t:Normalize" title="Matrix.Type">Normalize</a> (m, n)) (<a href="Matrix-Type.html#t:Normalize" title="Matrix.Type">Normalize</a> n), <a href="Matrix-Type.html#t:FromLists" title="Matrix.Type">FromLists</a> e (<a href="Matrix-Type.html#t:Normalize" title="Matrix.Type">Normalize</a> (p, q)) (<a href="Matrix-Type.html#t:Normalize" title="Matrix.Type">Normalize</a> p), <a href="Matrix-Type.html#t:FromLists" title="Matrix.Type">FromLists</a> e (<a href="Matrix-Type.html#t:Normalize" title="Matrix.Type">Normalize</a> (p, q)) (<a href="Matrix-Type.html#t:Normalize" title="Matrix.Type">Normalize</a> q), <a href="Matrix-Type.html#t:Normalize" title="Matrix.Type">Normalize</a> (m, n) ~ <a href="Matrix-Type.html#t:Normalize" title="Matrix.Type">Normalize</a> (<a href="Matrix-Type.html#t:Normalize" title="Matrix.Type">Normalize</a> m, <a href="Matrix-Type.html#t:Normalize" title="Matrix.Type">Normalize</a> n), <a href="Matrix-Type.html#t:Normalize" title="Matrix.Type">Normalize</a> (p, q) ~ <a href="Matrix-Type.html#t:Normalize" title="Matrix.Type">Normalize</a> (<a href="Matrix-Type.html#t:Normalize" title="Matrix.Type">Normalize</a> p, <a href="Matrix-Type.html#t:Normalize" title="Matrix.Type">Normalize</a> q)) =&gt; <a href="Matrix-Type.html#t:Matrix" title="Matrix.Type">Matrix</a> e m p -&gt; <a href="Matrix-Type.html#t:Matrix" title="Matrix.Type">Matrix</a> e n q -&gt; <a href="Matrix-Type.html#t:Matrix" title="Matrix.Type">Matrix</a> e (m, n) (p, q)</li><li class="src short"><a href="#v:kp1">kp1</a> :: <span class="keyword">forall</span> e m k. (<a href="/package/base-4.12.0.0/docs/Prelude.html#t:Num" title="Prelude">Num</a> e, <a href="/package/base-4.12.0.0/docs/GHC-TypeNats.html#t:KnownNat" title="GHC.TypeNats">KnownNat</a> (<a href="Matrix-Type.html#t:Count" title="Matrix.Type">Count</a> (<a href="Matrix-Type.html#t:Normalize" title="Matrix.Type">Normalize</a> m)), <a href="/package/base-4.12.0.0/docs/GHC-TypeNats.html#t:KnownNat" title="GHC.TypeNats">KnownNat</a> (<a href="Matrix-Type.html#t:Count" title="Matrix.Type">Count</a> (<a href="Matrix-Type.html#t:Normalize" title="Matrix.Type">Normalize</a> k)), <a href="/package/base-4.12.0.0/docs/GHC-TypeNats.html#t:KnownNat" title="GHC.TypeNats">KnownNat</a> (<a href="Matrix-Type.html#t:Count" title="Matrix.Type">Count</a> (<a href="Matrix-Type.html#t:Normalize" title="Matrix.Type">Normalize</a> (m, k))), <a href="Matrix-Type.html#t:FromLists" title="Matrix.Type">FromLists</a> e (<a href="Matrix-Type.html#t:Normalize" title="Matrix.Type">Normalize</a> (m, k)) (<a href="Matrix-Type.html#t:Normalize" title="Matrix.Type">Normalize</a> m), <a href="Matrix-Type.html#t:Normalize" title="Matrix.Type">Normalize</a> (m, k) ~ <a href="Matrix-Type.html#t:Normalize" title="Matrix.Type">Normalize</a> (<a href="Matrix-Type.html#t:Normalize" title="Matrix.Type">Normalize</a> m, <a href="Matrix-Type.html#t:Normalize" title="Matrix.Type">Normalize</a> k)) =&gt; <a href="Matrix-Type.html#t:Matrix" title="Matrix.Type">Matrix</a> e (m, k) m</li><li class="src short"><a href="#v:kp2">kp2</a> :: <span class="keyword">forall</span> e m k. (<a href="/package/base-4.12.0.0/docs/Prelude.html#t:Num" title="Prelude">Num</a> e, <a href="/package/base-4.12.0.0/docs/GHC-TypeNats.html#t:KnownNat" title="GHC.TypeNats">KnownNat</a> (<a href="Matrix-Type.html#t:Count" title="Matrix.Type">Count</a> (<a href="Matrix-Type.html#t:Normalize" title="Matrix.Type">Normalize</a> k)), <a href="/package/base-4.12.0.0/docs/GHC-TypeNats.html#t:KnownNat" title="GHC.TypeNats">KnownNat</a> (<a href="Matrix-Type.html#t:Count" title="Matrix.Type">Count</a> (<a href="Matrix-Type.html#t:Normalize" title="Matrix.Type">Normalize</a> m)), <a href="/package/base-4.12.0.0/docs/GHC-TypeNats.html#t:KnownNat" title="GHC.TypeNats">KnownNat</a> (<a href="Matrix-Type.html#t:Count" title="Matrix.Type">Count</a> (<a href="Matrix-Type.html#t:Normalize" title="Matrix.Type">Normalize</a> (m, k))), <a href="Matrix-Type.html#t:FromLists" title="Matrix.Type">FromLists</a> e (<a href="Matrix-Type.html#t:Normalize" title="Matrix.Type">Normalize</a> (m, k)) (<a href="Matrix-Type.html#t:Normalize" title="Matrix.Type">Normalize</a> k), <a href="Matrix-Type.html#t:Normalize" title="Matrix.Type">Normalize</a> (m, k) ~ <a href="Matrix-Type.html#t:Normalize" title="Matrix.Type">Normalize</a> (<a href="Matrix-Type.html#t:Normalize" title="Matrix.Type">Normalize</a> m, <a href="Matrix-Type.html#t:Normalize" title="Matrix.Type">Normalize</a> k)) =&gt; <a href="Matrix-Type.html#t:Matrix" title="Matrix.Type">Matrix</a> e (m, k) k</li><li class="src short"><a href="#v:khatri">khatri</a> :: <span class="keyword">forall</span> e cols a b. (<a href="/package/base-4.12.0.0/docs/Prelude.html#t:Num" title="Prelude">Num</a> e, <a href="/package/base-4.12.0.0/docs/GHC-TypeNats.html#t:KnownNat" title="GHC.TypeNats">KnownNat</a> (<a href="Matrix-Type.html#t:Count" title="Matrix.Type">Count</a> (<a href="Matrix-Type.html#t:Normalize" title="Matrix.Type">Normalize</a> a)), <a href="/package/base-4.12.0.0/docs/GHC-TypeNats.html#t:KnownNat" title="GHC.TypeNats">KnownNat</a> (<a href="Matrix-Type.html#t:Count" title="Matrix.Type">Count</a> (<a href="Matrix-Type.html#t:Normalize" title="Matrix.Type">Normalize</a> b)), <a href="/package/base-4.12.0.0/docs/GHC-TypeNats.html#t:KnownNat" title="GHC.TypeNats">KnownNat</a> (<a href="Matrix-Type.html#t:Count" title="Matrix.Type">Count</a> (<a href="Matrix-Type.html#t:Normalize" title="Matrix.Type">Normalize</a> (a, b))), <a href="Matrix-Type.html#t:FromLists" title="Matrix.Type">FromLists</a> e (<a href="Matrix-Type.html#t:Normalize" title="Matrix.Type">Normalize</a> (a, b)) (<a href="Matrix-Type.html#t:Normalize" title="Matrix.Type">Normalize</a> a), <a href="Matrix-Type.html#t:FromLists" title="Matrix.Type">FromLists</a> e (<a href="Matrix-Type.html#t:Normalize" title="Matrix.Type">Normalize</a> (a, b)) (<a href="Matrix-Type.html#t:Normalize" title="Matrix.Type">Normalize</a> b), <a href="Matrix-Type.html#t:Normalize" title="Matrix.Type">Normalize</a> (a, b) ~ <a href="Matrix-Type.html#t:Normalize" title="Matrix.Type">Normalize</a> (<a href="Matrix-Type.html#t:Normalize" title="Matrix.Type">Normalize</a> a, <a href="Matrix-Type.html#t:Normalize" title="Matrix.Type">Normalize</a> b)) =&gt; <a href="Matrix-Type.html#t:Matrix" title="Matrix.Type">Matrix</a> e cols a -&gt; <a href="Matrix-Type.html#t:Matrix" title="Matrix.Type">Matrix</a> e cols b -&gt; <a href="Matrix-Type.html#t:Matrix" title="Matrix.Type">Matrix</a> e cols (a, b)</li><li class="src short"><a href="#v:identity">identity</a> :: (<a href="/package/base-4.12.0.0/docs/Prelude.html#t:Num" title="Prelude">Num</a> e, <a href="Matrix-Type.html#t:FromLists" title="Matrix.Type">FromLists</a> e (<a href="Matrix-Type.html#t:Normalize" title="Matrix.Type">Normalize</a> a) (<a href="Matrix-Type.html#t:Normalize" title="Matrix.Type">Normalize</a> a), <a href="/package/base-4.12.0.0/docs/GHC-TypeNats.html#t:KnownNat" title="GHC.TypeNats">KnownNat</a> (<a href="Matrix-Type.html#t:Count" title="Matrix.Type">Count</a> (<a href="Matrix-Type.html#t:Normalize" title="Matrix.Type">Normalize</a> a))) =&gt; <a href="Matrix-Type.html#t:Matrix" title="Matrix.Type">Matrix</a> e a a</li><li class="src short"><a href="#v:comp">comp</a> :: <a href="/package/base-4.12.0.0/docs/Prelude.html#t:Num" title="Prelude">Num</a> e =&gt; <a href="Matrix-Type.html#t:Matrix" title="Matrix.Type">Matrix</a> e cr rows -&gt; <a href="Matrix-Type.html#t:Matrix" title="Matrix.Type">Matrix</a> e cols cr -&gt; <a href="Matrix-Type.html#t:Matrix" title="Matrix.Type">Matrix</a> e cols rows</li><li class="src short"><a href="#v:fromF">fromF</a> :: (<a href="/package/base-4.12.0.0/docs/Prelude.html#t:Bounded" title="Prelude">Bounded</a> a, <a href="/package/base-4.12.0.0/docs/Prelude.html#t:Bounded" title="Prelude">Bounded</a> b, <a href="/package/base-4.12.0.0/docs/Prelude.html#t:Enum" title="Prelude">Enum</a> a, <a href="/package/base-4.12.0.0/docs/Prelude.html#t:Enum" title="Prelude">Enum</a> b, <a href="/package/base-4.12.0.0/docs/Data-Eq.html#t:Eq" title="Data.Eq">Eq</a> b, <a href="/package/base-4.12.0.0/docs/Prelude.html#t:Num" title="Prelude">Num</a> e, <a href="/package/base-4.12.0.0/docs/Data-Ord.html#t:Ord" title="Data.Ord">Ord</a> e, <a href="/package/base-4.12.0.0/docs/GHC-TypeNats.html#t:KnownNat" title="GHC.TypeNats">KnownNat</a> (<a href="Matrix-Type.html#t:Count" title="Matrix.Type">Count</a> (<a href="Matrix-Type.html#t:Normalize" title="Matrix.Type">Normalize</a> cols)), <a href="/package/base-4.12.0.0/docs/GHC-TypeNats.html#t:KnownNat" title="GHC.TypeNats">KnownNat</a> (<a href="Matrix-Type.html#t:Count" title="Matrix.Type">Count</a> (<a href="Matrix-Type.html#t:Normalize" title="Matrix.Type">Normalize</a> rows)), <a href="Matrix-Type.html#t:FromLists" title="Matrix.Type">FromLists</a> e (<a href="Matrix-Type.html#t:Normalize" title="Matrix.Type">Normalize</a> rows) (<a href="Matrix-Type.html#t:Normalize" title="Matrix.Type">Normalize</a> cols)) =&gt; (a -&gt; b) -&gt; <a href="Matrix-Type.html#t:Matrix" title="Matrix.Type">Matrix</a> e cols rows</li><li class="src short"><a href="#v:fromF-39-">fromF'</a> :: (<a href="/package/base-4.12.0.0/docs/Prelude.html#t:Bounded" title="Prelude">Bounded</a> a, <a href="/package/base-4.12.0.0/docs/Prelude.html#t:Bounded" title="Prelude">Bounded</a> b, <a href="/package/base-4.12.0.0/docs/Prelude.html#t:Enum" title="Prelude">Enum</a> a, <a href="/package/base-4.12.0.0/docs/Prelude.html#t:Enum" title="Prelude">Enum</a> b, <a href="/package/base-4.12.0.0/docs/Data-Eq.html#t:Eq" title="Data.Eq">Eq</a> b, <a href="/package/base-4.12.0.0/docs/Prelude.html#t:Num" title="Prelude">Num</a> e, <a href="/package/base-4.12.0.0/docs/Data-Ord.html#t:Ord" title="Data.Ord">Ord</a> e, <a href="/package/base-4.12.0.0/docs/GHC-TypeNats.html#t:KnownNat" title="GHC.TypeNats">KnownNat</a> (<a href="Matrix-Type.html#t:Count" title="Matrix.Type">Count</a> (<a href="Matrix-Type.html#t:Normalize" title="Matrix.Type">Normalize</a> a)), <a href="/package/base-4.12.0.0/docs/GHC-TypeNats.html#t:KnownNat" title="GHC.TypeNats">KnownNat</a> (<a href="Matrix-Type.html#t:Count" title="Matrix.Type">Count</a> (<a href="Matrix-Type.html#t:Normalize" title="Matrix.Type">Normalize</a> b)), <a href="Matrix-Type.html#t:FromLists" title="Matrix.Type">FromLists</a> e (<a href="Matrix-Type.html#t:Normalize" title="Matrix.Type">Normalize</a> b) (<a href="Matrix-Type.html#t:Normalize" title="Matrix.Type">Normalize</a> a)) =&gt; (a -&gt; b) -&gt; <a href="Matrix-Type.html#t:Matrix" title="Matrix.Type">Matrix</a> e a b</li><li class="src short"><a href="#v:pretty">pretty</a> :: (<a href="/package/base-4.12.0.0/docs/GHC-TypeNats.html#t:KnownNat" title="GHC.TypeNats">KnownNat</a> (<a href="Matrix-Type.html#t:Count" title="Matrix.Type">Count</a> (<a href="Matrix-Type.html#t:Normalize" title="Matrix.Type">Normalize</a> cols)), <a href="/package/base-4.12.0.0/docs/Text-Show.html#t:Show" title="Text.Show">Show</a> e) =&gt; <a href="Matrix-Type.html#t:Matrix" title="Matrix.Type">Matrix</a> e cols rows -&gt; <a href="/package/base-4.12.0.0/docs/Data-String.html#t:String" title="Data.String">String</a></li><li class="src short"><a href="#v:prettyPrint">prettyPrint</a> :: (<a href="/package/base-4.12.0.0/docs/GHC-TypeNats.html#t:KnownNat" title="GHC.TypeNats">KnownNat</a> (<a href="Matrix-Type.html#t:Count" title="Matrix.Type">Count</a> (<a href="Matrix-Type.html#t:Normalize" title="Matrix.Type">Normalize</a> cols)), <a href="/package/base-4.12.0.0/docs/Text-Show.html#t:Show" title="Text.Show">Show</a> e) =&gt; <a href="Matrix-Type.html#t:Matrix" title="Matrix.Type">Matrix</a> e cols rows -&gt; <a href="/package/base-4.12.0.0/docs/System-IO.html#t:IO" title="System.IO">IO</a> ()</li></ul></details></div><div id="interface"><h1>Documentation</h1><div class="doc"><p>LAoP (Linear Algebra of Programming) Inductive Matrix definition.</p><p>LAoP generalises relations and functions treating them as
8+ Boolean matrices and in turn consider these as arrows.
9+ This library offers many of the combinators mentioned in the work of
10+ Macedo (2012) and Oliveira (2012).</p><p>This definition is a wrapper around <code><a href="Matrix.html#v:Type" title="Matrix">Type</a></code> but
11+ dimensions are arbitrary data types. Type inference might not
12+ be as desired.</p></div><a href="#g:1" id="g:1"><h1>Type safe matrix representation</h1></a><div class="top"><p class="src"><span class="keyword">newtype</span> <a id="t:Matrix" class="def">Matrix</a> e (cols :: <a href="/package/base-4.12.0.0/docs/Data-Kind.html#t:Type" title="Data.Kind">Type</a>) (rows :: <a href="/package/base-4.12.0.0/docs/Data-Kind.html#t:Type" title="Data.Kind">Type</a>) <a href="src/Matrix.Type.html#Matrix" class="link">Source</a> <a href="#t:Matrix" class="selflink">#</a></p><div class="subs constructors"><p class="caption">Constructors</p><table><tr><td class="src"><a id="v:M" class="def">M</a> (Matrix e (<a href="Matrix-Type.html#t:Normalize" title="Matrix.Type">Normalize</a> cols) (<a href="Matrix-Type.html#t:Normalize" title="Matrix.Type">Normalize</a> rows))</td><td class="doc empty">&nbsp;</td></tr></table></div><div class="subs instances"><details id="i:Matrix" open="open"><summary>Instances</summary><table><tr><td class="src clearfix"><span class="inst-left"><span class="instance details-toggle-control details-toggle" data-details-id="i:id:Matrix:Category:1"></span> <a href="/package/base-4.12.0.0/docs/Prelude.html#t:Num" title="Prelude">Num</a> e =&gt; <a href="/package/base-4.12.0.0/docs/Control-Category.html#t:Category" title="Control.Category">Category</a> (<a href="Matrix-Type.html#t:Matrix" title="Matrix.Type">Matrix</a> e :: <a href="/package/base-4.12.0.0/docs/Data-Kind.html#t:Type" title="Data.Kind">Type</a> -&gt; <a href="/package/base-4.12.0.0/docs/Data-Kind.html#t:Type" title="Data.Kind">Type</a> -&gt; <a href="/package/base-4.12.0.0/docs/Data-Kind.html#t:Type" title="Data.Kind">Type</a>)</span> <a href="src/Matrix.Type.html#line-174" class="link">Source</a> <a href="#t:Matrix" class="selflink">#</a></td><td class="doc"><p>It isn't possible to implement the <code><a href="/package/base-4.12.0.0/docs/Data-Function.html#v:id" title="Data.Function">id</a></code> function so it's
13+ implementation is <code><a href="/package/base-4.12.0.0/docs/Prelude.html#v:undefined" title="Prelude">undefined</a></code>. However <code><a href="Matrix-Type.html#v:comp" title="Matrix.Type">comp</a></code> can be and this partial
14+ class implementation exists just to make the code more readable.</p><p>Please use <code><a href="Matrix-Type.html#v:identity" title="Matrix.Type">identity</a></code> instead.</p></td></tr><tr><td colspan="2"><details id="i:id:Matrix:Category:1"><summary class="hide-when-js-enabled">Instance details</summary><p>Defined in <a href="Matrix-Type.html">Matrix.Type</a></p> <div class="subs methods"><p class="caption">Methods</p><p class="src"><a href="#v:id">id</a> :: <a href="Matrix-Type.html#t:Matrix" title="Matrix.Type">Matrix</a> e a a <a href="#v:id" class="selflink">#</a></p><p class="src"><a href="#v:.">(.)</a> :: <a href="Matrix-Type.html#t:Matrix" title="Matrix.Type">Matrix</a> e b c -&gt; <a href="Matrix-Type.html#t:Matrix" title="Matrix.Type">Matrix</a> e a b -&gt; <a href="Matrix-Type.html#t:Matrix" title="Matrix.Type">Matrix</a> e a c <a href="#v:." class="selflink">#</a></p></div></details></td></tr><tr><td class="src clearfix"><span class="inst-left"><span class="instance details-toggle-control details-toggle" data-details-id="i:id:Matrix:Eq:2"></span> <a href="/package/base-4.12.0.0/docs/Data-Eq.html#t:Eq" title="Data.Eq">Eq</a> e =&gt; <a href="/package/base-4.12.0.0/docs/Data-Eq.html#t:Eq" title="Data.Eq">Eq</a> (<a href="Matrix-Type.html#t:Matrix" title="Matrix.Type">Matrix</a> e cols rows)</span> <a href="src/Matrix.Type.html#line-167" class="link">Source</a> <a href="#t:Matrix" class="selflink">#</a></td><td class="doc empty">&nbsp;</td></tr><tr><td colspan="2"><details id="i:id:Matrix:Eq:2"><summary class="hide-when-js-enabled">Instance details</summary><p>Defined in <a href="Matrix-Type.html">Matrix.Type</a></p> <div class="subs methods"><p class="caption">Methods</p><p class="src"><a href="#v:-61--61-">(==)</a> :: <a href="Matrix-Type.html#t:Matrix" title="Matrix.Type">Matrix</a> e cols rows -&gt; <a href="Matrix-Type.html#t:Matrix" title="Matrix.Type">Matrix</a> e cols rows -&gt; <a href="/package/base-4.12.0.0/docs/Data-Bool.html#t:Bool" title="Data.Bool">Bool</a> <a href="#v:-61--61-" class="selflink">#</a></p><p class="src"><a href="#v:-47--61-">(/=)</a> :: <a href="Matrix-Type.html#t:Matrix" title="Matrix.Type">Matrix</a> e cols rows -&gt; <a href="Matrix-Type.html#t:Matrix" title="Matrix.Type">Matrix</a> e cols rows -&gt; <a href="/package/base-4.12.0.0/docs/Data-Bool.html#t:Bool" title="Data.Bool">Bool</a> <a href="#v:-47--61-" class="selflink">#</a></p></div></details></td></tr><tr><td class="src clearfix"><span class="inst-left"><span class="instance details-toggle-control details-toggle" data-details-id="i:id:Matrix:Num:3"></span> <a href="/package/base-4.12.0.0/docs/Prelude.html#t:Num" title="Prelude">Num</a> e =&gt; <a href="/package/base-4.12.0.0/docs/Prelude.html#t:Num" title="Prelude">Num</a> (<a href="Matrix-Type.html#t:Matrix" title="Matrix.Type">Matrix</a> e cols rows)</span> <a href="src/Matrix.Type.html#line-167" class="link">Source</a> <a href="#t:Matrix" class="selflink">#</a></td><td class="doc empty">&nbsp;</td></tr><tr><td colspan="2"><details id="i:id:Matrix:Num:3"><summary class="hide-when-js-enabled">Instance details</summary><p>Defined in <a href="Matrix-Type.html">Matrix.Type</a></p> <div class="subs methods"><p class="caption">Methods</p><p class="src"><a href="#v:-43-">(+)</a> :: <a href="Matrix-Type.html#t:Matrix" title="Matrix.Type">Matrix</a> e cols rows -&gt; <a href="Matrix-Type.html#t:Matrix" title="Matrix.Type">Matrix</a> e cols rows -&gt; <a href="Matrix-Type.html#t:Matrix" title="Matrix.Type">Matrix</a> e cols rows <a href="#v:-43-" class="selflink">#</a></p><p class="src"><a href="#v:-45-">(-)</a> :: <a href="Matrix-Type.html#t:Matrix" title="Matrix.Type">Matrix</a> e cols rows -&gt; <a href="Matrix-Type.html#t:Matrix" title="Matrix.Type">Matrix</a> e cols rows -&gt; <a href="Matrix-Type.html#t:Matrix" title="Matrix.Type">Matrix</a> e cols rows <a href="#v:-45-" class="selflink">#</a></p><p class="src"><a href="#v:-42-">(*)</a> :: <a href="Matrix-Type.html#t:Matrix" title="Matrix.Type">Matrix</a> e cols rows -&gt; <a href="Matrix-Type.html#t:Matrix" title="Matrix.Type">Matrix</a> e cols rows -&gt; <a href="Matrix-Type.html#t:Matrix" title="Matrix.Type">Matrix</a> e cols rows <a href="#v:-42-" class="selflink">#</a></p><p class="src"><a href="#v:negate">negate</a> :: <a href="Matrix-Type.html#t:Matrix" title="Matrix.Type">Matrix</a> e cols rows -&gt; <a href="Matrix-Type.html#t:Matrix" title="Matrix.Type">Matrix</a> e cols rows <a href="#v:negate" class="selflink">#</a></p><p class="src"><a href="#v:abs">abs</a> :: <a href="Matrix-Type.html#t:Matrix" title="Matrix.Type">Matrix</a> e cols rows -&gt; <a href="Matrix-Type.html#t:Matrix" title="Matrix.Type">Matrix</a> e cols rows <a href="#v:abs" class="selflink">#</a></p><p class="src"><a href="#v:signum">signum</a> :: <a href="Matrix-Type.html#t:Matrix" title="Matrix.Type">Matrix</a> e cols rows -&gt; <a href="Matrix-Type.html#t:Matrix" title="Matrix.Type">Matrix</a> e cols rows <a href="#v:signum" class="selflink">#</a></p><p class="src"><a href="#v:fromInteger">fromInteger</a> :: <a href="/package/base-4.12.0.0/docs/Prelude.html#t:Integer" title="Prelude">Integer</a> -&gt; <a href="Matrix-Type.html#t:Matrix" title="Matrix.Type">Matrix</a> e cols rows <a href="#v:fromInteger" class="selflink">#</a></p></div></details></td></tr><tr><td class="src clearfix"><span class="inst-left"><span class="instance details-toggle-control details-toggle" data-details-id="i:id:Matrix:Ord:4"></span> <a href="/package/base-4.12.0.0/docs/Data-Ord.html#t:Ord" title="Data.Ord">Ord</a> e =&gt; <a href="/package/base-4.12.0.0/docs/Data-Ord.html#t:Ord" title="Data.Ord">Ord</a> (<a href="Matrix-Type.html#t:Matrix" title="Matrix.Type">Matrix</a> e cols rows)</span> <a href="src/Matrix.Type.html#line-167" class="link">Source</a> <a href="#t:Matrix" class="selflink">#</a></td><td class="doc empty">&nbsp;</td></tr><tr><td colspan="2"><details id="i:id:Matrix:Ord:4"><summary class="hide-when-js-enabled">Instance details</summary><p>Defined in <a href="Matrix-Type.html">Matrix.Type</a></p> <div class="subs methods"><p class="caption">Methods</p><p class="src"><a href="#v:compare">compare</a> :: <a href="Matrix-Type.html#t:Matrix" title="Matrix.Type">Matrix</a> e cols rows -&gt; <a href="Matrix-Type.html#t:Matrix" title="Matrix.Type">Matrix</a> e cols rows -&gt; <a href="/package/base-4.12.0.0/docs/Data-Ord.html#t:Ordering" title="Data.Ord">Ordering</a> <a href="#v:compare" class="selflink">#</a></p><p class="src"><a href="#v:-60-">(&lt;)</a> :: <a href="Matrix-Type.html#t:Matrix" title="Matrix.Type">Matrix</a> e cols rows -&gt; <a href="Matrix-Type.html#t:Matrix" title="Matrix.Type">Matrix</a> e cols rows -&gt; <a href="/package/base-4.12.0.0/docs/Data-Bool.html#t:Bool" title="Data.Bool">Bool</a> <a href="#v:-60-" class="selflink">#</a></p><p class="src"><a href="#v:-60--61-">(&lt;=)</a> :: <a href="Matrix-Type.html#t:Matrix" title="Matrix.Type">Matrix</a> e cols rows -&gt; <a href="Matrix-Type.html#t:Matrix" title="Matrix.Type">Matrix</a> e cols rows -&gt; <a href="/package/base-4.12.0.0/docs/Data-Bool.html#t:Bool" title="Data.Bool">Bool</a> <a href="#v:-60--61-" class="selflink">#</a></p><p class="src"><a href="#v:-62-">(&gt;)</a> :: <a href="Matrix-Type.html#t:Matrix" title="Matrix.Type">Matrix</a> e cols rows -&gt; <a href="Matrix-Type.html#t:Matrix" title="Matrix.Type">Matrix</a> e cols rows -&gt; <a href="/package/base-4.12.0.0/docs/Data-Bool.html#t:Bool" title="Data.Bool">Bool</a> <a href="#v:-62-" class="selflink">#</a></p><p class="src"><a href="#v:-62--61-">(&gt;=)</a> :: <a href="Matrix-Type.html#t:Matrix" title="Matrix.Type">Matrix</a> e cols rows -&gt; <a href="Matrix-Type.html#t:Matrix" title="Matrix.Type">Matrix</a> e cols rows -&gt; <a href="/package/base-4.12.0.0/docs/Data-Bool.html#t:Bool" title="Data.Bool">Bool</a> <a href="#v:-62--61-" class="selflink">#</a></p><p class="src"><a href="#v:max">max</a> :: <a href="Matrix-Type.html#t:Matrix" title="Matrix.Type">Matrix</a> e cols rows -&gt; <a href="Matrix-Type.html#t:Matrix" title="Matrix.Type">Matrix</a> e cols rows -&gt; <a href="Matrix-Type.html#t:Matrix" title="Matrix.Type">Matrix</a> e cols rows <a href="#v:max" class="selflink">#</a></p><p class="src"><a href="#v:min">min</a> :: <a href="Matrix-Type.html#t:Matrix" title="Matrix.Type">Matrix</a> e cols rows -&gt; <a href="Matrix-Type.html#t:Matrix" title="Matrix.Type">Matrix</a> e cols rows -&gt; <a href="Matrix-Type.html#t:Matrix" title="Matrix.Type">Matrix</a> e cols rows <a href="#v:min" class="selflink">#</a></p></div></details></td></tr><tr><td class="src clearfix"><span class="inst-left"><span class="instance details-toggle-control details-toggle" data-details-id="i:id:Matrix:Show:5"></span> <a href="/package/base-4.12.0.0/docs/Text-Show.html#t:Show" title="Text.Show">Show</a> e =&gt; <a href="/package/base-4.12.0.0/docs/Text-Show.html#t:Show" title="Text.Show">Show</a> (<a href="Matrix-Type.html#t:Matrix" title="Matrix.Type">Matrix</a> e cols rows)</span> <a href="src/Matrix.Type.html#line-167" class="link">Source</a> <a href="#t:Matrix" class="selflink">#</a></td><td class="doc empty">&nbsp;</td></tr><tr><td colspan="2"><details id="i:id:Matrix:Show:5"><summary class="hide-when-js-enabled">Instance details</summary><p>Defined in <a href="Matrix-Type.html">Matrix.Type</a></p> <div class="subs methods"><p class="caption">Methods</p><p class="src"><a href="#v:showsPrec">showsPrec</a> :: <a href="/package/base-4.12.0.0/docs/Data-Int.html#t:Int" title="Data.Int">Int</a> -&gt; <a href="Matrix-Type.html#t:Matrix" title="Matrix.Type">Matrix</a> e cols rows -&gt; <a href="/package/base-4.12.0.0/docs/Text-Show.html#t:ShowS" title="Text.Show">ShowS</a> <a href="#v:showsPrec" class="selflink">#</a></p><p class="src"><a href="#v:show">show</a> :: <a href="Matrix-Type.html#t:Matrix" title="Matrix.Type">Matrix</a> e cols rows -&gt; <a href="/package/base-4.12.0.0/docs/Data-String.html#t:String" title="Data.String">String</a> <a href="#v:show" class="selflink">#</a></p><p class="src"><a href="#v:showList">showList</a> :: [<a href="Matrix-Type.html#t:Matrix" title="Matrix.Type">Matrix</a> e cols rows] -&gt; <a href="/package/base-4.12.0.0/docs/Text-Show.html#t:ShowS" title="Text.Show">ShowS</a> <a href="#v:showList" class="selflink">#</a></p></div></details></td></tr><tr><td class="src clearfix"><span class="inst-left"><span class="instance details-toggle-control details-toggle" data-details-id="i:id:Matrix:NFData:6"></span> <a href="/package/deepseq-1.4.4.0/docs/Control-DeepSeq.html#t:NFData" title="Control.DeepSeq">NFData</a> e =&gt; <a href="/package/deepseq-1.4.4.0/docs/Control-DeepSeq.html#t:NFData" title="Control.DeepSeq">NFData</a> (<a href="Matrix-Type.html#t:Matrix" title="Matrix.Type">Matrix</a> e cols rows)</span> <a href="src/Matrix.Type.html#line-167" class="link">Source</a> <a href="#t:Matrix" class="selflink">#</a></td><td class="doc empty">&nbsp;</td></tr><tr><td colspan="2"><details id="i:id:Matrix:NFData:6"><summary class="hide-when-js-enabled">Instance details</summary><p>Defined in <a href="Matrix-Type.html">Matrix.Type</a></p> <div class="subs methods"><p class="caption">Methods</p><p class="src"><a href="#v:rnf">rnf</a> :: <a href="Matrix-Type.html#t:Matrix" title="Matrix.Type">Matrix</a> e cols rows -&gt; () <a href="#v:rnf" class="selflink">#</a></p></div></details></td></tr></table></details></div></div><a href="#g:2" id="g:2"><h1>Type aliases</h1></a><div class="top"><p class="src"><span class="keyword">type</span> <a id="t:Zero" class="def">Zero</a> = <a href="/package/base-4.12.0.0/docs/Data-Void.html#t:Void" title="Data.Void">Void</a> <a href="src/Matrix.Type.html#Zero" class="link">Source</a> <a href="#t:Zero" class="selflink">#</a></p><div class="doc"><p>Zero type alias</p></div></div><div class="top"><p class="src"><span class="keyword">type</span> <a id="t:One" class="def">One</a> = () <a href="src/Matrix.Type.html#One" class="link">Source</a> <a href="#t:One" class="selflink">#</a></p><div class="doc"><p>One type alias</p></div></div><a href="#g:3" id="g:3"><h1>Primitives</h1></a><div class="top"><p class="src"><a id="v:empty" class="def">empty</a> :: <a href="Matrix-Type.html#t:Matrix" title="Matrix.Type">Matrix</a> e <a href="Matrix-Type.html#t:Zero" title="Matrix.Type">Zero</a> <a href="Matrix-Type.html#t:Zero" title="Matrix.Type">Zero</a> <a href="src/Matrix.Type.html#empty" class="link">Source</a> <a href="#v:empty" class="selflink">#</a></p><div class="doc"><p>Empty matrix constructor</p></div></div><div class="top"><p class="src"><a id="v:one" class="def">one</a> :: e -&gt; <a href="Matrix-Type.html#t:Matrix" title="Matrix.Type">Matrix</a> e <a href="Matrix-Type.html#t:One" title="Matrix.Type">One</a> <a href="Matrix-Type.html#t:One" title="Matrix.Type">One</a> <a href="src/Matrix.Type.html#one" class="link">Source</a> <a href="#v:one" class="selflink">#</a></p><div class="doc"><p>Unit matrix constructor</p></div></div><div class="top"><p class="src"><a id="v:junc" class="def">junc</a> :: <a href="Matrix-Type.html#t:Normalize" title="Matrix.Type">Normalize</a> (<a href="/package/base-4.12.0.0/docs/Data-Either.html#t:Either" title="Data.Either">Either</a> a b) ~ <a href="/package/base-4.12.0.0/docs/Data-Either.html#t:Either" title="Data.Either">Either</a> (<a href="Matrix-Type.html#t:Normalize" title="Matrix.Type">Normalize</a> a) (<a href="Matrix-Type.html#t:Normalize" title="Matrix.Type">Normalize</a> b) =&gt; <a href="Matrix-Type.html#t:Matrix" title="Matrix.Type">Matrix</a> e a rows -&gt; <a href="Matrix-Type.html#t:Matrix" title="Matrix.Type">Matrix</a> e b rows -&gt; <a href="Matrix-Type.html#t:Matrix" title="Matrix.Type">Matrix</a> e (<a href="/package/base-4.12.0.0/docs/Data-Either.html#t:Either" title="Data.Either">Either</a> a b) rows <a href="src/Matrix.Type.html#junc" class="link">Source</a> <a href="#v:junc" class="selflink">#</a></p><div class="doc"><p>Matrix <code>Junc</code> constructor</p></div></div><div class="top"><p class="src"><a id="v:split" class="def">split</a> :: <a href="Matrix-Type.html#t:Normalize" title="Matrix.Type">Normalize</a> (<a href="/package/base-4.12.0.0/docs/Data-Either.html#t:Either" title="Data.Either">Either</a> a b) ~ <a href="/package/base-4.12.0.0/docs/Data-Either.html#t:Either" title="Data.Either">Either</a> (<a href="Matrix-Type.html#t:Normalize" title="Matrix.Type">Normalize</a> a) (<a href="Matrix-Type.html#t:Normalize" title="Matrix.Type">Normalize</a> b) =&gt; <a href="Matrix-Type.html#t:Matrix" title="Matrix.Type">Matrix</a> e cols a -&gt; <a href="Matrix-Type.html#t:Matrix" title="Matrix.Type">Matrix</a> e cols b -&gt; <a href="Matrix-Type.html#t:Matrix" title="Matrix.Type">Matrix</a> e cols (<a href="/package/base-4.12.0.0/docs/Data-Either.html#t:Either" title="Data.Either">Either</a> a b) <a href="src/Matrix.Type.html#split" class="link">Source</a> <a href="#v:split" class="selflink">#</a></p><div class="doc"><p>Matrix <code>Split</code> constructor</p></div></div><a href="#g:4" id="g:4"><h1>Auxiliary type families</h1></a><div class="top"><p class="src"><span class="keyword">type family</span> <a id="t:FromNat" class="def">FromNat</a> (n :: <a href="/package/base-4.12.0.0/docs/GHC-TypeNats.html#t:Nat" title="GHC.TypeNats">Nat</a>) :: <a href="/package/base-4.12.0.0/docs/Data-Kind.html#t:Type" title="Data.Kind">Type</a> <span class="keyword">where ...</span> <a href="src/Matrix.Internal.html#FromNat" class="link">Source</a> <a href="#t:FromNat" class="selflink">#</a></p><div class="doc"><p>Type family that computes of a given type dimension from a given natural</p><p>Thanks to Li-Yao Xia this type family is super fast.</p></div><div class="subs equations"><p class="caption">Equations</p><table><tr><td class="src"><a href="Matrix-Type.html#t:FromNat" title="Matrix.Type">FromNat</a> 0 = <a href="/package/base-4.12.0.0/docs/Data-Void.html#t:Void" title="Data.Void">Void</a></td><td class="doc empty">&nbsp;</td></tr><tr><td class="src"><a href="Matrix-Type.html#t:FromNat" title="Matrix.Type">FromNat</a> 1 = ()</td><td class="doc empty">&nbsp;</td></tr><tr><td class="src"><a href="Matrix-Type.html#t:FromNat" title="Matrix.Type">FromNat</a> n = FromNat' (<a href="/package/base-4.12.0.0/docs/GHC-TypeNats.html#t:Mod" title="GHC.TypeNats">Mod</a> n 2 <a href="/package/base-4.12.0.0/docs/Data-Type-Equality.html#t:-61--61-" title="Data.Type.Equality">==</a> 0) (<a href="Matrix-Type.html#t:FromNat" title="Matrix.Type">FromNat</a> (<a href="/package/base-4.12.0.0/docs/GHC-TypeNats.html#t:Div" title="GHC.TypeNats">Div</a> n 2))</td><td class="doc empty">&nbsp;</td></tr></table></div></div><div class="top"><p class="src"><span class="keyword">type family</span> <a id="t:Count" class="def">Count</a> (d :: <a href="/package/base-4.12.0.0/docs/Data-Kind.html#t:Type" title="Data.Kind">Type</a>) :: <a href="/package/base-4.12.0.0/docs/GHC-TypeNats.html#t:Nat" title="GHC.TypeNats">Nat</a> <span class="keyword">where ...</span> <a href="src/Matrix.Internal.html#Count" class="link">Source</a> <a href="#t:Count" class="selflink">#</a></p><div class="doc"><p>Type family that computes the cardinality of a given type dimension.</p><p>It can also count the cardinality of custom types that implement the
15+ <code><a href="/package/base-4.12.0.0/docs/GHC-Generics.html#t:Generic" title="GHC.Generics">Generic</a></code> instance.</p></div><div class="subs equations"><p class="caption">Equations</p><table><tr><td class="src"><a href="Matrix-Type.html#t:Count" title="Matrix.Type">Count</a> (<a href="Utils.html#t:Natural" title="Utils">Natural</a> n m) = (m <a href="/package/base-4.12.0.0/docs/GHC-TypeNats.html#t:-45-" title="GHC.TypeNats">-</a> n) <a href="/package/base-4.12.0.0/docs/GHC-TypeNats.html#t:-43-" title="GHC.TypeNats">+</a> 1</td><td class="doc empty">&nbsp;</td></tr><tr><td class="src"><a href="Matrix-Type.html#t:Count" title="Matrix.Type">Count</a> (<a href="/package/base-4.12.0.0/docs/Data-Either.html#t:Either" title="Data.Either">Either</a> a b) = <a href="/package/base-4.12.0.0/docs/GHC-TypeNats.html#t:-43-" title="GHC.TypeNats">(+)</a> (<a href="Matrix-Type.html#t:Count" title="Matrix.Type">Count</a> a) (<a href="Matrix-Type.html#t:Count" title="Matrix.Type">Count</a> b)</td><td class="doc empty">&nbsp;</td></tr><tr><td class="src"><a href="Matrix-Type.html#t:Count" title="Matrix.Type">Count</a> (a, b) = <a href="/package/base-4.12.0.0/docs/GHC-TypeNats.html#t:-42-" title="GHC.TypeNats">*</a> (<a href="Matrix-Type.html#t:Count" title="Matrix.Type">Count</a> a) (<a href="Matrix-Type.html#t:Count" title="Matrix.Type">Count</a> b)</td><td class="doc empty">&nbsp;</td></tr><tr><td class="src"><a href="Matrix-Type.html#t:Count" title="Matrix.Type">Count</a> (a -&gt; b) = <a href="/package/base-4.12.0.0/docs/GHC-TypeNats.html#t:-94-" title="GHC.TypeNats">(^)</a> (<a href="Matrix-Type.html#t:Count" title="Matrix.Type">Count</a> b) (<a href="Matrix-Type.html#t:Count" title="Matrix.Type">Count</a> a)</td><td class="doc empty">&nbsp;</td></tr><tr><td class="src"><a href="Matrix-Type.html#t:Count" title="Matrix.Type">Count</a> (<a href="/package/base-4.12.0.0/docs/GHC-Generics.html#t:M1" title="GHC.Generics">M1</a> _ _ f p) = <a href="Matrix-Type.html#t:Count" title="Matrix.Type">Count</a> (f p)</td><td class="doc empty">&nbsp;</td></tr><tr><td class="src"><a href="Matrix-Type.html#t:Count" title="Matrix.Type">Count</a> (<a href="/package/base-4.12.0.0/docs/GHC-Generics.html#t:K1" title="GHC.Generics">K1</a> _ _ _) = 1</td><td class="doc empty">&nbsp;</td></tr><tr><td class="src"><a href="Matrix-Type.html#t:Count" title="Matrix.Type">Count</a> (<a href="/package/base-4.12.0.0/docs/GHC-Generics.html#t:V1" title="GHC.Generics">V1</a> _) = 0</td><td class="doc empty">&nbsp;</td></tr><tr><td class="src"><a href="Matrix-Type.html#t:Count" title="Matrix.Type">Count</a> (<a href="/package/base-4.12.0.0/docs/GHC-Generics.html#t:U1" title="GHC.Generics">U1</a> _) = 1</td><td class="doc empty">&nbsp;</td></tr><tr><td class="src"><a href="Matrix-Type.html#t:Count" title="Matrix.Type">Count</a> (<a href="/package/base-4.12.0.0/docs/GHC-Generics.html#t::-42-:" title="GHC.Generics">(:*:)</a> a b p) = <a href="Matrix-Type.html#t:Count" title="Matrix.Type">Count</a> (a p) <a href="/package/base-4.12.0.0/docs/GHC-TypeNats.html#t:-42-" title="GHC.TypeNats">*</a> <a href="Matrix-Type.html#t:Count" title="Matrix.Type">Count</a> (b p)</td><td class="doc empty">&nbsp;</td></tr><tr><td class="src"><a href="Matrix-Type.html#t:Count" title="Matrix.Type">Count</a> (<a href="/package/base-4.12.0.0/docs/GHC-Generics.html#t::-43-:" title="GHC.Generics">(:+:)</a> a b p) = <a href="Matrix-Type.html#t:Count" title="Matrix.Type">Count</a> (a p) <a href="/package/base-4.12.0.0/docs/GHC-TypeNats.html#t:-43-" title="GHC.TypeNats">+</a> <a href="Matrix-Type.html#t:Count" title="Matrix.Type">Count</a> (b p)</td><td class="doc empty">&nbsp;</td></tr><tr><td class="src"><a href="Matrix-Type.html#t:Count" title="Matrix.Type">Count</a> d = <a href="Matrix-Type.html#t:Count" title="Matrix.Type">Count</a> (<a href="/package/base-4.12.0.0/docs/GHC-Generics.html#t:Rep" title="GHC.Generics">Rep</a> d <a href="/package/base-4.12.0.0/docs/GHC-Generics.html#t:R" title="GHC.Generics">R</a>)</td><td class="doc empty">&nbsp;</td></tr></table></div></div><div class="top"><p class="src"><span class="keyword">type family</span> <a id="t:Normalize" class="def">Normalize</a> (d :: <a href="/package/base-4.12.0.0/docs/Data-Kind.html#t:Type" title="Data.Kind">Type</a>) :: <a href="/package/base-4.12.0.0/docs/Data-Kind.html#t:Type" title="Data.Kind">Type</a> <span class="keyword">where ...</span> <a href="src/Matrix.Internal.html#Normalize" class="link">Source</a> <a href="#t:Normalize" class="selflink">#</a></p><div class="doc"><p>Type family that normalizes the representation of a given data
16+ structure</p></div><div class="subs equations"><p class="caption">Equations</p><table><tr><td class="src"><a href="Matrix-Type.html#t:Normalize" title="Matrix.Type">Normalize</a> d = <a href="Matrix-Type.html#t:FromNat" title="Matrix.Type">FromNat</a> (<a href="Matrix-Type.html#t:Count" title="Matrix.Type">Count</a> d)</td><td class="doc empty">&nbsp;</td></tr></table></div></div><a href="#g:5" id="g:5"><h1>Matrix construction and conversion</h1></a><div class="top"><p class="src"><span class="keyword">class</span> <a id="t:FromLists" class="def">FromLists</a> e cols rows <a href="src/Matrix.Internal.html#FromLists" class="link">Source</a> <a href="#t:FromLists" class="selflink">#</a></p><div class="doc"><p>Type class for defining the <code>fromList</code> conversion function.</p><p>Given that it is not possible to branch on types at the term level type
17+ classes are needed bery much like an inductive definition but on types.</p></div><div class="subs minimal"><p class="caption">Minimal complete definition</p><p class="src">fromLists</p></div><div class="subs instances"><details id="i:FromLists" open="open"><summary>Instances</summary><table><tr><td class="src clearfix"><span class="inst-left"><span class="instance details-toggle-control details-toggle" data-details-id="i:ic:FromLists:FromLists:1"></span> <a href="Matrix-Type.html#t:FromLists" title="Matrix.Type">FromLists</a> e () ()</span> <a href="src/Matrix.Internal.html#line-311" class="link">Source</a> <a href="#t:FromLists" class="selflink">#</a></td><td class="doc empty">&nbsp;</td></tr><tr><td colspan="2"><details id="i:ic:FromLists:FromLists:1"><summary class="hide-when-js-enabled">Instance details</summary><p>Defined in <a href="Matrix-Internal.html">Matrix.Internal</a></p> <div class="subs methods"><p class="caption">Methods</p><p class="src"><a href="#v:fromLists">fromLists</a> :: [[e]] -&gt; Matrix e () ()</p></div></details></td></tr><tr><td class="src clearfix"><span class="inst-left"><span class="instance details-toggle-control details-toggle" data-details-id="i:ic:FromLists:FromLists:2"></span> <a href="Matrix-Type.html#t:FromLists" title="Matrix.Type">FromLists</a> e <a href="/package/base-4.12.0.0/docs/Data-Void.html#t:Void" title="Data.Void">Void</a> <a href="/package/base-4.12.0.0/docs/Data-Void.html#t:Void" title="Data.Void">Void</a></span> <a href="src/Matrix.Internal.html#line-307" class="link">Source</a> <a href="#t:FromLists" class="selflink">#</a></td><td class="doc empty">&nbsp;</td></tr><tr><td colspan="2"><details id="i:ic:FromLists:FromLists:2"><summary class="hide-when-js-enabled">Instance details</summary><p>Defined in <a href="Matrix-Internal.html">Matrix.Internal</a></p> <div class="subs methods"><p class="caption">Methods</p><p class="src"><a href="#v:fromLists">fromLists</a> :: [[e]] -&gt; Matrix e <a href="/package/base-4.12.0.0/docs/Data-Void.html#t:Void" title="Data.Void">Void</a> <a href="/package/base-4.12.0.0/docs/Data-Void.html#t:Void" title="Data.Void">Void</a></p></div></details></td></tr><tr><td class="src clearfix"><span class="inst-left"><span class="instance details-toggle-control details-toggle" data-details-id="i:ic:FromLists:FromLists:3"></span> (<a href="Matrix-Type.html#t:FromLists" title="Matrix.Type">FromLists</a> e () a, <a href="Matrix-Type.html#t:FromLists" title="Matrix.Type">FromLists</a> e () b, <a href="/package/base-4.12.0.0/docs/GHC-TypeNats.html#t:KnownNat" title="GHC.TypeNats">KnownNat</a> (<a href="Matrix-Type.html#t:Count" title="Matrix.Type">Count</a> a)) =&gt; <a href="Matrix-Type.html#t:FromLists" title="Matrix.Type">FromLists</a> e () (<a href="/package/base-4.12.0.0/docs/Data-Either.html#t:Either" title="Data.Either">Either</a> a b)</span> <a href="src/Matrix.Internal.html#line-329" class="link">Source</a> <a href="#t:FromLists" class="selflink">#</a></td><td class="doc empty">&nbsp;</td></tr><tr><td colspan="2"><details id="i:ic:FromLists:FromLists:3"><summary class="hide-when-js-enabled">Instance details</summary><p>Defined in <a href="Matrix-Internal.html">Matrix.Internal</a></p> <div class="subs methods"><p class="caption">Methods</p><p class="src"><a href="#v:fromLists">fromLists</a> :: [[e]] -&gt; Matrix e () (<a href="/package/base-4.12.0.0/docs/Data-Either.html#t:Either" title="Data.Either">Either</a> a b)</p></div></details></td></tr><tr><td class="src clearfix"><span class="inst-left"><span class="instance details-toggle-control details-toggle" data-details-id="i:ic:FromLists:FromLists:4"></span> <a href="Matrix-Type.html#t:FromLists" title="Matrix.Type">FromLists</a> e () rows =&gt; <a href="Matrix-Type.html#t:FromLists" title="Matrix.Type">FromLists</a> e () (<a href="/package/base-4.12.0.0/docs/Data-Either.html#t:Either" title="Data.Either">Either</a> () rows)</span> <a href="src/Matrix.Internal.html#line-325" class="link">Source</a> <a href="#t:FromLists" class="selflink">#</a></td><td class="doc empty">&nbsp;</td></tr><tr><td colspan="2"><details id="i:ic:FromLists:FromLists:4"><summary class="hide-when-js-enabled">Instance details</summary><p>Defined in <a href="Matrix-Internal.html">Matrix.Internal</a></p> <div class="subs methods"><p class="caption">Methods</p><p class="src"><a href="#v:fromLists">fromLists</a> :: [[e]] -&gt; Matrix e () (<a href="/package/base-4.12.0.0/docs/Data-Either.html#t:Either" title="Data.Either">Either</a> () rows)</p></div></details></td></tr><tr><td class="src clearfix"><span class="inst-left"><span class="instance details-toggle-control details-toggle" data-details-id="i:ic:FromLists:FromLists:5"></span> (<a href="Matrix-Type.html#t:FromLists" title="Matrix.Type">FromLists</a> e a (), <a href="Matrix-Type.html#t:FromLists" title="Matrix.Type">FromLists</a> e b (), <a href="/package/base-4.12.0.0/docs/GHC-TypeNats.html#t:KnownNat" title="GHC.TypeNats">KnownNat</a> (<a href="Matrix-Type.html#t:Count" title="Matrix.Type">Count</a> a)) =&gt; <a href="Matrix-Type.html#t:FromLists" title="Matrix.Type">FromLists</a> e (<a href="/package/base-4.12.0.0/docs/Data-Either.html#t:Either" title="Data.Either">Either</a> a b) ()</span> <a href="src/Matrix.Internal.html#line-319" class="link">Source</a> <a href="#t:FromLists" class="selflink">#</a></td><td class="doc empty">&nbsp;</td></tr><tr><td colspan="2"><details id="i:ic:FromLists:FromLists:5"><summary class="hide-when-js-enabled">Instance details</summary><p>Defined in <a href="Matrix-Internal.html">Matrix.Internal</a></p> <div class="subs methods"><p class="caption">Methods</p><p class="src"><a href="#v:fromLists">fromLists</a> :: [[e]] -&gt; Matrix e (<a href="/package/base-4.12.0.0/docs/Data-Either.html#t:Either" title="Data.Either">Either</a> a b) ()</p></div></details></td></tr><tr><td class="src clearfix"><span class="inst-left"><span class="instance details-toggle-control details-toggle" data-details-id="i:ic:FromLists:FromLists:6"></span> <a href="Matrix-Type.html#t:FromLists" title="Matrix.Type">FromLists</a> e cols () =&gt; <a href="Matrix-Type.html#t:FromLists" title="Matrix.Type">FromLists</a> e (<a href="/package/base-4.12.0.0/docs/Data-Either.html#t:Either" title="Data.Either">Either</a> () cols) ()</span> <a href="src/Matrix.Internal.html#line-315" class="link">Source</a> <a href="#t:FromLists" class="selflink">#</a></td><td class="doc empty">&nbsp;</td></tr><tr><td colspan="2"><details id="i:ic:FromLists:FromLists:6"><summary class="hide-when-js-enabled">Instance details</summary><p>Defined in <a href="Matrix-Internal.html">Matrix.Internal</a></p> <div class="subs methods"><p class="caption">Methods</p><p class="src"><a href="#v:fromLists">fromLists</a> :: [[e]] -&gt; Matrix e (<a href="/package/base-4.12.0.0/docs/Data-Either.html#t:Either" title="Data.Either">Either</a> () cols) ()</p></div></details></td></tr><tr><td class="src clearfix"><span class="inst-left"><span class="instance details-toggle-control details-toggle" data-details-id="i:ic:FromLists:FromLists:7"></span> (<a href="Matrix-Type.html#t:FromLists" title="Matrix.Type">FromLists</a> e (<a href="/package/base-4.12.0.0/docs/Data-Either.html#t:Either" title="Data.Either">Either</a> a b) c, <a href="Matrix-Type.html#t:FromLists" title="Matrix.Type">FromLists</a> e (<a href="/package/base-4.12.0.0/docs/Data-Either.html#t:Either" title="Data.Either">Either</a> a b) d, <a href="/package/base-4.12.0.0/docs/GHC-TypeNats.html#t:KnownNat" title="GHC.TypeNats">KnownNat</a> (<a href="Matrix-Type.html#t:Count" title="Matrix.Type">Count</a> c)) =&gt; <a href="Matrix-Type.html#t:FromLists" title="Matrix.Type">FromLists</a> e (<a href="/package/base-4.12.0.0/docs/Data-Either.html#t:Either" title="Data.Either">Either</a> a b) (<a href="/package/base-4.12.0.0/docs/Data-Either.html#t:Either" title="Data.Either">Either</a> c d)</span> <a href="src/Matrix.Internal.html#line-335" class="link">Source</a> <a href="#t:FromLists" class="selflink">#</a></td><td class="doc empty">&nbsp;</td></tr><tr><td colspan="2"><details id="i:ic:FromLists:FromLists:7"><summary class="hide-when-js-enabled">Instance details</summary><p>Defined in <a href="Matrix-Internal.html">Matrix.Internal</a></p> <div class="subs methods"><p class="caption">Methods</p><p class="src"><a href="#v:fromLists">fromLists</a> :: [[e]] -&gt; Matrix e (<a href="/package/base-4.12.0.0/docs/Data-Either.html#t:Either" title="Data.Either">Either</a> a b) (<a href="/package/base-4.12.0.0/docs/Data-Either.html#t:Either" title="Data.Either">Either</a> c d)</p></div></details></td></tr></table></details></div></div><div class="top"><p class="src"><a id="v:fromLists" class="def">fromLists</a> :: <a href="Matrix-Type.html#t:FromLists" title="Matrix.Type">FromLists</a> e (<a href="Matrix-Type.html#t:Normalize" title="Matrix.Type">Normalize</a> cols) (<a href="Matrix-Type.html#t:Normalize" title="Matrix.Type">Normalize</a> rows) =&gt; [[e]] -&gt; <a href="Matrix-Type.html#t:Matrix" title="Matrix.Type">Matrix</a> e cols rows <a href="src/Matrix.Type.html#fromLists" class="link">Source</a> <a href="#v:fromLists" class="selflink">#</a></p><div class="doc"><p>Build a matrix out of a list of list of elements. Throws a runtime
18+ error if the dimensions do not match.</p></div></div><div class="top"><p class="src"><a id="v:toLists" class="def">toLists</a> :: <a href="Matrix-Type.html#t:Matrix" title="Matrix.Type">Matrix</a> e cols rows -&gt; [[e]] <a href="src/Matrix.Type.html#toLists" class="link">Source</a> <a href="#v:toLists" class="selflink">#</a></p><div class="doc"><p>Converts a matrix to a list of lists of elements.</p></div></div><div class="top"><p class="src"><a id="v:toList" class="def">toList</a> :: <a href="Matrix-Type.html#t:Matrix" title="Matrix.Type">Matrix</a> e cols rows -&gt; [e] <a href="src/Matrix.Type.html#toList" class="link">Source</a> <a href="#v:toList" class="selflink">#</a></p><div class="doc"><p>Converts a matrix to a list of elements.</p></div></div><div class="top"><p class="src"><a id="v:matrixBuilder" class="def">matrixBuilder</a> :: (<a href="Matrix-Type.html#t:FromLists" title="Matrix.Type">FromLists</a> e (<a href="Matrix-Type.html#t:Normalize" title="Matrix.Type">Normalize</a> cols) (<a href="Matrix-Type.html#t:Normalize" title="Matrix.Type">Normalize</a> rows), <a href="/package/base-4.12.0.0/docs/GHC-TypeNats.html#t:KnownNat" title="GHC.TypeNats">KnownNat</a> (<a href="Matrix-Type.html#t:Count" title="Matrix.Type">Count</a> (<a href="Matrix-Type.html#t:Normalize" title="Matrix.Type">Normalize</a> cols)), <a href="/package/base-4.12.0.0/docs/GHC-TypeNats.html#t:KnownNat" title="GHC.TypeNats">KnownNat</a> (<a href="Matrix-Type.html#t:Count" title="Matrix.Type">Count</a> (<a href="Matrix-Type.html#t:Normalize" title="Matrix.Type">Normalize</a> rows))) =&gt; ((<a href="/package/base-4.12.0.0/docs/Data-Int.html#t:Int" title="Data.Int">Int</a>, <a href="/package/base-4.12.0.0/docs/Data-Int.html#t:Int" title="Data.Int">Int</a>) -&gt; e) -&gt; <a href="Matrix-Type.html#t:Matrix" title="Matrix.Type">Matrix</a> e cols rows <a href="src/Matrix.Type.html#matrixBuilder" class="link">Source</a> <a href="#v:matrixBuilder" class="selflink">#</a></p><div class="doc"><p>Matrix builder function. Constructs a matrix provided with
19+ a construction function.</p></div></div><div class="top"><p class="src"><a id="v:row" class="def">row</a> :: <a href="Matrix-Type.html#t:FromLists" title="Matrix.Type">FromLists</a> e (<a href="Matrix-Type.html#t:Normalize" title="Matrix.Type">Normalize</a> cols) () =&gt; [e] -&gt; <a href="Matrix-Type.html#t:Matrix" title="Matrix.Type">Matrix</a> e cols <a href="Matrix-Type.html#t:One" title="Matrix.Type">One</a> <a href="src/Matrix.Type.html#row" class="link">Source</a> <a href="#v:row" class="selflink">#</a></p><div class="doc"><p>Constructs a row vector matrix</p></div></div><div class="top"><p class="src"><a id="v:col" class="def">col</a> :: <a href="Matrix-Type.html#t:FromLists" title="Matrix.Type">FromLists</a> e () (<a href="Matrix-Type.html#t:Normalize" title="Matrix.Type">Normalize</a> rows) =&gt; [e] -&gt; <a href="Matrix-Type.html#t:Matrix" title="Matrix.Type">Matrix</a> e <a href="Matrix-Type.html#t:One" title="Matrix.Type">One</a> rows <a href="src/Matrix.Type.html#col" class="link">Source</a> <a href="#v:col" class="selflink">#</a></p><div class="doc"><p>Constructs a column vector matrix</p></div></div><div class="top"><p class="src"><a id="v:zeros" class="def">zeros</a> :: (<a href="/package/base-4.12.0.0/docs/Prelude.html#t:Num" title="Prelude">Num</a> e, <a href="Matrix-Type.html#t:FromLists" title="Matrix.Type">FromLists</a> e (<a href="Matrix-Type.html#t:Normalize" title="Matrix.Type">Normalize</a> cols) (<a href="Matrix-Type.html#t:Normalize" title="Matrix.Type">Normalize</a> rows), <a href="/package/base-4.12.0.0/docs/GHC-TypeNats.html#t:KnownNat" title="GHC.TypeNats">KnownNat</a> (<a href="Matrix-Type.html#t:Count" title="Matrix.Type">Count</a> (<a href="Matrix-Type.html#t:Normalize" title="Matrix.Type">Normalize</a> cols)), <a href="/package/base-4.12.0.0/docs/GHC-TypeNats.html#t:KnownNat" title="GHC.TypeNats">KnownNat</a> (<a href="Matrix-Type.html#t:Count" title="Matrix.Type">Count</a> (<a href="Matrix-Type.html#t:Normalize" title="Matrix.Type">Normalize</a> rows))) =&gt; <a href="Matrix-Type.html#t:Matrix" title="Matrix.Type">Matrix</a> e cols rows <a href="src/Matrix.Type.html#zeros" class="link">Source</a> <a href="#v:zeros" class="selflink">#</a></p><div class="doc"><p>The zero matrix. A matrix wholly filled with zeros.</p></div></div><div class="top"><p class="src"><a id="v:ones" class="def">ones</a> :: (<a href="/package/base-4.12.0.0/docs/Prelude.html#t:Num" title="Prelude">Num</a> e, <a href="Matrix-Type.html#t:FromLists" title="Matrix.Type">FromLists</a> e (<a href="Matrix-Type.html#t:Normalize" title="Matrix.Type">Normalize</a> cols) (<a href="Matrix-Type.html#t:Normalize" title="Matrix.Type">Normalize</a> rows), <a href="/package/base-4.12.0.0/docs/GHC-TypeNats.html#t:KnownNat" title="GHC.TypeNats">KnownNat</a> (<a href="Matrix-Type.html#t:Count" title="Matrix.Type">Count</a> (<a href="Matrix-Type.html#t:Normalize" title="Matrix.Type">Normalize</a> cols)), <a href="/package/base-4.12.0.0/docs/GHC-TypeNats.html#t:KnownNat" title="GHC.TypeNats">KnownNat</a> (<a href="Matrix-Type.html#t:Count" title="Matrix.Type">Count</a> (<a href="Matrix-Type.html#t:Normalize" title="Matrix.Type">Normalize</a> rows))) =&gt; <a href="Matrix-Type.html#t:Matrix" title="Matrix.Type">Matrix</a> e cols rows <a href="src/Matrix.Type.html#ones" class="link">Source</a> <a href="#v:ones" class="selflink">#</a></p><div class="doc"><p>The ones matrix. A matrix wholly filled with ones.</p><p>Also known as T (Top) matrix.</p></div></div><div class="top"><p class="src"><a id="v:bang" class="def">bang</a> :: <span class="keyword">forall</span> e cols. (<a href="/package/base-4.12.0.0/docs/Prelude.html#t:Num" title="Prelude">Num</a> e, <a href="/package/base-4.12.0.0/docs/Prelude.html#t:Enum" title="Prelude">Enum</a> e, <a href="Matrix-Type.html#t:FromLists" title="Matrix.Type">FromLists</a> e (<a href="Matrix-Type.html#t:Normalize" title="Matrix.Type">Normalize</a> cols) (), <a href="/package/base-4.12.0.0/docs/GHC-TypeNats.html#t:KnownNat" title="GHC.TypeNats">KnownNat</a> (<a href="Matrix-Type.html#t:Count" title="Matrix.Type">Count</a> (<a href="Matrix-Type.html#t:Normalize" title="Matrix.Type">Normalize</a> cols))) =&gt; <a href="Matrix-Type.html#t:Matrix" title="Matrix.Type">Matrix</a> e cols <a href="Matrix-Type.html#t:One" title="Matrix.Type">One</a> <a href="src/Matrix.Type.html#bang" class="link">Source</a> <a href="#v:bang" class="selflink">#</a></p><div class="doc"><p>The T (Top) row vector matrix.</p></div></div><div class="top"><p class="src"><a id="v:constant" class="def">constant</a> :: (<a href="/package/base-4.12.0.0/docs/Prelude.html#t:Num" title="Prelude">Num</a> e, <a href="Matrix-Type.html#t:FromLists" title="Matrix.Type">FromLists</a> e (<a href="Matrix-Type.html#t:Normalize" title="Matrix.Type">Normalize</a> cols) (<a href="Matrix-Type.html#t:Normalize" title="Matrix.Type">Normalize</a> rows), <a href="/package/base-4.12.0.0/docs/GHC-TypeNats.html#t:KnownNat" title="GHC.TypeNats">KnownNat</a> (<a href="Matrix-Type.html#t:Count" title="Matrix.Type">Count</a> (<a href="Matrix-Type.html#t:Normalize" title="Matrix.Type">Normalize</a> cols)), <a href="/package/base-4.12.0.0/docs/GHC-TypeNats.html#t:KnownNat" title="GHC.TypeNats">KnownNat</a> (<a href="Matrix-Type.html#t:Count" title="Matrix.Type">Count</a> (<a href="Matrix-Type.html#t:Normalize" title="Matrix.Type">Normalize</a> rows))) =&gt; e -&gt; <a href="Matrix-Type.html#t:Matrix" title="Matrix.Type">Matrix</a> e cols rows <a href="src/Matrix.Type.html#constant" class="link">Source</a> <a href="#v:constant" class="selflink">#</a></p><div class="doc"><p>The constant matrix constructor. A matrix wholly filled with a given
20+ value.</p></div></div><a href="#g:6" id="g:6"><h1>Functor instance equivalent function</h1></a><div class="top"><p class="src"><a id="v:fmapM" class="def">fmapM</a> :: (<a href="/package/base-4.12.0.0/docs/Prelude.html#t:Bounded" title="Prelude">Bounded</a> a, <a href="/package/base-4.12.0.0/docs/Prelude.html#t:Bounded" title="Prelude">Bounded</a> b, <a href="/package/base-4.12.0.0/docs/Prelude.html#t:Enum" title="Prelude">Enum</a> a, <a href="/package/base-4.12.0.0/docs/Prelude.html#t:Enum" title="Prelude">Enum</a> b, <a href="/package/base-4.12.0.0/docs/Data-Eq.html#t:Eq" title="Data.Eq">Eq</a> b, <a href="/package/base-4.12.0.0/docs/Prelude.html#t:Num" title="Prelude">Num</a> e, <a href="/package/base-4.12.0.0/docs/Data-Ord.html#t:Ord" title="Data.Ord">Ord</a> e, <a href="/package/base-4.12.0.0/docs/GHC-TypeNats.html#t:KnownNat" title="GHC.TypeNats">KnownNat</a> (<a href="Matrix-Type.html#t:Count" title="Matrix.Type">Count</a> (<a href="Matrix-Type.html#t:Normalize" title="Matrix.Type">Normalize</a> a)), <a href="/package/base-4.12.0.0/docs/GHC-TypeNats.html#t:KnownNat" title="GHC.TypeNats">KnownNat</a> (<a href="Matrix-Type.html#t:Count" title="Matrix.Type">Count</a> (<a href="Matrix-Type.html#t:Normalize" title="Matrix.Type">Normalize</a> b)), <a href="Matrix-Type.html#t:FromLists" title="Matrix.Type">FromLists</a> e (<a href="Matrix-Type.html#t:Normalize" title="Matrix.Type">Normalize</a> b) (<a href="Matrix-Type.html#t:Normalize" title="Matrix.Type">Normalize</a> a)) =&gt; (a -&gt; b) -&gt; <a href="Matrix-Type.html#t:Matrix" title="Matrix.Type">Matrix</a> e c a -&gt; <a href="Matrix-Type.html#t:Matrix" title="Matrix.Type">Matrix</a> e c b <a href="src/Matrix.Type.html#fmapM" class="link">Source</a> <a href="#v:fmapM" class="selflink">#</a></p><div class="doc"><p>Functor instance equivalent function</p></div></div><a href="#g:7" id="g:7"><h1>Applicative/Monoidal instance equivalent functions</h1></a><div class="top"><p class="src"><a id="v:unitM" class="def">unitM</a> :: <a href="/package/base-4.12.0.0/docs/Prelude.html#t:Num" title="Prelude">Num</a> e =&gt; <a href="Matrix-Type.html#t:Matrix" title="Matrix.Type">Matrix</a> e () () <a href="src/Matrix.Type.html#unitM" class="link">Source</a> <a href="#v:unitM" class="selflink">#</a></p><div class="doc"><p>Applicative instance equivalent <code>unit</code> function,</p></div></div><div class="top"><p class="src"><a id="v:multM" class="def">multM</a> :: (<a href="/package/base-4.12.0.0/docs/GHC-TypeNats.html#t:KnownNat" title="GHC.TypeNats">KnownNat</a> (<a href="Matrix-Type.html#t:Count" title="Matrix.Type">Count</a> (<a href="Matrix-Type.html#t:Normalize" title="Matrix.Type">Normalize</a> a)), <a href="/package/base-4.12.0.0/docs/GHC-TypeNats.html#t:KnownNat" title="GHC.TypeNats">KnownNat</a> (<a href="Matrix-Type.html#t:Count" title="Matrix.Type">Count</a> (<a href="Matrix-Type.html#t:Normalize" title="Matrix.Type">Normalize</a> b)), <a href="/package/base-4.12.0.0/docs/GHC-TypeNats.html#t:KnownNat" title="GHC.TypeNats">KnownNat</a> (<a href="Matrix-Type.html#t:Count" title="Matrix.Type">Count</a> (<a href="Matrix-Type.html#t:Normalize" title="Matrix.Type">Normalize</a> (a, b))), <a href="/package/base-4.12.0.0/docs/Prelude.html#t:Num" title="Prelude">Num</a> e, <a href="Matrix-Type.html#t:FromLists" title="Matrix.Type">FromLists</a> e (<a href="Matrix-Type.html#t:Normalize" title="Matrix.Type">Normalize</a> (a, b)) (<a href="Matrix-Type.html#t:Normalize" title="Matrix.Type">Normalize</a> a), <a href="Matrix-Type.html#t:FromLists" title="Matrix.Type">FromLists</a> e (<a href="Matrix-Type.html#t:Normalize" title="Matrix.Type">Normalize</a> (a, b)) (<a href="Matrix-Type.html#t:Normalize" title="Matrix.Type">Normalize</a> b), <a href="Matrix-Type.html#t:Normalize" title="Matrix.Type">Normalize</a> (a, b) ~ <a href="Matrix-Type.html#t:Normalize" title="Matrix.Type">Normalize</a> (<a href="Matrix-Type.html#t:Normalize" title="Matrix.Type">Normalize</a> a, <a href="Matrix-Type.html#t:Normalize" title="Matrix.Type">Normalize</a> b)) =&gt; <a href="Matrix-Type.html#t:Matrix" title="Matrix.Type">Matrix</a> e c a -&gt; <a href="Matrix-Type.html#t:Matrix" title="Matrix.Type">Matrix</a> e c b -&gt; <a href="Matrix-Type.html#t:Matrix" title="Matrix.Type">Matrix</a> e c (a, b) <a href="src/Matrix.Type.html#multM" class="link">Source</a> <a href="#v:multM" class="selflink">#</a></p><div class="doc"><p>Applicative instance equivalent <code>unit</code> function,</p></div></div><a href="#g:8" id="g:8"><h1>Selective equivalent instance function</h1></a><div class="top"><p class="src"><a id="v:selectM" class="def">selectM</a> :: (<a href="/package/base-4.12.0.0/docs/Prelude.html#t:Num" title="Prelude">Num</a> e, <a href="Matrix-Type.html#t:FromLists" title="Matrix.Type">FromLists</a> e (<a href="Matrix-Type.html#t:Normalize" title="Matrix.Type">Normalize</a> b) (<a href="Matrix-Type.html#t:Normalize" title="Matrix.Type">Normalize</a> b), <a href="/package/base-4.12.0.0/docs/GHC-TypeNats.html#t:KnownNat" title="GHC.TypeNats">KnownNat</a> (<a href="Matrix-Type.html#t:Count" title="Matrix.Type">Count</a> (<a href="Matrix-Type.html#t:Normalize" title="Matrix.Type">Normalize</a> b)), <a href="Matrix-Type.html#t:Normalize" title="Matrix.Type">Normalize</a> (<a href="/package/base-4.12.0.0/docs/Data-Either.html#t:Either" title="Data.Either">Either</a> a b) ~ <a href="/package/base-4.12.0.0/docs/Data-Either.html#t:Either" title="Data.Either">Either</a> (<a href="Matrix-Type.html#t:Normalize" title="Matrix.Type">Normalize</a> a) (<a href="Matrix-Type.html#t:Normalize" title="Matrix.Type">Normalize</a> b)) =&gt; <a href="Matrix-Type.html#t:Matrix" title="Matrix.Type">Matrix</a> e cols (<a href="/package/base-4.12.0.0/docs/Data-Either.html#t:Either" title="Data.Either">Either</a> a b) -&gt; <a href="Matrix-Type.html#t:Matrix" title="Matrix.Type">Matrix</a> e a b -&gt; <a href="Matrix-Type.html#t:Matrix" title="Matrix.Type">Matrix</a> e cols b <a href="src/Matrix.Type.html#selectM" class="link">Source</a> <a href="#v:selectM" class="selflink">#</a></p><div class="doc"><p>Selective functors <code>select</code> operator equivalent inspired by the
21+ ArrowMonad solution presented in the paper.</p></div></div><a href="#g:9" id="g:9"><h1>Monad equivalent instance function</h1></a><div class="top"><p class="src"><a id="v:returnM" class="def">returnM</a> :: <span class="keyword">forall</span> e a. (<a href="/package/base-4.12.0.0/docs/Prelude.html#t:Num" title="Prelude">Num</a> e, <a href="/package/base-4.12.0.0/docs/Prelude.html#t:Enum" title="Prelude">Enum</a> e, <a href="/package/base-4.12.0.0/docs/Prelude.html#t:Enum" title="Prelude">Enum</a> a, <a href="Matrix-Type.html#t:FromLists" title="Matrix.Type">FromLists</a> e () (<a href="Matrix-Type.html#t:Normalize" title="Matrix.Type">Normalize</a> a), <a href="/package/base-4.12.0.0/docs/GHC-TypeNats.html#t:KnownNat" title="GHC.TypeNats">KnownNat</a> (<a href="Matrix-Type.html#t:Count" title="Matrix.Type">Count</a> a)) =&gt; a -&gt; <a href="Matrix-Type.html#t:Matrix" title="Matrix.Type">Matrix</a> e <a href="Matrix-Type.html#t:One" title="Matrix.Type">One</a> a <a href="src/Matrix.Type.html#returnM" class="link">Source</a> <a href="#v:returnM" class="selflink">#</a></p><div class="doc"><p>Monad instance equivalent <code><a href="/package/base-4.12.0.0/docs/Control-Monad.html#v:return" title="Control.Monad">return</a></code> function,</p></div></div><div class="top"><p class="src"><a id="v:bindM" class="def">bindM</a> :: <a href="/package/base-4.12.0.0/docs/Prelude.html#t:Num" title="Prelude">Num</a> e =&gt; <a href="Matrix-Type.html#t:Matrix" title="Matrix.Type">Matrix</a> e a b -&gt; <a href="Matrix-Type.html#t:Matrix" title="Matrix.Type">Matrix</a> e b c -&gt; <a href="Matrix-Type.html#t:Matrix" title="Matrix.Type">Matrix</a> e a c <a href="src/Matrix.Type.html#bindM" class="link">Source</a> <a href="#v:bindM" class="selflink">#</a></p><div class="doc"><p>Monad instance equivalent '(&gt;&gt;=)' function,</p></div></div><a href="#g:10" id="g:10"><h1>Misc</h1></a><a href="#g:11" id="g:11"><h2>Get dimensions</h2></a><div class="top"><p class="src"><a id="v:columns" class="def">columns</a> :: <a href="/package/base-4.12.0.0/docs/GHC-TypeNats.html#t:KnownNat" title="GHC.TypeNats">KnownNat</a> (<a href="Matrix-Type.html#t:Count" title="Matrix.Type">Count</a> (<a href="Matrix-Type.html#t:Normalize" title="Matrix.Type">Normalize</a> cols)) =&gt; <a href="Matrix-Type.html#t:Matrix" title="Matrix.Type">Matrix</a> e cols rows -&gt; <a href="/package/base-4.12.0.0/docs/Data-Int.html#t:Int" title="Data.Int">Int</a> <a href="src/Matrix.Type.html#columns" class="link">Source</a> <a href="#v:columns" class="selflink">#</a></p><div class="doc"><p>Obtain the number of columns.</p><p>NOTE: The <code><a href="/package/base-4.12.0.0/docs/GHC-TypeNats.html#t:KnownNat" title="GHC.TypeNats">KnownNat</a></code> constaint is needed in order to obtain the
22+ dimensions in constant time.</p><p>TODO: A <code><a href="Matrix-Type.html#v:columns" title="Matrix.Type">columns</a></code> function that does not need the <code><a href="/package/base-4.12.0.0/docs/GHC-TypeNats.html#t:KnownNat" title="GHC.TypeNats">KnownNat</a></code> constraint in
23+ exchange for performance.</p></div></div><div class="top"><p class="src"><a id="v:rows" class="def">rows</a> :: <a href="/package/base-4.12.0.0/docs/GHC-TypeNats.html#t:KnownNat" title="GHC.TypeNats">KnownNat</a> (<a href="Matrix-Type.html#t:Count" title="Matrix.Type">Count</a> (<a href="Matrix-Type.html#t:Normalize" title="Matrix.Type">Normalize</a> rows)) =&gt; <a href="Matrix-Type.html#t:Matrix" title="Matrix.Type">Matrix</a> e cols rows -&gt; <a href="/package/base-4.12.0.0/docs/Data-Int.html#t:Int" title="Data.Int">Int</a> <a href="src/Matrix.Type.html#rows" class="link">Source</a> <a href="#v:rows" class="selflink">#</a></p><div class="doc"><p>Obtain the number of rows.</p><p>NOTE: The <code><a href="/package/base-4.12.0.0/docs/GHC-TypeNats.html#t:KnownNat" title="GHC.TypeNats">KnownNat</a></code> constaint is needed in order to obtain the
24+ dimensions in constant time.</p><p>TODO: A <code><a href="Matrix-Type.html#v:rows" title="Matrix.Type">rows</a></code> function that does not need the <code><a href="/package/base-4.12.0.0/docs/GHC-TypeNats.html#t:KnownNat" title="GHC.TypeNats">KnownNat</a></code> constraint in
25+ exchange for performance.</p></div></div><a href="#g:12" id="g:12"><h2>Matrix Transposition</h2></a><div class="top"><p class="src"><a id="v:tr" class="def">tr</a> :: <a href="Matrix-Type.html#t:Matrix" title="Matrix.Type">Matrix</a> e cols rows -&gt; <a href="Matrix-Type.html#t:Matrix" title="Matrix.Type">Matrix</a> e rows cols <a href="src/Matrix.Type.html#tr" class="link">Source</a> <a href="#v:tr" class="selflink">#</a></p><div class="doc"><p>Matrix transposition.</p></div></div><a href="#g:13" id="g:13"><h2>McCarthy's Conditional</h2></a><div class="top"><p class="src"><a id="v:cond" class="def">cond</a> :: (<a href="Matrix-Type.html#t:Normalize" title="Matrix.Type">Normalize</a> (<a href="Matrix-Type.html#t:Normalize" title="Matrix.Type">Normalize</a> a) ~ <a href="Matrix-Type.html#t:Normalize" title="Matrix.Type">Normalize</a> a, <a href="/package/base-4.12.0.0/docs/GHC-TypeNats.html#t:KnownNat" title="GHC.TypeNats">KnownNat</a> (<a href="Matrix-Type.html#t:Count" title="Matrix.Type">Count</a> (<a href="Matrix-Type.html#t:Normalize" title="Matrix.Type">Normalize</a> a)), <a href="Matrix-Type.html#t:FromLists" title="Matrix.Type">FromLists</a> e () (<a href="Matrix-Type.html#t:Normalize" title="Matrix.Type">Normalize</a> a), <a href="Matrix-Type.html#t:FromLists" title="Matrix.Type">FromLists</a> e (<a href="Matrix-Type.html#t:Normalize" title="Matrix.Type">Normalize</a> a) (), <a href="Matrix-Type.html#t:FromLists" title="Matrix.Type">FromLists</a> e (<a href="Matrix-Type.html#t:Normalize" title="Matrix.Type">Normalize</a> a) (<a href="Matrix-Type.html#t:Normalize" title="Matrix.Type">Normalize</a> a), <a href="/package/base-4.12.0.0/docs/Prelude.html#t:Bounded" title="Prelude">Bounded</a> a, <a href="/package/base-4.12.0.0/docs/Prelude.html#t:Enum" title="Prelude">Enum</a> a, <a href="/package/base-4.12.0.0/docs/Prelude.html#t:Num" title="Prelude">Num</a> e, <a href="/package/base-4.12.0.0/docs/Data-Ord.html#t:Ord" title="Data.Ord">Ord</a> e) =&gt; (a -&gt; <a href="/package/base-4.12.0.0/docs/Data-Bool.html#t:Bool" title="Data.Bool">Bool</a>) -&gt; <a href="Matrix-Type.html#t:Matrix" title="Matrix.Type">Matrix</a> e a b -&gt; <a href="Matrix-Type.html#t:Matrix" title="Matrix.Type">Matrix</a> e a b -&gt; <a href="Matrix-Type.html#t:Matrix" title="Matrix.Type">Matrix</a> e a b <a href="src/Matrix.Type.html#cond" class="link">Source</a> <a href="#v:cond" class="selflink">#</a></p><div class="doc"><p>McCarthy's Conditional expresses probabilistic choice.</p></div></div><a href="#g:14" id="g:14"><h2>Matrix &quot;abiding&quot;</h2></a><div class="top"><p class="src"><a id="v:abideJS" class="def">abideJS</a> :: <a href="Matrix-Type.html#t:Matrix" title="Matrix.Type">Matrix</a> e cols rows -&gt; <a href="Matrix-Type.html#t:Matrix" title="Matrix.Type">Matrix</a> e cols rows <a href="src/Matrix.Type.html#abideJS" class="link">Source</a> <a href="#v:abideJS" class="selflink">#</a></p><div class="doc"><p>Matrix &quot;abiding&quot; followin the 'Junc'-'Split' abide law.</p><p>Law:</p><pre><code>Junc</code> (<code>Split</code> a c) (<code>Split</code> b d) == <code>Split</code> (<code>Junc</code> a b) (<code>Junc</code> c d)
26+</pre></div></div><div class="top"><p class="src"><a id="v:abideSJ" class="def">abideSJ</a> :: <a href="Matrix-Type.html#t:Matrix" title="Matrix.Type">Matrix</a> e cols rows -&gt; <a href="Matrix-Type.html#t:Matrix" title="Matrix.Type">Matrix</a> e cols rows <a href="src/Matrix.Type.html#abideSJ" class="link">Source</a> <a href="#v:abideSJ" class="selflink">#</a></p><div class="doc"><p>Matrix &quot;abiding&quot; followin the 'Split'-'Junc' abide law.</p><p>Law:</p><pre><code>Split</code> (<code>Junc</code> a b) (<code>Junc</code> c d) == <code>Junc</code> (<code>Split</code> a c) (<code>Split</code> b d)
27+</pre></div></div><a href="#g:15" id="g:15"><h1>Biproduct approach</h1></a><a href="#g:16" id="g:16"><h2>Split</h2></a><div class="top"><p class="src"><a id="v:-61--61--61-" class="def">(===)</a> :: <a href="Matrix-Type.html#t:Normalize" title="Matrix.Type">Normalize</a> (<a href="/package/base-4.12.0.0/docs/Data-Either.html#t:Either" title="Data.Either">Either</a> a b) ~ <a href="/package/base-4.12.0.0/docs/Data-Either.html#t:Either" title="Data.Either">Either</a> (<a href="Matrix-Type.html#t:Normalize" title="Matrix.Type">Normalize</a> a) (<a href="Matrix-Type.html#t:Normalize" title="Matrix.Type">Normalize</a> b) =&gt; <a href="Matrix-Type.html#t:Matrix" title="Matrix.Type">Matrix</a> e cols a -&gt; <a href="Matrix-Type.html#t:Matrix" title="Matrix.Type">Matrix</a> e cols b -&gt; <a href="Matrix-Type.html#t:Matrix" title="Matrix.Type">Matrix</a> e cols (<a href="/package/base-4.12.0.0/docs/Data-Either.html#t:Either" title="Data.Either">Either</a> a b) <span class="fixity">infixl 2</span><span class="rightedge"></span> <a href="src/Matrix.Type.html#%3D%3D%3D" class="link">Source</a> <a href="#v:-61--61--61-" class="selflink">#</a></p><div class="doc"><p>Matrix <code>Split</code> constructor</p></div></div><a href="#g:17" id="g:17"><h3>Projections</h3></a><div class="top"><p class="src"><a id="v:p1" class="def">p1</a> :: (<a href="/package/base-4.12.0.0/docs/Prelude.html#t:Num" title="Prelude">Num</a> e, <a href="/package/base-4.12.0.0/docs/GHC-TypeNats.html#t:KnownNat" title="GHC.TypeNats">KnownNat</a> (<a href="Matrix-Type.html#t:Count" title="Matrix.Type">Count</a> (<a href="Matrix-Type.html#t:Normalize" title="Matrix.Type">Normalize</a> n)), <a href="/package/base-4.12.0.0/docs/GHC-TypeNats.html#t:KnownNat" title="GHC.TypeNats">KnownNat</a> (<a href="Matrix-Type.html#t:Count" title="Matrix.Type">Count</a> (<a href="Matrix-Type.html#t:Normalize" title="Matrix.Type">Normalize</a> m)), <a href="Matrix-Type.html#t:FromLists" title="Matrix.Type">FromLists</a> e (<a href="Matrix-Type.html#t:Normalize" title="Matrix.Type">Normalize</a> n) (<a href="Matrix-Type.html#t:Normalize" title="Matrix.Type">Normalize</a> m), <a href="Matrix-Type.html#t:FromLists" title="Matrix.Type">FromLists</a> e (<a href="Matrix-Type.html#t:Normalize" title="Matrix.Type">Normalize</a> m) (<a href="Matrix-Type.html#t:Normalize" title="Matrix.Type">Normalize</a> m), <a href="Matrix-Type.html#t:Normalize" title="Matrix.Type">Normalize</a> (<a href="/package/base-4.12.0.0/docs/Data-Either.html#t:Either" title="Data.Either">Either</a> m n) ~ <a href="/package/base-4.12.0.0/docs/Data-Either.html#t:Either" title="Data.Either">Either</a> (<a href="Matrix-Type.html#t:Normalize" title="Matrix.Type">Normalize</a> m) (<a href="Matrix-Type.html#t:Normalize" title="Matrix.Type">Normalize</a> n)) =&gt; <a href="Matrix-Type.html#t:Matrix" title="Matrix.Type">Matrix</a> e (<a href="/package/base-4.12.0.0/docs/Data-Either.html#t:Either" title="Data.Either">Either</a> m n) m <a href="src/Matrix.Type.html#p1" class="link">Source</a> <a href="#v:p1" class="selflink">#</a></p><div class="doc"><p>Biproduct first component projection</p></div></div><div class="top"><p class="src"><a id="v:p2" class="def">p2</a> :: (<a href="/package/base-4.12.0.0/docs/Prelude.html#t:Num" title="Prelude">Num</a> e, <a href="/package/base-4.12.0.0/docs/GHC-TypeNats.html#t:KnownNat" title="GHC.TypeNats">KnownNat</a> (<a href="Matrix-Type.html#t:Count" title="Matrix.Type">Count</a> (<a href="Matrix-Type.html#t:Normalize" title="Matrix.Type">Normalize</a> n)), <a href="/package/base-4.12.0.0/docs/GHC-TypeNats.html#t:KnownNat" title="GHC.TypeNats">KnownNat</a> (<a href="Matrix-Type.html#t:Count" title="Matrix.Type">Count</a> (<a href="Matrix-Type.html#t:Normalize" title="Matrix.Type">Normalize</a> m)), <a href="Matrix-Type.html#t:FromLists" title="Matrix.Type">FromLists</a> e (<a href="Matrix-Type.html#t:Normalize" title="Matrix.Type">Normalize</a> m) (<a href="Matrix-Type.html#t:Normalize" title="Matrix.Type">Normalize</a> n), <a href="Matrix-Type.html#t:FromLists" title="Matrix.Type">FromLists</a> e (<a href="Matrix-Type.html#t:Normalize" title="Matrix.Type">Normalize</a> n) (<a href="Matrix-Type.html#t:Normalize" title="Matrix.Type">Normalize</a> n), <a href="Matrix-Type.html#t:Normalize" title="Matrix.Type">Normalize</a> (<a href="/package/base-4.12.0.0/docs/Data-Either.html#t:Either" title="Data.Either">Either</a> m n) ~ <a href="/package/base-4.12.0.0/docs/Data-Either.html#t:Either" title="Data.Either">Either</a> (<a href="Matrix-Type.html#t:Normalize" title="Matrix.Type">Normalize</a> m) (<a href="Matrix-Type.html#t:Normalize" title="Matrix.Type">Normalize</a> n)) =&gt; <a href="Matrix-Type.html#t:Matrix" title="Matrix.Type">Matrix</a> e (<a href="/package/base-4.12.0.0/docs/Data-Either.html#t:Either" title="Data.Either">Either</a> m n) n <a href="src/Matrix.Type.html#p2" class="link">Source</a> <a href="#v:p2" class="selflink">#</a></p><div class="doc"><p>Biproduct second component projection</p></div></div><a href="#g:18" id="g:18"><h2>Junc</h2></a><div class="top"><p class="src"><a id="v:-124--124--124-" class="def">(|||)</a> :: <a href="Matrix-Type.html#t:Normalize" title="Matrix.Type">Normalize</a> (<a href="/package/base-4.12.0.0/docs/Data-Either.html#t:Either" title="Data.Either">Either</a> a b) ~ <a href="/package/base-4.12.0.0/docs/Data-Either.html#t:Either" title="Data.Either">Either</a> (<a href="Matrix-Type.html#t:Normalize" title="Matrix.Type">Normalize</a> a) (<a href="Matrix-Type.html#t:Normalize" title="Matrix.Type">Normalize</a> b) =&gt; <a href="Matrix-Type.html#t:Matrix" title="Matrix.Type">Matrix</a> e a rows -&gt; <a href="Matrix-Type.html#t:Matrix" title="Matrix.Type">Matrix</a> e b rows -&gt; <a href="Matrix-Type.html#t:Matrix" title="Matrix.Type">Matrix</a> e (<a href="/package/base-4.12.0.0/docs/Data-Either.html#t:Either" title="Data.Either">Either</a> a b) rows <span class="fixity">infixl 3</span><span class="rightedge"></span> <a href="src/Matrix.Type.html#%7C%7C%7C" class="link">Source</a> <a href="#v:-124--124--124-" class="selflink">#</a></p><div class="doc"><p>Matrix <code>Junc</code> constructor</p></div></div><a href="#g:19" id="g:19"><h3>Injections</h3></a><div class="top"><p class="src"><a id="v:i1" class="def">i1</a> :: (<a href="/package/base-4.12.0.0/docs/Prelude.html#t:Num" title="Prelude">Num</a> e, <a href="/package/base-4.12.0.0/docs/GHC-TypeNats.html#t:KnownNat" title="GHC.TypeNats">KnownNat</a> (<a href="Matrix-Type.html#t:Count" title="Matrix.Type">Count</a> (<a href="Matrix-Type.html#t:Normalize" title="Matrix.Type">Normalize</a> n)), <a href="/package/base-4.12.0.0/docs/GHC-TypeNats.html#t:KnownNat" title="GHC.TypeNats">KnownNat</a> (<a href="Matrix-Type.html#t:Count" title="Matrix.Type">Count</a> (<a href="Matrix-Type.html#t:Normalize" title="Matrix.Type">Normalize</a> m)), <a href="Matrix-Type.html#t:FromLists" title="Matrix.Type">FromLists</a> e (<a href="Matrix-Type.html#t:Normalize" title="Matrix.Type">Normalize</a> n) (<a href="Matrix-Type.html#t:Normalize" title="Matrix.Type">Normalize</a> m), <a href="Matrix-Type.html#t:FromLists" title="Matrix.Type">FromLists</a> e (<a href="Matrix-Type.html#t:Normalize" title="Matrix.Type">Normalize</a> m) (<a href="Matrix-Type.html#t:Normalize" title="Matrix.Type">Normalize</a> m), <a href="Matrix-Type.html#t:Normalize" title="Matrix.Type">Normalize</a> (<a href="/package/base-4.12.0.0/docs/Data-Either.html#t:Either" title="Data.Either">Either</a> m n) ~ <a href="/package/base-4.12.0.0/docs/Data-Either.html#t:Either" title="Data.Either">Either</a> (<a href="Matrix-Type.html#t:Normalize" title="Matrix.Type">Normalize</a> m) (<a href="Matrix-Type.html#t:Normalize" title="Matrix.Type">Normalize</a> n)) =&gt; <a href="Matrix-Type.html#t:Matrix" title="Matrix.Type">Matrix</a> e m (<a href="/package/base-4.12.0.0/docs/Data-Either.html#t:Either" title="Data.Either">Either</a> m n) <a href="src/Matrix.Type.html#i1" class="link">Source</a> <a href="#v:i1" class="selflink">#</a></p><div class="doc"><p>Biproduct first component injection</p></div></div><div class="top"><p class="src"><a id="v:i2" class="def">i2</a> :: (<a href="/package/base-4.12.0.0/docs/Prelude.html#t:Num" title="Prelude">Num</a> e, <a href="/package/base-4.12.0.0/docs/GHC-TypeNats.html#t:KnownNat" title="GHC.TypeNats">KnownNat</a> (<a href="Matrix-Type.html#t:Count" title="Matrix.Type">Count</a> (<a href="Matrix-Type.html#t:Normalize" title="Matrix.Type">Normalize</a> n)), <a href="/package/base-4.12.0.0/docs/GHC-TypeNats.html#t:KnownNat" title="GHC.TypeNats">KnownNat</a> (<a href="Matrix-Type.html#t:Count" title="Matrix.Type">Count</a> (<a href="Matrix-Type.html#t:Normalize" title="Matrix.Type">Normalize</a> m)), <a href="Matrix-Type.html#t:FromLists" title="Matrix.Type">FromLists</a> e (<a href="Matrix-Type.html#t:Normalize" title="Matrix.Type">Normalize</a> m) (<a href="Matrix-Type.html#t:Normalize" title="Matrix.Type">Normalize</a> n), <a href="Matrix-Type.html#t:FromLists" title="Matrix.Type">FromLists</a> e (<a href="Matrix-Type.html#t:Normalize" title="Matrix.Type">Normalize</a> n) (<a href="Matrix-Type.html#t:Normalize" title="Matrix.Type">Normalize</a> n), <a href="Matrix-Type.html#t:Normalize" title="Matrix.Type">Normalize</a> (<a href="/package/base-4.12.0.0/docs/Data-Either.html#t:Either" title="Data.Either">Either</a> m n) ~ <a href="/package/base-4.12.0.0/docs/Data-Either.html#t:Either" title="Data.Either">Either</a> (<a href="Matrix-Type.html#t:Normalize" title="Matrix.Type">Normalize</a> m) (<a href="Matrix-Type.html#t:Normalize" title="Matrix.Type">Normalize</a> n)) =&gt; <a href="Matrix-Type.html#t:Matrix" title="Matrix.Type">Matrix</a> e n (<a href="/package/base-4.12.0.0/docs/Data-Either.html#t:Either" title="Data.Either">Either</a> m n) <a href="src/Matrix.Type.html#i2" class="link">Source</a> <a href="#v:i2" class="selflink">#</a></p><div class="doc"><p>Biproduct second component injection</p></div></div><a href="#g:20" id="g:20"><h2>Bifunctors</h2></a><div class="top"><p class="src"><a id="v:-45--124--45-" class="def">(-|-)</a> :: (<a href="/package/base-4.12.0.0/docs/Prelude.html#t:Num" title="Prelude">Num</a> e, <a href="/package/base-4.12.0.0/docs/GHC-TypeNats.html#t:KnownNat" title="GHC.TypeNats">KnownNat</a> (<a href="Matrix-Type.html#t:Count" title="Matrix.Type">Count</a> (<a href="Matrix-Type.html#t:Normalize" title="Matrix.Type">Normalize</a> j)), <a href="/package/base-4.12.0.0/docs/GHC-TypeNats.html#t:KnownNat" title="GHC.TypeNats">KnownNat</a> (<a href="Matrix-Type.html#t:Count" title="Matrix.Type">Count</a> (<a href="Matrix-Type.html#t:Normalize" title="Matrix.Type">Normalize</a> k)), <a href="Matrix-Type.html#t:FromLists" title="Matrix.Type">FromLists</a> e (<a href="Matrix-Type.html#t:Normalize" title="Matrix.Type">Normalize</a> k) (<a href="Matrix-Type.html#t:Normalize" title="Matrix.Type">Normalize</a> k), <a href="Matrix-Type.html#t:FromLists" title="Matrix.Type">FromLists</a> e (<a href="Matrix-Type.html#t:Normalize" title="Matrix.Type">Normalize</a> j) (<a href="Matrix-Type.html#t:Normalize" title="Matrix.Type">Normalize</a> k), <a href="Matrix-Type.html#t:FromLists" title="Matrix.Type">FromLists</a> e (<a href="Matrix-Type.html#t:Normalize" title="Matrix.Type">Normalize</a> k) (<a href="Matrix-Type.html#t:Normalize" title="Matrix.Type">Normalize</a> j), <a href="Matrix-Type.html#t:FromLists" title="Matrix.Type">FromLists</a> e (<a href="Matrix-Type.html#t:Normalize" title="Matrix.Type">Normalize</a> j) (<a href="Matrix-Type.html#t:Normalize" title="Matrix.Type">Normalize</a> j), <a href="Matrix-Type.html#t:Normalize" title="Matrix.Type">Normalize</a> (<a href="/package/base-4.12.0.0/docs/Data-Either.html#t:Either" title="Data.Either">Either</a> n m) ~ <a href="/package/base-4.12.0.0/docs/Data-Either.html#t:Either" title="Data.Either">Either</a> (<a href="Matrix-Type.html#t:Normalize" title="Matrix.Type">Normalize</a> n) (<a href="Matrix-Type.html#t:Normalize" title="Matrix.Type">Normalize</a> m), <a href="Matrix-Type.html#t:Normalize" title="Matrix.Type">Normalize</a> (<a href="/package/base-4.12.0.0/docs/Data-Either.html#t:Either" title="Data.Either">Either</a> k j) ~ <a href="/package/base-4.12.0.0/docs/Data-Either.html#t:Either" title="Data.Either">Either</a> (<a href="Matrix-Type.html#t:Normalize" title="Matrix.Type">Normalize</a> k) (<a href="Matrix-Type.html#t:Normalize" title="Matrix.Type">Normalize</a> j)) =&gt; <a href="Matrix-Type.html#t:Matrix" title="Matrix.Type">Matrix</a> e n k -&gt; <a href="Matrix-Type.html#t:Matrix" title="Matrix.Type">Matrix</a> e m j -&gt; <a href="Matrix-Type.html#t:Matrix" title="Matrix.Type">Matrix</a> e (<a href="/package/base-4.12.0.0/docs/Data-Either.html#t:Either" title="Data.Either">Either</a> n m) (<a href="/package/base-4.12.0.0/docs/Data-Either.html#t:Either" title="Data.Either">Either</a> k j) <span class="fixity">infixl 5</span><span class="rightedge"></span> <a href="src/Matrix.Type.html#-%7C-" class="link">Source</a> <a href="#v:-45--124--45-" class="selflink">#</a></p><div class="doc"><p>Matrix coproduct functor also known as matrix direct sum.</p></div></div><div class="top"><p class="src"><a id="v:-62--60-" class="def">(&gt;&lt;)</a> :: <span class="keyword">forall</span> e m p n q. (<a href="/package/base-4.12.0.0/docs/Prelude.html#t:Num" title="Prelude">Num</a> e, <a href="/package/base-4.12.0.0/docs/GHC-TypeNats.html#t:KnownNat" title="GHC.TypeNats">KnownNat</a> (<a href="Matrix-Type.html#t:Count" title="Matrix.Type">Count</a> (<a href="Matrix-Type.html#t:Normalize" title="Matrix.Type">Normalize</a> m)), <a href="/package/base-4.12.0.0/docs/GHC-TypeNats.html#t:KnownNat" title="GHC.TypeNats">KnownNat</a> (<a href="Matrix-Type.html#t:Count" title="Matrix.Type">Count</a> (<a href="Matrix-Type.html#t:Normalize" title="Matrix.Type">Normalize</a> n)), <a href="/package/base-4.12.0.0/docs/GHC-TypeNats.html#t:KnownNat" title="GHC.TypeNats">KnownNat</a> (<a href="Matrix-Type.html#t:Count" title="Matrix.Type">Count</a> (<a href="Matrix-Type.html#t:Normalize" title="Matrix.Type">Normalize</a> p)), <a href="/package/base-4.12.0.0/docs/GHC-TypeNats.html#t:KnownNat" title="GHC.TypeNats">KnownNat</a> (<a href="Matrix-Type.html#t:Count" title="Matrix.Type">Count</a> (<a href="Matrix-Type.html#t:Normalize" title="Matrix.Type">Normalize</a> q)), <a href="/package/base-4.12.0.0/docs/GHC-TypeNats.html#t:KnownNat" title="GHC.TypeNats">KnownNat</a> (<a href="Matrix-Type.html#t:Count" title="Matrix.Type">Count</a> (<a href="Matrix-Type.html#t:Normalize" title="Matrix.Type">Normalize</a> (m, n))), <a href="/package/base-4.12.0.0/docs/GHC-TypeNats.html#t:KnownNat" title="GHC.TypeNats">KnownNat</a> (<a href="Matrix-Type.html#t:Count" title="Matrix.Type">Count</a> (<a href="Matrix-Type.html#t:Normalize" title="Matrix.Type">Normalize</a> (p, q))), <a href="Matrix-Type.html#t:FromLists" title="Matrix.Type">FromLists</a> e (<a href="Matrix-Type.html#t:Normalize" title="Matrix.Type">Normalize</a> (m, n)) (<a href="Matrix-Type.html#t:Normalize" title="Matrix.Type">Normalize</a> m), <a href="Matrix-Type.html#t:FromLists" title="Matrix.Type">FromLists</a> e (<a href="Matrix-Type.html#t:Normalize" title="Matrix.Type">Normalize</a> (m, n)) (<a href="Matrix-Type.html#t:Normalize" title="Matrix.Type">Normalize</a> n), <a href="Matrix-Type.html#t:FromLists" title="Matrix.Type">FromLists</a> e (<a href="Matrix-Type.html#t:Normalize" title="Matrix.Type">Normalize</a> (p, q)) (<a href="Matrix-Type.html#t:Normalize" title="Matrix.Type">Normalize</a> p), <a href="Matrix-Type.html#t:FromLists" title="Matrix.Type">FromLists</a> e (<a href="Matrix-Type.html#t:Normalize" title="Matrix.Type">Normalize</a> (p, q)) (<a href="Matrix-Type.html#t:Normalize" title="Matrix.Type">Normalize</a> q), <a href="Matrix-Type.html#t:Normalize" title="Matrix.Type">Normalize</a> (m, n) ~ <a href="Matrix-Type.html#t:Normalize" title="Matrix.Type">Normalize</a> (<a href="Matrix-Type.html#t:Normalize" title="Matrix.Type">Normalize</a> m, <a href="Matrix-Type.html#t:Normalize" title="Matrix.Type">Normalize</a> n), <a href="Matrix-Type.html#t:Normalize" title="Matrix.Type">Normalize</a> (p, q) ~ <a href="Matrix-Type.html#t:Normalize" title="Matrix.Type">Normalize</a> (<a href="Matrix-Type.html#t:Normalize" title="Matrix.Type">Normalize</a> p, <a href="Matrix-Type.html#t:Normalize" title="Matrix.Type">Normalize</a> q)) =&gt; <a href="Matrix-Type.html#t:Matrix" title="Matrix.Type">Matrix</a> e m p -&gt; <a href="Matrix-Type.html#t:Matrix" title="Matrix.Type">Matrix</a> e n q -&gt; <a href="Matrix-Type.html#t:Matrix" title="Matrix.Type">Matrix</a> e (m, n) (p, q) <span class="fixity">infixl 4</span><span class="rightedge"></span> <a href="src/Matrix.Type.html#%3E%3C" class="link">Source</a> <a href="#v:-62--60-" class="selflink">#</a></p><div class="doc"><p>Matrix product functor also known as kronecker product</p></div></div><a href="#g:21" id="g:21"><h2>Applicative matrix combinators</h2></a><div class="doc"><p>Note that given the restrictions imposed it is not possible to
28+ implement the standard type classes present in standard Haskell.
29+ *** Matrix pairing projections</p></div><div class="top"><p class="src"><a id="v:kp1" class="def">kp1</a> :: <span class="keyword">forall</span> e m k. (<a href="/package/base-4.12.0.0/docs/Prelude.html#t:Num" title="Prelude">Num</a> e, <a href="/package/base-4.12.0.0/docs/GHC-TypeNats.html#t:KnownNat" title="GHC.TypeNats">KnownNat</a> (<a href="Matrix-Type.html#t:Count" title="Matrix.Type">Count</a> (<a href="Matrix-Type.html#t:Normalize" title="Matrix.Type">Normalize</a> m)), <a href="/package/base-4.12.0.0/docs/GHC-TypeNats.html#t:KnownNat" title="GHC.TypeNats">KnownNat</a> (<a href="Matrix-Type.html#t:Count" title="Matrix.Type">Count</a> (<a href="Matrix-Type.html#t:Normalize" title="Matrix.Type">Normalize</a> k)), <a href="/package/base-4.12.0.0/docs/GHC-TypeNats.html#t:KnownNat" title="GHC.TypeNats">KnownNat</a> (<a href="Matrix-Type.html#t:Count" title="Matrix.Type">Count</a> (<a href="Matrix-Type.html#t:Normalize" title="Matrix.Type">Normalize</a> (m, k))), <a href="Matrix-Type.html#t:FromLists" title="Matrix.Type">FromLists</a> e (<a href="Matrix-Type.html#t:Normalize" title="Matrix.Type">Normalize</a> (m, k)) (<a href="Matrix-Type.html#t:Normalize" title="Matrix.Type">Normalize</a> m), <a href="Matrix-Type.html#t:Normalize" title="Matrix.Type">Normalize</a> (m, k) ~ <a href="Matrix-Type.html#t:Normalize" title="Matrix.Type">Normalize</a> (<a href="Matrix-Type.html#t:Normalize" title="Matrix.Type">Normalize</a> m, <a href="Matrix-Type.html#t:Normalize" title="Matrix.Type">Normalize</a> k)) =&gt; <a href="Matrix-Type.html#t:Matrix" title="Matrix.Type">Matrix</a> e (m, k) m <a href="src/Matrix.Type.html#kp1" class="link">Source</a> <a href="#v:kp1" class="selflink">#</a></p><div class="doc"><p>Khatri Rao product first component projection matrix.</p></div></div><div class="top"><p class="src"><a id="v:kp2" class="def">kp2</a> :: <span class="keyword">forall</span> e m k. (<a href="/package/base-4.12.0.0/docs/Prelude.html#t:Num" title="Prelude">Num</a> e, <a href="/package/base-4.12.0.0/docs/GHC-TypeNats.html#t:KnownNat" title="GHC.TypeNats">KnownNat</a> (<a href="Matrix-Type.html#t:Count" title="Matrix.Type">Count</a> (<a href="Matrix-Type.html#t:Normalize" title="Matrix.Type">Normalize</a> k)), <a href="/package/base-4.12.0.0/docs/GHC-TypeNats.html#t:KnownNat" title="GHC.TypeNats">KnownNat</a> (<a href="Matrix-Type.html#t:Count" title="Matrix.Type">Count</a> (<a href="Matrix-Type.html#t:Normalize" title="Matrix.Type">Normalize</a> m)), <a href="/package/base-4.12.0.0/docs/GHC-TypeNats.html#t:KnownNat" title="GHC.TypeNats">KnownNat</a> (<a href="Matrix-Type.html#t:Count" title="Matrix.Type">Count</a> (<a href="Matrix-Type.html#t:Normalize" title="Matrix.Type">Normalize</a> (m, k))), <a href="Matrix-Type.html#t:FromLists" title="Matrix.Type">FromLists</a> e (<a href="Matrix-Type.html#t:Normalize" title="Matrix.Type">Normalize</a> (m, k)) (<a href="Matrix-Type.html#t:Normalize" title="Matrix.Type">Normalize</a> k), <a href="Matrix-Type.html#t:Normalize" title="Matrix.Type">Normalize</a> (m, k) ~ <a href="Matrix-Type.html#t:Normalize" title="Matrix.Type">Normalize</a> (<a href="Matrix-Type.html#t:Normalize" title="Matrix.Type">Normalize</a> m, <a href="Matrix-Type.html#t:Normalize" title="Matrix.Type">Normalize</a> k)) =&gt; <a href="Matrix-Type.html#t:Matrix" title="Matrix.Type">Matrix</a> e (m, k) k <a href="src/Matrix.Type.html#kp2" class="link">Source</a> <a href="#v:kp2" class="selflink">#</a></p><div class="doc"><p>Khatri Rao product second component projection matrix.</p></div></div><a href="#g:22" id="g:22"><h3>Matrix pairing</h3></a><div class="top"><p class="src"><a id="v:khatri" class="def">khatri</a> :: <span class="keyword">forall</span> e cols a b. (<a href="/package/base-4.12.0.0/docs/Prelude.html#t:Num" title="Prelude">Num</a> e, <a href="/package/base-4.12.0.0/docs/GHC-TypeNats.html#t:KnownNat" title="GHC.TypeNats">KnownNat</a> (<a href="Matrix-Type.html#t:Count" title="Matrix.Type">Count</a> (<a href="Matrix-Type.html#t:Normalize" title="Matrix.Type">Normalize</a> a)), <a href="/package/base-4.12.0.0/docs/GHC-TypeNats.html#t:KnownNat" title="GHC.TypeNats">KnownNat</a> (<a href="Matrix-Type.html#t:Count" title="Matrix.Type">Count</a> (<a href="Matrix-Type.html#t:Normalize" title="Matrix.Type">Normalize</a> b)), <a href="/package/base-4.12.0.0/docs/GHC-TypeNats.html#t:KnownNat" title="GHC.TypeNats">KnownNat</a> (<a href="Matrix-Type.html#t:Count" title="Matrix.Type">Count</a> (<a href="Matrix-Type.html#t:Normalize" title="Matrix.Type">Normalize</a> (a, b))), <a href="Matrix-Type.html#t:FromLists" title="Matrix.Type">FromLists</a> e (<a href="Matrix-Type.html#t:Normalize" title="Matrix.Type">Normalize</a> (a, b)) (<a href="Matrix-Type.html#t:Normalize" title="Matrix.Type">Normalize</a> a), <a href="Matrix-Type.html#t:FromLists" title="Matrix.Type">FromLists</a> e (<a href="Matrix-Type.html#t:Normalize" title="Matrix.Type">Normalize</a> (a, b)) (<a href="Matrix-Type.html#t:Normalize" title="Matrix.Type">Normalize</a> b), <a href="Matrix-Type.html#t:Normalize" title="Matrix.Type">Normalize</a> (a, b) ~ <a href="Matrix-Type.html#t:Normalize" title="Matrix.Type">Normalize</a> (<a href="Matrix-Type.html#t:Normalize" title="Matrix.Type">Normalize</a> a, <a href="Matrix-Type.html#t:Normalize" title="Matrix.Type">Normalize</a> b)) =&gt; <a href="Matrix-Type.html#t:Matrix" title="Matrix.Type">Matrix</a> e cols a -&gt; <a href="Matrix-Type.html#t:Matrix" title="Matrix.Type">Matrix</a> e cols b -&gt; <a href="Matrix-Type.html#t:Matrix" title="Matrix.Type">Matrix</a> e cols (a, b) <a href="src/Matrix.Type.html#khatri" class="link">Source</a> <a href="#v:khatri" class="selflink">#</a></p><div class="doc"><p>Khatri Rao Matrix product also known as matrix pairing.</p><p>NOTE: That this is not a true categorical product, see for instance:</p><pre> | kp1 <code><a href="Matrix-Type.html#v:comp" title="Matrix.Type">comp</a></code> khatri a b == a
30+khatri a b ==&gt; |
31+ | kp2 <code><a href="Matrix-Type.html#v:comp" title="Matrix.Type">comp</a></code> khatri a b == b
32+</pre><p><strong>Emphasis</strong> on the implication symbol.</p></div></div><a href="#g:23" id="g:23"><h1>Matrix composition and lifting</h1></a><a href="#g:24" id="g:24"><h2>Arrow matrix combinators</h2></a><div class="doc"><p>Note that given the restrictions imposed it is not possible to
33+ implement the standard type classes present in standard Haskell.</p></div><div class="top"><p class="src"><a id="v:identity" class="def">identity</a> :: (<a href="/package/base-4.12.0.0/docs/Prelude.html#t:Num" title="Prelude">Num</a> e, <a href="Matrix-Type.html#t:FromLists" title="Matrix.Type">FromLists</a> e (<a href="Matrix-Type.html#t:Normalize" title="Matrix.Type">Normalize</a> a) (<a href="Matrix-Type.html#t:Normalize" title="Matrix.Type">Normalize</a> a), <a href="/package/base-4.12.0.0/docs/GHC-TypeNats.html#t:KnownNat" title="GHC.TypeNats">KnownNat</a> (<a href="Matrix-Type.html#t:Count" title="Matrix.Type">Count</a> (<a href="Matrix-Type.html#t:Normalize" title="Matrix.Type">Normalize</a> a))) =&gt; <a href="Matrix-Type.html#t:Matrix" title="Matrix.Type">Matrix</a> e a a <a href="src/Matrix.Type.html#identity" class="link">Source</a> <a href="#v:identity" class="selflink">#</a></p><div class="doc"><p>Identity matrix</p></div></div><div class="top"><p class="src"><a id="v:comp" class="def">comp</a> :: <a href="/package/base-4.12.0.0/docs/Prelude.html#t:Num" title="Prelude">Num</a> e =&gt; <a href="Matrix-Type.html#t:Matrix" title="Matrix.Type">Matrix</a> e cr rows -&gt; <a href="Matrix-Type.html#t:Matrix" title="Matrix.Type">Matrix</a> e cols cr -&gt; <a href="Matrix-Type.html#t:Matrix" title="Matrix.Type">Matrix</a> e cols rows <a href="src/Matrix.Type.html#comp" class="link">Source</a> <a href="#v:comp" class="selflink">#</a></p><div class="doc"><p>Matrix composition. Equivalent to matrix-matrix multiplication.</p><p>This definition takes advantage of divide-and-conquer and fusion laws
34+ from LAoP.</p></div></div><div class="top"><p class="src"><a id="v:fromF" class="def">fromF</a> :: (<a href="/package/base-4.12.0.0/docs/Prelude.html#t:Bounded" title="Prelude">Bounded</a> a, <a href="/package/base-4.12.0.0/docs/Prelude.html#t:Bounded" title="Prelude">Bounded</a> b, <a href="/package/base-4.12.0.0/docs/Prelude.html#t:Enum" title="Prelude">Enum</a> a, <a href="/package/base-4.12.0.0/docs/Prelude.html#t:Enum" title="Prelude">Enum</a> b, <a href="/package/base-4.12.0.0/docs/Data-Eq.html#t:Eq" title="Data.Eq">Eq</a> b, <a href="/package/base-4.12.0.0/docs/Prelude.html#t:Num" title="Prelude">Num</a> e, <a href="/package/base-4.12.0.0/docs/Data-Ord.html#t:Ord" title="Data.Ord">Ord</a> e, <a href="/package/base-4.12.0.0/docs/GHC-TypeNats.html#t:KnownNat" title="GHC.TypeNats">KnownNat</a> (<a href="Matrix-Type.html#t:Count" title="Matrix.Type">Count</a> (<a href="Matrix-Type.html#t:Normalize" title="Matrix.Type">Normalize</a> cols)), <a href="/package/base-4.12.0.0/docs/GHC-TypeNats.html#t:KnownNat" title="GHC.TypeNats">KnownNat</a> (<a href="Matrix-Type.html#t:Count" title="Matrix.Type">Count</a> (<a href="Matrix-Type.html#t:Normalize" title="Matrix.Type">Normalize</a> rows)), <a href="Matrix-Type.html#t:FromLists" title="Matrix.Type">FromLists</a> e (<a href="Matrix-Type.html#t:Normalize" title="Matrix.Type">Normalize</a> rows) (<a href="Matrix-Type.html#t:Normalize" title="Matrix.Type">Normalize</a> cols)) =&gt; (a -&gt; b) -&gt; <a href="Matrix-Type.html#t:Matrix" title="Matrix.Type">Matrix</a> e cols rows <a href="src/Matrix.Type.html#fromF" class="link">Source</a> <a href="#v:fromF" class="selflink">#</a></p><div class="doc"><p>Lifts functions to matrices with arbitrary dimensions.</p><p>NOTE: Be careful to not ask for a matrix bigger than the cardinality of
35+ types <code>a</code> or <code>b</code> allows.</p></div></div><div class="top"><p class="src"><a id="v:fromF-39-" class="def">fromF'</a> :: (<a href="/package/base-4.12.0.0/docs/Prelude.html#t:Bounded" title="Prelude">Bounded</a> a, <a href="/package/base-4.12.0.0/docs/Prelude.html#t:Bounded" title="Prelude">Bounded</a> b, <a href="/package/base-4.12.0.0/docs/Prelude.html#t:Enum" title="Prelude">Enum</a> a, <a href="/package/base-4.12.0.0/docs/Prelude.html#t:Enum" title="Prelude">Enum</a> b, <a href="/package/base-4.12.0.0/docs/Data-Eq.html#t:Eq" title="Data.Eq">Eq</a> b, <a href="/package/base-4.12.0.0/docs/Prelude.html#t:Num" title="Prelude">Num</a> e, <a href="/package/base-4.12.0.0/docs/Data-Ord.html#t:Ord" title="Data.Ord">Ord</a> e, <a href="/package/base-4.12.0.0/docs/GHC-TypeNats.html#t:KnownNat" title="GHC.TypeNats">KnownNat</a> (<a href="Matrix-Type.html#t:Count" title="Matrix.Type">Count</a> (<a href="Matrix-Type.html#t:Normalize" title="Matrix.Type">Normalize</a> a)), <a href="/package/base-4.12.0.0/docs/GHC-TypeNats.html#t:KnownNat" title="GHC.TypeNats">KnownNat</a> (<a href="Matrix-Type.html#t:Count" title="Matrix.Type">Count</a> (<a href="Matrix-Type.html#t:Normalize" title="Matrix.Type">Normalize</a> b)), <a href="Matrix-Type.html#t:FromLists" title="Matrix.Type">FromLists</a> e (<a href="Matrix-Type.html#t:Normalize" title="Matrix.Type">Normalize</a> b) (<a href="Matrix-Type.html#t:Normalize" title="Matrix.Type">Normalize</a> a)) =&gt; (a -&gt; b) -&gt; <a href="Matrix-Type.html#t:Matrix" title="Matrix.Type">Matrix</a> e a b <a href="src/Matrix.Type.html#fromF%27" class="link">Source</a> <a href="#v:fromF-39-" class="selflink">#</a></p><div class="doc"><p>Lifts functions to matrices with dimensions matching <code>a</code> and <code>b</code>
36+ cardinality's.</p></div></div><a href="#g:25" id="g:25"><h1>Matrix printing</h1></a><div class="top"><p class="src"><a id="v:pretty" class="def">pretty</a> :: (<a href="/package/base-4.12.0.0/docs/GHC-TypeNats.html#t:KnownNat" title="GHC.TypeNats">KnownNat</a> (<a href="Matrix-Type.html#t:Count" title="Matrix.Type">Count</a> (<a href="Matrix-Type.html#t:Normalize" title="Matrix.Type">Normalize</a> cols)), <a href="/package/base-4.12.0.0/docs/Text-Show.html#t:Show" title="Text.Show">Show</a> e) =&gt; <a href="Matrix-Type.html#t:Matrix" title="Matrix.Type">Matrix</a> e cols rows -&gt; <a href="/package/base-4.12.0.0/docs/Data-String.html#t:String" title="Data.String">String</a> <a href="src/Matrix.Type.html#pretty" class="link">Source</a> <a href="#v:pretty" class="selflink">#</a></p><div class="doc"><p>Matrix pretty printer</p></div></div><div class="top"><p class="src"><a id="v:prettyPrint" class="def">prettyPrint</a> :: (<a href="/package/base-4.12.0.0/docs/GHC-TypeNats.html#t:KnownNat" title="GHC.TypeNats">KnownNat</a> (<a href="Matrix-Type.html#t:Count" title="Matrix.Type">Count</a> (<a href="Matrix-Type.html#t:Normalize" title="Matrix.Type">Normalize</a> cols)), <a href="/package/base-4.12.0.0/docs/Text-Show.html#t:Show" title="Text.Show">Show</a> e) =&gt; <a href="Matrix-Type.html#t:Matrix" title="Matrix.Type">Matrix</a> e cols rows -&gt; <a href="/package/base-4.12.0.0/docs/System-IO.html#t:IO" title="System.IO">IO</a> () <a href="src/Matrix.Type.html#prettyPrint" class="link">Source</a> <a href="#v:prettyPrint" class="selflink">#</a></p><div class="doc"><p>Matrix pretty printer</p></div></div></div></div><div id="footer"><p>Produced by <a href="http://www.haskell.org/haddock/">Haddock</a> version 2.22.0</p></div></body></html>
build/x86_64-linux/ghc-8.6.5/laop-0.1.0.0/doc/html/laop-0.1.0.0-docs/Utils.htmlnew file+52
@@ -0,0 +1,52 @@
1+<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"><html xmlns="http://www.w3.org/1999/xhtml"><head><meta http-equiv="Content-Type" content="text/html; charset=UTF-8" /><title>Utils</title><link href="ocean.css" rel="stylesheet" type="text/css" title="Ocean" /><link rel="stylesheet" type="text/css" href="quick-jump.css" /><script src="haddock-bundle.min.js" async="async" type="text/javascript"></script><script src="https://cdnjs.cloudflare.com/ajax/libs/mathjax/2.7.0/MathJax.js?config=TeX-AMS-MML_HTMLorMML" type="text/javascript"></script></head><body><div id="package-header"><ul class="links" id="page-menu"><li><a href="src/Utils.html">Source</a></li><li><a href="/package/laop-0.1.0.0">Contents</a></li><li><a href="doc-index.html">Index</a></li></ul><p class="caption">laop-0.1.0.0: An inductive matrix definition library &#224; la LAoP</p></div><div id="content"><div id="module-header"><table class="info"><tr><th valign="top">Copyright</th><td>(c) Armando Santos 2019-2020</td></tr><tr><th>Maintainer</th><td>armandoifsantos@gmail.com</td></tr><tr><th>Stability</th><td>experimental</td></tr><tr><th>Safe Haskell</th><td>None</td></tr><tr><th>Language</th><td>Haskell2010</td></tr></table><p class="caption">Utils</p></div><div id="table-of-contents"><p class="caption">Contents</p><ul><li><a href="#g:1">Coerce auxiliar functions to help promote <code>Int</code> typed functions to</a></li></ul></div><div id="description"><p class="caption">Description</p><div class="doc"><p><strong>LAoP</strong> is a library for algebraic (inductive) construction and manipulation of matrices
2+ in Haskell. See <a href="https://github.com/bolt12/master-thesis">my Msc Thesis</a> for the
3+ motivation behind the library, the underlying theory, and implementation details.</p><p>This module provides the <code><a href="Utils.html#t:Natural" title="Utils">Natural</a></code> data type.
4+ The semantic associated with this data type is that
5+ it's meant to be a restricted <code><a href="/package/base-4.12.0.0/docs/Data-Int.html#t:Int" title="Data.Int">Int</a></code> value.</p></div></div><div id="synopsis"><details id="syn"><summary>Synopsis</summary><ul class="details-toggle" data-details-id="syn"><li class="src short"><span class="keyword">data</span> <a href="#t:Natural">Natural</a> (start :: <a href="/package/base-4.12.0.0/docs/GHC-TypeNats.html#t:Nat" title="GHC.TypeNats">Nat</a>) (end :: <a href="/package/base-4.12.0.0/docs/GHC-TypeNats.html#t:Nat" title="GHC.TypeNats">Nat</a>)</li><li class="src short"><a href="#v:nat">nat</a> :: <span class="keyword">forall</span> n m. (<a href="/package/base-4.12.0.0/docs/GHC-TypeNats.html#t:KnownNat" title="GHC.TypeNats">KnownNat</a> n, <a href="/package/base-4.12.0.0/docs/GHC-TypeNats.html#t:KnownNat" title="GHC.TypeNats">KnownNat</a> m) =&gt; <a href="/package/base-4.12.0.0/docs/Data-Int.html#t:Int" title="Data.Int">Int</a> -&gt; <a href="Utils.html#t:Natural" title="Utils">Natural</a> n m</li><li class="src short"><a href="#v:coerceNat">coerceNat</a> :: (<a href="/package/base-4.12.0.0/docs/Data-Int.html#t:Int" title="Data.Int">Int</a> -&gt; <a href="/package/base-4.12.0.0/docs/Data-Int.html#t:Int" title="Data.Int">Int</a> -&gt; <a href="/package/base-4.12.0.0/docs/Data-Int.html#t:Int" title="Data.Int">Int</a>) -&gt; <a href="Utils.html#t:Natural" title="Utils">Natural</a> a a' -&gt; <a href="Utils.html#t:Natural" title="Utils">Natural</a> b b' -&gt; <a href="Utils.html#t:Natural" title="Utils">Natural</a> c c'</li><li class="src short"><a href="#v:coerceNat2">coerceNat2</a> :: ((<a href="/package/base-4.12.0.0/docs/Data-Int.html#t:Int" title="Data.Int">Int</a>, <a href="/package/base-4.12.0.0/docs/Data-Int.html#t:Int" title="Data.Int">Int</a>) -&gt; <a href="/package/base-4.12.0.0/docs/Data-Int.html#t:Int" title="Data.Int">Int</a> -&gt; <a href="/package/base-4.12.0.0/docs/Data-Int.html#t:Int" title="Data.Int">Int</a>) -&gt; (<a href="Utils.html#t:Natural" title="Utils">Natural</a> a a', <a href="Utils.html#t:Natural" title="Utils">Natural</a> b b') -&gt; <a href="Utils.html#t:Natural" title="Utils">Natural</a> c c' -&gt; <a href="Utils.html#t:Natural" title="Utils">Natural</a> d d'</li><li class="src short"><a href="#v:coerceNat3">coerceNat3</a> :: (<a href="/package/base-4.12.0.0/docs/Data-Int.html#t:Int" title="Data.Int">Int</a> -&gt; <a href="/package/base-4.12.0.0/docs/Data-Int.html#t:Int" title="Data.Int">Int</a> -&gt; a) -&gt; <a href="Utils.html#t:Natural" title="Utils">Natural</a> b b' -&gt; <a href="Utils.html#t:Natural" title="Utils">Natural</a> c c' -&gt; a</li></ul></details></div><div id="interface"><h1>Documentation</h1><div class="doc"><p>Utility module that provides the <code><a href="Utils.html#t:Natural" title="Utils">Natural</a></code> data type.
6+ The semantic associated with this data type is that
7+ it's meant to be a restricted <code><a href="/package/base-4.12.0.0/docs/Data-Int.html#t:Int" title="Data.Int">Int</a></code> value. For example
8+ the type <code>Natural 1 6</code> can only be instanciated with <code>nat n</code>
9+ where <code>1 &lt;= n &lt;= 6</code>. Why, You might ask, because with normal
10+ <code><a href="/package/base-4.12.0.0/docs/Data-Int.html#t:Int" title="Data.Int">Int</a></code>s it is not possible to have a decent <code>Enum (Int, Int)</code>
11+ instance. See the following probabilistic programming model as and
12+ example:</p><p>We want to calculate the probability of the sum of two dice throws.
13+ To do this we start by defining the sample space: </p><pre>type SampleSpace = Int -- We think <code><a href="/package/base-4.12.0.0/docs/Data-Int.html#t:Int" title="Data.Int">Int</a></code> are enough
14+
15+die :: Dist Int 6
16+die = unifrom [1..6]
17+
18+-- Promote <code><a href="/package/base-4.12.0.0/docs/Data-Int.html#t:Int" title="Data.Int">Int</a></code> addition to a matrix
19+addM = fromF (uncurry (+)) -- Impossible
20+</pre><p>The last line is impossible because <code>(Int, Int)</code> does not have
21+ a good <code><a href="/package/base-4.12.0.0/docs/Prelude.html#t:Enum" title="Prelude">Enum</a></code> instance: <code>[(0, 1), (0, 2), .. (0, maxBound), (1, 0),
22+ ..]</code>. And we'd like the addition matrix to be of 36 columns by 12
23+ rows but limited to integers up to <code>6</code>!</p><p>One way to solve this issue is by defining and auxilary data type to
24+ represent the sample space:</p><pre>data SampleSpace = S1 | S2 | S3 | S4 | S5 | S6
25+ deriving (Show, Eq, Enum, Bounded) -- Enum and Bounded are
26+ important
27+</pre><p>And write the sample space addition function:</p><pre>ssAdd :: SampleSpace -&gt; SampleSpace -&gt; Int
28+ssAdd a b = (fromEnum a + 1) + (fromEnum b + 1)
29+</pre><p>And then promote that function to matrix and everything is alright:</p><pre>ssAddM = fromF' (uncurry ssAdd)
30+
31+dieSumProb = ssAddM <code>comp</code> (khatri die die)
32+</pre><p>This is a nice solution for small sample spaces. But for larger ones
33+ it is not feasible to write a data type with hundreds of constructors
34+ and then write manipulation functions that need to deal with them.
35+ To mitigate this limitation the <code><a href="Utils.html#t:Natural" title="Utils">Natural</a></code> type comes a long way and
36+ allows one to model the sample in an easier way. See for instance:</p><pre>ssAdd :: Natural 1 6 -&gt; Natural 1 6 -&gt; Natural 1 12
37+ssAdd = coerceNat (+)
38+
39+ssAddM = fromF' (uncurry sumSS)
40+
41+die :: Dist (Natural 1 6) 6
42+die = uniform [nat <code>1 </code>6 1 .. nat 6]
43+
44+dieSumProb = ssAddM <code>comp</code> (khatri die die)
45+</pre><ul><li><code><a href="Utils.html#t:Natural" title="Utils">Natural</a></code> data type</li></ul></div><div class="top"><p class="src"><span class="keyword">data</span> <a id="t:Natural" class="def">Natural</a> (start :: <a href="/package/base-4.12.0.0/docs/GHC-TypeNats.html#t:Nat" title="GHC.TypeNats">Nat</a>) (end :: <a href="/package/base-4.12.0.0/docs/GHC-TypeNats.html#t:Nat" title="GHC.TypeNats">Nat</a>) <a href="src/Utils.Internal.html#Natural" class="link">Source</a> <a href="#t:Natural" class="selflink">#</a></p><div class="doc"><p>Wrapper around <code><a href="/package/base-4.12.0.0/docs/Data-Int.html#t:Int" title="Data.Int">Int</a></code>s that have a restrictive semantic associated.
46+ A value of type <code><code><a href="Utils.html#t:Natural" title="Utils">Natural</a></code> n m</code> can only be instanciated with some <code><a href="/package/base-4.12.0.0/docs/Data-Int.html#t:Int" title="Data.Int">Int</a></code>
47+ <code>i</code> that's <code>n &lt;= i &lt;= m</code>.</p></div><div class="subs instances"><details id="i:Natural" open="open"><summary>Instances</summary><table><tr><td class="src clearfix"><span class="inst-left"><span class="instance details-toggle-control details-toggle" data-details-id="i:id:Natural:Bounded:1"></span> (<a href="/package/base-4.12.0.0/docs/GHC-TypeNats.html#t:KnownNat" title="GHC.TypeNats">KnownNat</a> n, <a href="/package/base-4.12.0.0/docs/GHC-TypeNats.html#t:KnownNat" title="GHC.TypeNats">KnownNat</a> m) =&gt; <a href="/package/base-4.12.0.0/docs/Prelude.html#t:Bounded" title="Prelude">Bounded</a> (<a href="Utils.html#t:Natural" title="Utils">Natural</a> n m)</span> <a href="src/Utils.Internal.html#line-138" class="link">Source</a> <a href="#t:Natural" class="selflink">#</a></td><td class="doc empty">&nbsp;</td></tr><tr><td colspan="2"><details id="i:id:Natural:Bounded:1"><summary class="hide-when-js-enabled">Instance details</summary><p>Defined in <a href="Utils-Internal.html">Utils.Internal</a></p> <div class="subs methods"><p class="caption">Methods</p><p class="src"><a href="#v:minBound">minBound</a> :: <a href="Utils.html#t:Natural" title="Utils">Natural</a> n m <a href="#v:minBound" class="selflink">#</a></p><p class="src"><a href="#v:maxBound">maxBound</a> :: <a href="Utils.html#t:Natural" title="Utils">Natural</a> n m <a href="#v:maxBound" class="selflink">#</a></p></div></details></td></tr><tr><td class="src clearfix"><span class="inst-left"><span class="instance details-toggle-control details-toggle" data-details-id="i:id:Natural:Enum:2"></span> (<a href="/package/base-4.12.0.0/docs/GHC-TypeNats.html#t:KnownNat" title="GHC.TypeNats">KnownNat</a> n, <a href="/package/base-4.12.0.0/docs/GHC-TypeNats.html#t:KnownNat" title="GHC.TypeNats">KnownNat</a> m) =&gt; <a href="/package/base-4.12.0.0/docs/Prelude.html#t:Enum" title="Prelude">Enum</a> (<a href="Utils.html#t:Natural" title="Utils">Natural</a> n m)</span> <a href="src/Utils.Internal.html#line-142" class="link">Source</a> <a href="#t:Natural" class="selflink">#</a></td><td class="doc empty">&nbsp;</td></tr><tr><td colspan="2"><details id="i:id:Natural:Enum:2"><summary class="hide-when-js-enabled">Instance details</summary><p>Defined in <a href="Utils-Internal.html">Utils.Internal</a></p> <div class="subs methods"><p class="caption">Methods</p><p class="src"><a href="#v:succ">succ</a> :: <a href="Utils.html#t:Natural" title="Utils">Natural</a> n m -&gt; <a href="Utils.html#t:Natural" title="Utils">Natural</a> n m <a href="#v:succ" class="selflink">#</a></p><p class="src"><a href="#v:pred">pred</a> :: <a href="Utils.html#t:Natural" title="Utils">Natural</a> n m -&gt; <a href="Utils.html#t:Natural" title="Utils">Natural</a> n m <a href="#v:pred" class="selflink">#</a></p><p class="src"><a href="#v:toEnum">toEnum</a> :: <a href="/package/base-4.12.0.0/docs/Data-Int.html#t:Int" title="Data.Int">Int</a> -&gt; <a href="Utils.html#t:Natural" title="Utils">Natural</a> n m <a href="#v:toEnum" class="selflink">#</a></p><p class="src"><a href="#v:fromEnum">fromEnum</a> :: <a href="Utils.html#t:Natural" title="Utils">Natural</a> n m -&gt; <a href="/package/base-4.12.0.0/docs/Data-Int.html#t:Int" title="Data.Int">Int</a> <a href="#v:fromEnum" class="selflink">#</a></p><p class="src"><a href="#v:enumFrom">enumFrom</a> :: <a href="Utils.html#t:Natural" title="Utils">Natural</a> n m -&gt; [<a href="Utils.html#t:Natural" title="Utils">Natural</a> n m] <a href="#v:enumFrom" class="selflink">#</a></p><p class="src"><a href="#v:enumFromThen">enumFromThen</a> :: <a href="Utils.html#t:Natural" title="Utils">Natural</a> n m -&gt; <a href="Utils.html#t:Natural" title="Utils">Natural</a> n m -&gt; [<a href="Utils.html#t:Natural" title="Utils">Natural</a> n m] <a href="#v:enumFromThen" class="selflink">#</a></p><p class="src"><a href="#v:enumFromTo">enumFromTo</a> :: <a href="Utils.html#t:Natural" title="Utils">Natural</a> n m -&gt; <a href="Utils.html#t:Natural" title="Utils">Natural</a> n m -&gt; [<a href="Utils.html#t:Natural" title="Utils">Natural</a> n m] <a href="#v:enumFromTo" class="selflink">#</a></p><p class="src"><a href="#v:enumFromThenTo">enumFromThenTo</a> :: <a href="Utils.html#t:Natural" title="Utils">Natural</a> n m -&gt; <a href="Utils.html#t:Natural" title="Utils">Natural</a> n m -&gt; <a href="Utils.html#t:Natural" title="Utils">Natural</a> n m -&gt; [<a href="Utils.html#t:Natural" title="Utils">Natural</a> n m] <a href="#v:enumFromThenTo" class="selflink">#</a></p></div></details></td></tr><tr><td class="src clearfix"><span class="inst-left"><span class="instance details-toggle-control details-toggle" data-details-id="i:id:Natural:Eq:3"></span> <a href="/package/base-4.12.0.0/docs/Data-Eq.html#t:Eq" title="Data.Eq">Eq</a> (<a href="Utils.html#t:Natural" title="Utils">Natural</a> start end)</span> <a href="src/Utils.Internal.html#line-101" class="link">Source</a> <a href="#t:Natural" class="selflink">#</a></td><td class="doc empty">&nbsp;</td></tr><tr><td colspan="2"><details id="i:id:Natural:Eq:3"><summary class="hide-when-js-enabled">Instance details</summary><p>Defined in <a href="Utils-Internal.html">Utils.Internal</a></p> <div class="subs methods"><p class="caption">Methods</p><p class="src"><a href="#v:-61--61-">(==)</a> :: <a href="Utils.html#t:Natural" title="Utils">Natural</a> start end -&gt; <a href="Utils.html#t:Natural" title="Utils">Natural</a> start end -&gt; <a href="/package/base-4.12.0.0/docs/Data-Bool.html#t:Bool" title="Data.Bool">Bool</a> <a href="#v:-61--61-" class="selflink">#</a></p><p class="src"><a href="#v:-47--61-">(/=)</a> :: <a href="Utils.html#t:Natural" title="Utils">Natural</a> start end -&gt; <a href="Utils.html#t:Natural" title="Utils">Natural</a> start end -&gt; <a href="/package/base-4.12.0.0/docs/Data-Bool.html#t:Bool" title="Data.Bool">Bool</a> <a href="#v:-47--61-" class="selflink">#</a></p></div></details></td></tr><tr><td class="src clearfix"><span class="inst-left"><span class="instance details-toggle-control details-toggle" data-details-id="i:id:Natural:Num:4"></span> (<a href="/package/base-4.12.0.0/docs/GHC-TypeNats.html#t:KnownNat" title="GHC.TypeNats">KnownNat</a> n, <a href="/package/base-4.12.0.0/docs/GHC-TypeNats.html#t:KnownNat" title="GHC.TypeNats">KnownNat</a> m) =&gt; <a href="/package/base-4.12.0.0/docs/Prelude.html#t:Num" title="Prelude">Num</a> (<a href="Utils.html#t:Natural" title="Utils">Natural</a> n m)</span> <a href="src/Utils.Internal.html#line-105" class="link">Source</a> <a href="#t:Natural" class="selflink">#</a></td><td class="doc"><p>Throws a runtime error if any of the operations overflows or
48+ underflows.</p></td></tr><tr><td colspan="2"><details id="i:id:Natural:Num:4"><summary class="hide-when-js-enabled">Instance details</summary><p>Defined in <a href="Utils-Internal.html">Utils.Internal</a></p> <div class="subs methods"><p class="caption">Methods</p><p class="src"><a href="#v:-43-">(+)</a> :: <a href="Utils.html#t:Natural" title="Utils">Natural</a> n m -&gt; <a href="Utils.html#t:Natural" title="Utils">Natural</a> n m -&gt; <a href="Utils.html#t:Natural" title="Utils">Natural</a> n m <a href="#v:-43-" class="selflink">#</a></p><p class="src"><a href="#v:-45-">(-)</a> :: <a href="Utils.html#t:Natural" title="Utils">Natural</a> n m -&gt; <a href="Utils.html#t:Natural" title="Utils">Natural</a> n m -&gt; <a href="Utils.html#t:Natural" title="Utils">Natural</a> n m <a href="#v:-45-" class="selflink">#</a></p><p class="src"><a href="#v:-42-">(*)</a> :: <a href="Utils.html#t:Natural" title="Utils">Natural</a> n m -&gt; <a href="Utils.html#t:Natural" title="Utils">Natural</a> n m -&gt; <a href="Utils.html#t:Natural" title="Utils">Natural</a> n m <a href="#v:-42-" class="selflink">#</a></p><p class="src"><a href="#v:negate">negate</a> :: <a href="Utils.html#t:Natural" title="Utils">Natural</a> n m -&gt; <a href="Utils.html#t:Natural" title="Utils">Natural</a> n m <a href="#v:negate" class="selflink">#</a></p><p class="src"><a href="#v:abs">abs</a> :: <a href="Utils.html#t:Natural" title="Utils">Natural</a> n m -&gt; <a href="Utils.html#t:Natural" title="Utils">Natural</a> n m <a href="#v:abs" class="selflink">#</a></p><p class="src"><a href="#v:signum">signum</a> :: <a href="Utils.html#t:Natural" title="Utils">Natural</a> n m -&gt; <a href="Utils.html#t:Natural" title="Utils">Natural</a> n m <a href="#v:signum" class="selflink">#</a></p><p class="src"><a href="#v:fromInteger">fromInteger</a> :: <a href="/package/base-4.12.0.0/docs/Prelude.html#t:Integer" title="Prelude">Integer</a> -&gt; <a href="Utils.html#t:Natural" title="Utils">Natural</a> n m <a href="#v:fromInteger" class="selflink">#</a></p></div></details></td></tr><tr><td class="src clearfix"><span class="inst-left"><span class="instance details-toggle-control details-toggle" data-details-id="i:id:Natural:Ord:5"></span> <a href="/package/base-4.12.0.0/docs/Data-Ord.html#t:Ord" title="Data.Ord">Ord</a> (<a href="Utils.html#t:Natural" title="Utils">Natural</a> start end)</span> <a href="src/Utils.Internal.html#line-101" class="link">Source</a> <a href="#t:Natural" class="selflink">#</a></td><td class="doc empty">&nbsp;</td></tr><tr><td colspan="2"><details id="i:id:Natural:Ord:5"><summary class="hide-when-js-enabled">Instance details</summary><p>Defined in <a href="Utils-Internal.html">Utils.Internal</a></p> <div class="subs methods"><p class="caption">Methods</p><p class="src"><a href="#v:compare">compare</a> :: <a href="Utils.html#t:Natural" title="Utils">Natural</a> start end -&gt; <a href="Utils.html#t:Natural" title="Utils">Natural</a> start end -&gt; <a href="/package/base-4.12.0.0/docs/Data-Ord.html#t:Ordering" title="Data.Ord">Ordering</a> <a href="#v:compare" class="selflink">#</a></p><p class="src"><a href="#v:-60-">(&lt;)</a> :: <a href="Utils.html#t:Natural" title="Utils">Natural</a> start end -&gt; <a href="Utils.html#t:Natural" title="Utils">Natural</a> start end -&gt; <a href="/package/base-4.12.0.0/docs/Data-Bool.html#t:Bool" title="Data.Bool">Bool</a> <a href="#v:-60-" class="selflink">#</a></p><p class="src"><a href="#v:-60--61-">(&lt;=)</a> :: <a href="Utils.html#t:Natural" title="Utils">Natural</a> start end -&gt; <a href="Utils.html#t:Natural" title="Utils">Natural</a> start end -&gt; <a href="/package/base-4.12.0.0/docs/Data-Bool.html#t:Bool" title="Data.Bool">Bool</a> <a href="#v:-60--61-" class="selflink">#</a></p><p class="src"><a href="#v:-62-">(&gt;)</a> :: <a href="Utils.html#t:Natural" title="Utils">Natural</a> start end -&gt; <a href="Utils.html#t:Natural" title="Utils">Natural</a> start end -&gt; <a href="/package/base-4.12.0.0/docs/Data-Bool.html#t:Bool" title="Data.Bool">Bool</a> <a href="#v:-62-" class="selflink">#</a></p><p class="src"><a href="#v:-62--61-">(&gt;=)</a> :: <a href="Utils.html#t:Natural" title="Utils">Natural</a> start end -&gt; <a href="Utils.html#t:Natural" title="Utils">Natural</a> start end -&gt; <a href="/package/base-4.12.0.0/docs/Data-Bool.html#t:Bool" title="Data.Bool">Bool</a> <a href="#v:-62--61-" class="selflink">#</a></p><p class="src"><a href="#v:max">max</a> :: <a href="Utils.html#t:Natural" title="Utils">Natural</a> start end -&gt; <a href="Utils.html#t:Natural" title="Utils">Natural</a> start end -&gt; <a href="Utils.html#t:Natural" title="Utils">Natural</a> start end <a href="#v:max" class="selflink">#</a></p><p class="src"><a href="#v:min">min</a> :: <a href="Utils.html#t:Natural" title="Utils">Natural</a> start end -&gt; <a href="Utils.html#t:Natural" title="Utils">Natural</a> start end -&gt; <a href="Utils.html#t:Natural" title="Utils">Natural</a> start end <a href="#v:min" class="selflink">#</a></p></div></details></td></tr><tr><td class="src clearfix"><span class="inst-left"><span class="instance details-toggle-control details-toggle" data-details-id="i:id:Natural:Read:6"></span> <a href="/package/base-4.12.0.0/docs/Text-Read.html#t:Read" title="Text.Read">Read</a> (<a href="Utils.html#t:Natural" title="Utils">Natural</a> start end)</span> <a href="src/Utils.Internal.html#line-101" class="link">Source</a> <a href="#t:Natural" class="selflink">#</a></td><td class="doc empty">&nbsp;</td></tr><tr><td colspan="2"><details id="i:id:Natural:Read:6"><summary class="hide-when-js-enabled">Instance details</summary><p>Defined in <a href="Utils-Internal.html">Utils.Internal</a></p> <div class="subs methods"><p class="caption">Methods</p><p class="src"><a href="#v:readsPrec">readsPrec</a> :: <a href="/package/base-4.12.0.0/docs/Data-Int.html#t:Int" title="Data.Int">Int</a> -&gt; <a href="/package/base-4.12.0.0/docs/Text-ParserCombinators-ReadP.html#t:ReadS" title="Text.ParserCombinators.ReadP">ReadS</a> (<a href="Utils.html#t:Natural" title="Utils">Natural</a> start end) <a href="#v:readsPrec" class="selflink">#</a></p><p class="src"><a href="#v:readList">readList</a> :: <a href="/package/base-4.12.0.0/docs/Text-ParserCombinators-ReadP.html#t:ReadS" title="Text.ParserCombinators.ReadP">ReadS</a> [<a href="Utils.html#t:Natural" title="Utils">Natural</a> start end] <a href="#v:readList" class="selflink">#</a></p><p class="src"><a href="#v:readPrec">readPrec</a> :: <a href="/package/base-4.12.0.0/docs/Text-ParserCombinators-ReadPrec.html#t:ReadPrec" title="Text.ParserCombinators.ReadPrec">ReadPrec</a> (<a href="Utils.html#t:Natural" title="Utils">Natural</a> start end) <a href="#v:readPrec" class="selflink">#</a></p><p class="src"><a href="#v:readListPrec">readListPrec</a> :: <a href="/package/base-4.12.0.0/docs/Text-ParserCombinators-ReadPrec.html#t:ReadPrec" title="Text.ParserCombinators.ReadPrec">ReadPrec</a> [<a href="Utils.html#t:Natural" title="Utils">Natural</a> start end] <a href="#v:readListPrec" class="selflink">#</a></p></div></details></td></tr><tr><td class="src clearfix"><span class="inst-left"><span class="instance details-toggle-control details-toggle" data-details-id="i:id:Natural:Show:7"></span> <a href="/package/base-4.12.0.0/docs/Text-Show.html#t:Show" title="Text.Show">Show</a> (<a href="Utils.html#t:Natural" title="Utils">Natural</a> start end)</span> <a href="src/Utils.Internal.html#line-101" class="link">Source</a> <a href="#t:Natural" class="selflink">#</a></td><td class="doc empty">&nbsp;</td></tr><tr><td colspan="2"><details id="i:id:Natural:Show:7"><summary class="hide-when-js-enabled">Instance details</summary><p>Defined in <a href="Utils-Internal.html">Utils.Internal</a></p> <div class="subs methods"><p class="caption">Methods</p><p class="src"><a href="#v:showsPrec">showsPrec</a> :: <a href="/package/base-4.12.0.0/docs/Data-Int.html#t:Int" title="Data.Int">Int</a> -&gt; <a href="Utils.html#t:Natural" title="Utils">Natural</a> start end -&gt; <a href="/package/base-4.12.0.0/docs/Text-Show.html#t:ShowS" title="Text.Show">ShowS</a> <a href="#v:showsPrec" class="selflink">#</a></p><p class="src"><a href="#v:show">show</a> :: <a href="Utils.html#t:Natural" title="Utils">Natural</a> start end -&gt; <a href="/package/base-4.12.0.0/docs/Data-String.html#t:String" title="Data.String">String</a> <a href="#v:show" class="selflink">#</a></p><p class="src"><a href="#v:showList">showList</a> :: [<a href="Utils.html#t:Natural" title="Utils">Natural</a> start end] -&gt; <a href="/package/base-4.12.0.0/docs/Text-Show.html#t:ShowS" title="Text.Show">ShowS</a> <a href="#v:showList" class="selflink">#</a></p></div></details></td></tr><tr><td class="src clearfix"><span class="inst-left"><span class="instance details-toggle-control details-toggle" data-details-id="i:id:Natural:NFData:8"></span> <a href="/package/deepseq-1.4.4.0/docs/Control-DeepSeq.html#t:NFData" title="Control.DeepSeq">NFData</a> (<a href="Utils.html#t:Natural" title="Utils">Natural</a> start end)</span> <a href="src/Utils.Internal.html#line-101" class="link">Source</a> <a href="#t:Natural" class="selflink">#</a></td><td class="doc empty">&nbsp;</td></tr><tr><td colspan="2"><details id="i:id:Natural:NFData:8"><summary class="hide-when-js-enabled">Instance details</summary><p>Defined in <a href="Utils-Internal.html">Utils.Internal</a></p> <div class="subs methods"><p class="caption">Methods</p><p class="src"><a href="#v:rnf">rnf</a> :: <a href="Utils.html#t:Natural" title="Utils">Natural</a> start end -&gt; () <a href="#v:rnf" class="selflink">#</a></p></div></details></td></tr></table></details></div></div><div class="top"><p class="src"><a id="v:nat" class="def">nat</a> :: <span class="keyword">forall</span> n m. (<a href="/package/base-4.12.0.0/docs/GHC-TypeNats.html#t:KnownNat" title="GHC.TypeNats">KnownNat</a> n, <a href="/package/base-4.12.0.0/docs/GHC-TypeNats.html#t:KnownNat" title="GHC.TypeNats">KnownNat</a> m) =&gt; <a href="/package/base-4.12.0.0/docs/Data-Int.html#t:Int" title="Data.Int">Int</a> -&gt; <a href="Utils.html#t:Natural" title="Utils">Natural</a> n m <a href="src/Utils.Internal.html#nat" class="link">Source</a> <a href="#v:nat" class="selflink">#</a></p><div class="doc"><p>Natural constructor function. Throws a runtime error if the <code><a href="/package/base-4.12.0.0/docs/Data-Int.html#t:Int" title="Data.Int">Int</a></code>
49+ value is greater than the corresponding <code>m</code> or lower than <code>n</code> in the <code><code><a href="Utils.html#t:Natural" title="Utils">Natural</a></code> n m</code> type.</p></div></div><a href="#g:1" id="g:1"><h1>Coerce auxiliar functions to help promote <code><a href="/package/base-4.12.0.0/docs/Data-Int.html#t:Int" title="Data.Int">Int</a></code> typed functions to</h1></a><div class="top"><p class="src"><a id="v:coerceNat" class="def">coerceNat</a> :: (<a href="/package/base-4.12.0.0/docs/Data-Int.html#t:Int" title="Data.Int">Int</a> -&gt; <a href="/package/base-4.12.0.0/docs/Data-Int.html#t:Int" title="Data.Int">Int</a> -&gt; <a href="/package/base-4.12.0.0/docs/Data-Int.html#t:Int" title="Data.Int">Int</a>) -&gt; <a href="Utils.html#t:Natural" title="Utils">Natural</a> a a' -&gt; <a href="Utils.html#t:Natural" title="Utils">Natural</a> b b' -&gt; <a href="Utils.html#t:Natural" title="Utils">Natural</a> c c' <a href="src/Utils.Internal.html#coerceNat" class="link">Source</a> <a href="#v:coerceNat" class="selflink">#</a></p><div class="doc"><p>Auxiliary function that promotes binary <code><a href="/package/base-4.12.0.0/docs/Data-Int.html#t:Int" title="Data.Int">Int</a></code> functions to <code><a href="Utils.html#t:Natural" title="Utils">Natural</a></code>
50+ binary functions.</p></div></div><div class="top"><p class="src"><a id="v:coerceNat2" class="def">coerceNat2</a> :: ((<a href="/package/base-4.12.0.0/docs/Data-Int.html#t:Int" title="Data.Int">Int</a>, <a href="/package/base-4.12.0.0/docs/Data-Int.html#t:Int" title="Data.Int">Int</a>) -&gt; <a href="/package/base-4.12.0.0/docs/Data-Int.html#t:Int" title="Data.Int">Int</a> -&gt; <a href="/package/base-4.12.0.0/docs/Data-Int.html#t:Int" title="Data.Int">Int</a>) -&gt; (<a href="Utils.html#t:Natural" title="Utils">Natural</a> a a', <a href="Utils.html#t:Natural" title="Utils">Natural</a> b b') -&gt; <a href="Utils.html#t:Natural" title="Utils">Natural</a> c c' -&gt; <a href="Utils.html#t:Natural" title="Utils">Natural</a> d d' <a href="src/Utils.Internal.html#coerceNat2" class="link">Source</a> <a href="#v:coerceNat2" class="selflink">#</a></p><div class="doc"><p>Auxiliary function that promotes ternary (binary) <code><a href="/package/base-4.12.0.0/docs/Data-Int.html#t:Int" title="Data.Int">Int</a></code> functions to <code><a href="Utils.html#t:Natural" title="Utils">Natural</a></code>
51+ functions.</p></div></div><div class="top"><p class="src"><a id="v:coerceNat3" class="def">coerceNat3</a> :: (<a href="/package/base-4.12.0.0/docs/Data-Int.html#t:Int" title="Data.Int">Int</a> -&gt; <a href="/package/base-4.12.0.0/docs/Data-Int.html#t:Int" title="Data.Int">Int</a> -&gt; a) -&gt; <a href="Utils.html#t:Natural" title="Utils">Natural</a> b b' -&gt; <a href="Utils.html#t:Natural" title="Utils">Natural</a> c c' -&gt; a <a href="src/Utils.Internal.html#coerceNat3" class="link">Source</a> <a href="#v:coerceNat3" class="selflink">#</a></p><div class="doc"><p>Auxiliary function that promotes ternary (binary) <code><a href="/package/base-4.12.0.0/docs/Data-Int.html#t:Int" title="Data.Int">Int</a></code> functions to <code><a href="Utils.html#t:Natural" title="Utils">Natural</a></code>
52+ functions.</p></div></div></div></div><div id="footer"><p>Produced by <a href="http://www.haskell.org/haddock/">Haddock</a> version 2.22.0</p></div></body></html>
build/x86_64-linux/ghc-8.6.5/laop-0.1.0.0/doc/html/laop-0.1.0.0-docs/doc-index.htmlnew file+1
@@ -0,0 +1 @@
1+<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"><html xmlns="http://www.w3.org/1999/xhtml"><head><meta http-equiv="Content-Type" content="text/html; charset=UTF-8" /><title>laop-0.1.0.0: An inductive matrix definition library &#224; la LAoP (Index)</title><link href="ocean.css" rel="stylesheet" type="text/css" title="Ocean" /><link rel="stylesheet" type="text/css" href="quick-jump.css" /><script src="haddock-bundle.min.js" async="async" type="text/javascript"></script><script src="https://cdnjs.cloudflare.com/ajax/libs/mathjax/2.7.0/MathJax.js?config=TeX-AMS-MML_HTMLorMML" type="text/javascript"></script></head><body><div id="package-header"><ul class="links" id="page-menu"><li><a href="/package/laop-0.1.0.0">Contents</a></li><li><a href="doc-index.html">Index</a></li></ul><p class="caption">laop-0.1.0.0: An inductive matrix definition library &#224; la LAoP</p></div><div id="content"><div id="index"><p class="caption">Index</p><table><tr><td class="src">-|-</td><td>&nbsp;</td></tr><tr><td class="alt">1 (Function)</td><td class="module"><a href="Matrix-Type.html#v:-45--124--45-" title="Matrix.Type">Matrix.Type</a></td></tr><tr><td class="alt">2 (Function)</td><td class="module"><a href="Matrix-Nat.html#v:-45--124--45-" title="Matrix.Nat">Matrix.Nat</a></td></tr><tr><td class="src">===</td><td>&nbsp;</td></tr><tr><td class="alt">1 (Function)</td><td class="module"><a href="Matrix-Type.html#v:-61--61--61-" title="Matrix.Type">Matrix.Type</a></td></tr><tr><td class="alt">2 (Function)</td><td class="module"><a href="Matrix-Nat.html#v:-61--61--61-" title="Matrix.Nat">Matrix.Nat</a></td></tr><tr><td class="src">&gt;&lt;</td><td>&nbsp;</td></tr><tr><td class="alt">1 (Function)</td><td class="module"><a href="Matrix-Type.html#v:-62--60-" title="Matrix.Type">Matrix.Type</a></td></tr><tr><td class="alt">2 (Function)</td><td class="module"><a href="Matrix-Nat.html#v:-62--60-" title="Matrix.Nat">Matrix.Nat</a></td></tr><tr><td class="src">abideJS</td><td>&nbsp;</td></tr><tr><td class="alt">1 (Function)</td><td class="module"><a href="Matrix-Type.html#v:abideJS" title="Matrix.Type">Matrix.Type</a></td></tr><tr><td class="alt">2 (Function)</td><td class="module"><a href="Matrix-Nat.html#v:abideJS" title="Matrix.Nat">Matrix.Nat</a></td></tr><tr><td class="src">abideSJ</td><td>&nbsp;</td></tr><tr><td class="alt">1 (Function)</td><td class="module"><a href="Matrix-Type.html#v:abideSJ" title="Matrix.Type">Matrix.Type</a></td></tr><tr><td class="alt">2 (Function)</td><td class="module"><a href="Matrix-Nat.html#v:abideSJ" title="Matrix.Nat">Matrix.Nat</a></td></tr><tr><td class="src">bang</td><td>&nbsp;</td></tr><tr><td class="alt">1 (Function)</td><td class="module"><a href="Matrix-Type.html#v:bang" title="Matrix.Type">Matrix.Type</a></td></tr><tr><td class="alt">2 (Function)</td><td class="module"><a href="Matrix-Nat.html#v:bang" title="Matrix.Nat">Matrix.Nat</a></td></tr><tr><td class="src">bindD</td><td class="module"><a href="Dist.html#v:bindD" title="Dist">Dist</a></td></tr><tr><td class="src">bindM</td><td class="module"><a href="Matrix-Type.html#v:bindM" title="Matrix.Type">Matrix.Type</a></td></tr><tr><td class="src">choose</td><td class="module"><a href="Dist.html#v:choose" title="Dist">Dist</a></td></tr><tr><td class="src">coerceNat</td><td class="module"><a href="Utils.html#v:coerceNat" title="Utils">Utils</a></td></tr><tr><td class="src">coerceNat2</td><td class="module"><a href="Utils.html#v:coerceNat2" title="Utils">Utils</a></td></tr><tr><td class="src">coerceNat3</td><td class="module"><a href="Utils.html#v:coerceNat3" title="Utils">Utils</a></td></tr><tr><td class="src">col</td><td>&nbsp;</td></tr><tr><td class="alt">1 (Function)</td><td class="module"><a href="Matrix-Type.html#v:col" title="Matrix.Type">Matrix.Type</a></td></tr><tr><td class="alt">2 (Function)</td><td class="module"><a href="Matrix-Nat.html#v:col" title="Matrix.Nat">Matrix.Nat</a></td></tr><tr><td class="src">columns</td><td>&nbsp;</td></tr><tr><td class="alt">1 (Function)</td><td class="module"><a href="Matrix-Type.html#v:columns" title="Matrix.Type">Matrix.Type</a></td></tr><tr><td class="alt">2 (Function)</td><td class="module"><a href="Matrix-Nat.html#v:columns" title="Matrix.Nat">Matrix.Nat</a></td></tr><tr><td class="src">comp</td><td>&nbsp;</td></tr><tr><td class="alt">1 (Function)</td><td class="module"><a href="Matrix-Type.html#v:comp" title="Matrix.Type">Matrix.Type</a></td></tr><tr><td class="alt">2 (Function)</td><td class="module"><a href="Matrix-Nat.html#v:comp" title="Matrix.Nat">Matrix.Nat</a></td></tr><tr><td class="src">cond</td><td>&nbsp;</td></tr><tr><td class="alt">1 (Function)</td><td class="module"><a href="Matrix-Type.html#v:cond" title="Matrix.Type">Matrix.Type</a></td></tr><tr><td class="alt">2 (Function)</td><td class="module"><a href="Matrix-Nat.html#v:cond" title="Matrix.Nat">Matrix.Nat</a></td></tr><tr><td class="src">constant</td><td>&nbsp;</td></tr><tr><td class="alt">1 (Function)</td><td class="module"><a href="Matrix-Type.html#v:constant" title="Matrix.Type">Matrix.Type</a></td></tr><tr><td class="alt">2 (Function)</td><td class="module"><a href="Matrix-Nat.html#v:constant" title="Matrix.Nat">Matrix.Nat</a></td></tr><tr><td class="src">Count</td><td class="module"><a href="Matrix-Type.html#t:Count" title="Matrix.Type">Matrix.Type</a>, <a href="Matrix-Nat.html#t:Count" title="Matrix.Nat">Matrix.Nat</a></td></tr><tr><td class="src">D</td><td class="module"><a href="Dist.html#v:D" title="Dist">Dist</a></td></tr><tr><td class="src">Dist</td><td class="module"><a href="Dist.html#t:Dist" title="Dist">Dist</a></td></tr><tr><td class="src">empty</td><td>&nbsp;</td></tr><tr><td class="alt">1 (Function)</td><td class="module"><a href="Matrix-Type.html#v:empty" title="Matrix.Type">Matrix.Type</a></td></tr><tr><td class="alt">2 (Function)</td><td class="module"><a href="Matrix-Nat.html#v:empty" title="Matrix.Nat">Matrix.Nat</a></td></tr><tr><td class="src">fmapD</td><td class="module"><a href="Dist.html#v:fmapD" title="Dist">Dist</a></td></tr><tr><td class="src">fmapM</td><td class="module"><a href="Matrix-Type.html#v:fmapM" title="Matrix.Type">Matrix.Type</a></td></tr><tr><td class="src">fromF</td><td>&nbsp;</td></tr><tr><td class="alt">1 (Function)</td><td class="module"><a href="Matrix-Type.html#v:fromF" title="Matrix.Type">Matrix.Type</a></td></tr><tr><td class="alt">2 (Function)</td><td class="module"><a href="Matrix-Nat.html#v:fromF" title="Matrix.Nat">Matrix.Nat</a></td></tr><tr><td class="src">fromF'</td><td>&nbsp;</td></tr><tr><td class="alt">1 (Function)</td><td class="module"><a href="Matrix-Type.html#v:fromF-39-" title="Matrix.Type">Matrix.Type</a></td></tr><tr><td class="alt">2 (Function)</td><td class="module"><a href="Matrix-Nat.html#v:fromF-39-" title="Matrix.Nat">Matrix.Nat</a></td></tr><tr><td class="src">FromLists</td><td class="module"><a href="Matrix-Type.html#t:FromLists" title="Matrix.Type">Matrix.Type</a>, <a href="Matrix-Nat.html#t:FromLists" title="Matrix.Nat">Matrix.Nat</a></td></tr><tr><td class="src">fromLists</td><td>&nbsp;</td></tr><tr><td class="alt">1 (Function)</td><td class="module"><a href="Matrix-Type.html#v:fromLists" title="Matrix.Type">Matrix.Type</a></td></tr><tr><td class="alt">2 (Function)</td><td class="module"><a href="Matrix-Nat.html#v:fromLists" title="Matrix.Nat">Matrix.Nat</a></td></tr><tr><td class="src">FromNat</td><td class="module"><a href="Matrix-Type.html#t:FromNat" title="Matrix.Type">Matrix.Type</a>, <a href="Matrix-Nat.html#t:FromNat" title="Matrix.Nat">Matrix.Nat</a></td></tr><tr><td class="src">i1</td><td>&nbsp;</td></tr><tr><td class="alt">1 (Function)</td><td class="module"><a href="Matrix-Type.html#v:i1" title="Matrix.Type">Matrix.Type</a></td></tr><tr><td class="alt">2 (Function)</td><td class="module"><a href="Matrix-Nat.html#v:i1" title="Matrix.Nat">Matrix.Nat</a></td></tr><tr><td class="src">i2</td><td>&nbsp;</td></tr><tr><td class="alt">1 (Function)</td><td class="module"><a href="Matrix-Type.html#v:i2" title="Matrix.Type">Matrix.Type</a></td></tr><tr><td class="alt">2 (Function)</td><td class="module"><a href="Matrix-Nat.html#v:i2" title="Matrix.Nat">Matrix.Nat</a></td></tr><tr><td class="src">identity</td><td>&nbsp;</td></tr><tr><td class="alt">1 (Function)</td><td class="module"><a href="Matrix-Type.html#v:identity" title="Matrix.Type">Matrix.Type</a></td></tr><tr><td class="alt">2 (Function)</td><td class="module"><a href="Matrix-Nat.html#v:identity" title="Matrix.Nat">Matrix.Nat</a></td></tr><tr><td class="src">junc</td><td>&nbsp;</td></tr><tr><td class="alt">1 (Function)</td><td class="module"><a href="Matrix-Type.html#v:junc" title="Matrix.Type">Matrix.Type</a></td></tr><tr><td class="alt">2 (Function)</td><td class="module"><a href="Matrix-Nat.html#v:junc" title="Matrix.Nat">Matrix.Nat</a></td></tr><tr><td class="src">khatri</td><td>&nbsp;</td></tr><tr><td class="alt">1 (Function)</td><td class="module"><a href="Matrix-Type.html#v:khatri" title="Matrix.Type">Matrix.Type</a></td></tr><tr><td class="alt">2 (Function)</td><td class="module"><a href="Matrix-Nat.html#v:khatri" title="Matrix.Nat">Matrix.Nat</a></td></tr><tr><td class="src">kp1</td><td>&nbsp;</td></tr><tr><td class="alt">1 (Function)</td><td class="module"><a href="Matrix-Type.html#v:kp1" title="Matrix.Type">Matrix.Type</a></td></tr><tr><td class="alt">2 (Function)</td><td class="module"><a href="Matrix-Nat.html#v:kp1" title="Matrix.Nat">Matrix.Nat</a></td></tr><tr><td class="src">kp2</td><td>&nbsp;</td></tr><tr><td class="alt">1 (Function)</td><td class="module"><a href="Matrix-Type.html#v:kp2" title="Matrix.Type">Matrix.Type</a></td></tr><tr><td class="alt">2 (Function)</td><td class="module"><a href="Matrix-Nat.html#v:kp2" title="Matrix.Nat">Matrix.Nat</a></td></tr><tr><td class="src">linear</td><td class="module"><a href="Dist.html#v:linear" title="Dist">Dist</a></td></tr><tr><td class="src">M</td><td>&nbsp;</td></tr><tr><td class="alt">1 (Data Constructor)</td><td class="module"><a href="Matrix-Type.html#v:M" title="Matrix.Type">Matrix.Type</a></td></tr><tr><td class="alt">2 (Data Constructor)</td><td class="module"><a href="Matrix-Nat.html#v:M" title="Matrix.Nat">Matrix.Nat</a></td></tr><tr><td class="src">Matrix</td><td>&nbsp;</td></tr><tr><td class="alt">1 (Type/Class)</td><td class="module"><a href="Matrix-Type.html#t:Matrix" title="Matrix.Type">Matrix.Type</a></td></tr><tr><td class="alt">2 (Type/Class)</td><td class="module"><a href="Matrix-Nat.html#t:Matrix" title="Matrix.Nat">Matrix.Nat</a></td></tr><tr><td class="src">matrixBuilder</td><td>&nbsp;</td></tr><tr><td class="alt">1 (Function)</td><td class="module"><a href="Matrix-Type.html#v:matrixBuilder" title="Matrix.Type">Matrix.Type</a></td></tr><tr><td class="alt">2 (Function)</td><td class="module"><a href="Matrix-Nat.html#v:matrixBuilder" title="Matrix.Nat">Matrix.Nat</a></td></tr><tr><td class="src">multD</td><td class="module"><a href="Dist.html#v:multD" title="Dist">Dist</a></td></tr><tr><td class="src">multM</td><td class="module"><a href="Matrix-Type.html#v:multM" title="Matrix.Type">Matrix.Type</a></td></tr><tr><td class="src">nat</td><td class="module"><a href="Utils.html#v:nat" title="Utils">Utils</a></td></tr><tr><td class="src">Natural</td><td class="module"><a href="Utils.html#t:Natural" title="Utils">Utils</a></td></tr><tr><td class="src">negExp</td><td class="module"><a href="Dist.html#v:negExp" title="Dist">Dist</a></td></tr><tr><td class="src">normal</td><td class="module"><a href="Dist.html#v:normal" title="Dist">Dist</a></td></tr><tr><td class="src">Normalize</td><td class="module"><a href="Matrix-Type.html#t:Normalize" title="Matrix.Type">Matrix.Type</a>, <a href="Matrix-Nat.html#t:Normalize" title="Matrix.Nat">Matrix.Nat</a></td></tr><tr><td class="src">One</td><td class="module"><a href="Matrix-Type.html#t:One" title="Matrix.Type">Matrix.Type</a></td></tr><tr><td class="src">one</td><td>&nbsp;</td></tr><tr><td class="alt">1 (Function)</td><td class="module"><a href="Matrix-Type.html#v:one" title="Matrix.Type">Matrix.Type</a></td></tr><tr><td class="alt">2 (Function)</td><td class="module"><a href="Matrix-Nat.html#v:one" title="Matrix.Nat">Matrix.Nat</a></td></tr><tr><td class="src">ones</td><td>&nbsp;</td></tr><tr><td class="alt">1 (Function)</td><td class="module"><a href="Matrix-Type.html#v:ones" title="Matrix.Type">Matrix.Type</a></td></tr><tr><td class="alt">2 (Function)</td><td class="module"><a href="Matrix-Nat.html#v:ones" title="Matrix.Nat">Matrix.Nat</a></td></tr><tr><td class="src">p1</td><td>&nbsp;</td></tr><tr><td class="alt">1 (Function)</td><td class="module"><a href="Matrix-Type.html#v:p1" title="Matrix.Type">Matrix.Type</a></td></tr><tr><td class="alt">2 (Function)</td><td class="module"><a href="Matrix-Nat.html#v:p1" title="Matrix.Nat">Matrix.Nat</a></td></tr><tr><td class="src">p2</td><td>&nbsp;</td></tr><tr><td class="alt">1 (Function)</td><td class="module"><a href="Matrix-Type.html#v:p2" title="Matrix.Type">Matrix.Type</a></td></tr><tr><td class="alt">2 (Function)</td><td class="module"><a href="Matrix-Nat.html#v:p2" title="Matrix.Nat">Matrix.Nat</a></td></tr><tr><td class="src">pretty</td><td>&nbsp;</td></tr><tr><td class="alt">1 (Function)</td><td class="module"><a href="Matrix-Type.html#v:pretty" title="Matrix.Type">Matrix.Type</a></td></tr><tr><td class="alt">2 (Function)</td><td class="module"><a href="Matrix-Nat.html#v:pretty" title="Matrix.Nat">Matrix.Nat</a></td></tr><tr><td class="src">prettyDist</td><td class="module"><a href="Dist.html#v:prettyDist" title="Dist">Dist</a></td></tr><tr><td class="src">prettyPrint</td><td>&nbsp;</td></tr><tr><td class="alt">1 (Function)</td><td class="module"><a href="Matrix-Type.html#v:prettyPrint" title="Matrix.Type">Matrix.Type</a></td></tr><tr><td class="alt">2 (Function)</td><td class="module"><a href="Matrix-Nat.html#v:prettyPrint" title="Matrix.Nat">Matrix.Nat</a></td></tr><tr><td class="src">prettyPrintDist</td><td class="module"><a href="Dist.html#v:prettyPrintDist" title="Dist">Dist</a></td></tr><tr><td class="src">Prob</td><td class="module"><a href="Dist.html#t:Prob" title="Dist">Dist</a></td></tr><tr><td class="src">returnD</td><td class="module"><a href="Dist.html#v:returnD" title="Dist">Dist</a></td></tr><tr><td class="src">returnM</td><td class="module"><a href="Matrix-Type.html#v:returnM" title="Matrix.Type">Matrix.Type</a></td></tr><tr><td class="src">row</td><td>&nbsp;</td></tr><tr><td class="alt">1 (Function)</td><td class="module"><a href="Matrix-Type.html#v:row" title="Matrix.Type">Matrix.Type</a></td></tr><tr><td class="alt">2 (Function)</td><td class="module"><a href="Matrix-Nat.html#v:row" title="Matrix.Nat">Matrix.Nat</a></td></tr><tr><td class="src">rows</td><td>&nbsp;</td></tr><tr><td class="alt">1 (Function)</td><td class="module"><a href="Matrix-Type.html#v:rows" title="Matrix.Type">Matrix.Type</a></td></tr><tr><td class="alt">2 (Function)</td><td class="module"><a href="Matrix-Nat.html#v:rows" title="Matrix.Nat">Matrix.Nat</a></td></tr><tr><td class="src">select</td><td class="module"><a href="Matrix-Nat.html#v:select" title="Matrix.Nat">Matrix.Nat</a></td></tr><tr><td class="src">selectD</td><td class="module"><a href="Dist.html#v:selectD" title="Dist">Dist</a></td></tr><tr><td class="src">selectM</td><td class="module"><a href="Matrix-Type.html#v:selectM" title="Matrix.Type">Matrix.Type</a></td></tr><tr><td class="src">shape</td><td class="module"><a href="Dist.html#v:shape" title="Dist">Dist</a></td></tr><tr><td class="src">split</td><td>&nbsp;</td></tr><tr><td class="alt">1 (Function)</td><td class="module"><a href="Matrix-Type.html#v:split" title="Matrix.Type">Matrix.Type</a></td></tr><tr><td class="alt">2 (Function)</td><td class="module"><a href="Matrix-Nat.html#v:split" title="Matrix.Nat">Matrix.Nat</a></td></tr><tr><td class="src">toList</td><td>&nbsp;</td></tr><tr><td class="alt">1 (Function)</td><td class="module"><a href="Matrix-Type.html#v:toList" title="Matrix.Type">Matrix.Type</a></td></tr><tr><td class="alt">2 (Function)</td><td class="module"><a href="Matrix-Nat.html#v:toList" title="Matrix.Nat">Matrix.Nat</a></td></tr><tr><td class="src">toLists</td><td>&nbsp;</td></tr><tr><td class="alt">1 (Function)</td><td class="module"><a href="Matrix-Type.html#v:toLists" title="Matrix.Type">Matrix.Type</a></td></tr><tr><td class="alt">2 (Function)</td><td class="module"><a href="Matrix-Nat.html#v:toLists" title="Matrix.Nat">Matrix.Nat</a></td></tr><tr><td class="src">toValues</td><td class="module"><a href="Dist.html#v:toValues" title="Dist">Dist</a></td></tr><tr><td class="src">tr</td><td>&nbsp;</td></tr><tr><td class="alt">1 (Function)</td><td class="module"><a href="Matrix-Type.html#v:tr" title="Matrix.Type">Matrix.Type</a></td></tr><tr><td class="alt">2 (Function)</td><td class="module"><a href="Matrix-Nat.html#v:tr" title="Matrix.Nat">Matrix.Nat</a></td></tr><tr><td class="src">uniform</td><td class="module"><a href="Dist.html#v:uniform" title="Dist">Dist</a></td></tr><tr><td class="src">unitD</td><td class="module"><a href="Dist.html#v:unitD" title="Dist">Dist</a></td></tr><tr><td class="src">unitM</td><td class="module"><a href="Matrix-Type.html#v:unitM" title="Matrix.Type">Matrix.Type</a></td></tr><tr><td class="src">Zero</td><td class="module"><a href="Matrix-Type.html#t:Zero" title="Matrix.Type">Matrix.Type</a></td></tr><tr><td class="src">zeros</td><td>&nbsp;</td></tr><tr><td class="alt">1 (Function)</td><td class="module"><a href="Matrix-Type.html#v:zeros" title="Matrix.Type">Matrix.Type</a></td></tr><tr><td class="alt">2 (Function)</td><td class="module"><a href="Matrix-Nat.html#v:zeros" title="Matrix.Nat">Matrix.Nat</a></td></tr><tr><td class="src">|||</td><td>&nbsp;</td></tr><tr><td class="alt">1 (Function)</td><td class="module"><a href="Matrix-Type.html#v:-124--124--124-" title="Matrix.Type">Matrix.Type</a></td></tr><tr><td class="alt">2 (Function)</td><td class="module"><a href="Matrix-Nat.html#v:-124--124--124-" title="Matrix.Nat">Matrix.Nat</a></td></tr></table></div></div><div id="footer"><p>Produced by <a href="http://www.haskell.org/haddock/">Haddock</a> version 2.22.0</p></div></body></html>
build/x86_64-linux/ghc-8.6.5/laop-0.1.0.0/doc/html/laop-0.1.0.0-docs/doc-index.jsonnew file+1
@@ -0,0 +1 @@
1+[{"display_html":"<span class=\"keyword\">data</span> <a href=\"#t:Natural\">Natural</a> (start :: <a href=\"/package/base-4.12.0.0/docs/GHC-TypeNats.html#t:Nat\" title=\"GHC.TypeNats\">Nat</a>) (end :: <a href=\"/package/base-4.12.0.0/docs/GHC-TypeNats.html#t:Nat\" title=\"GHC.TypeNats\">Nat</a>)","name":"Natural","module":"Utils","link":"Utils.html#t:Natural"},{"display_html":"<a href=\"#v:nat\">nat</a> :: <span class=\"keyword\">forall</span> n m. (<a href=\"/package/base-4.12.0.0/docs/GHC-TypeNats.html#t:KnownNat\" title=\"GHC.TypeNats\">KnownNat</a> n, <a href=\"/package/base-4.12.0.0/docs/GHC-TypeNats.html#t:KnownNat\" title=\"GHC.TypeNats\">KnownNat</a> m) =&gt; <a href=\"/package/base-4.12.0.0/docs/Data-Int.html#t:Int\" title=\"Data.Int\">Int</a> -&gt; <a href=\"Utils.html#t:Natural\" title=\"Utils\">Natural</a> n m","name":"nat","module":"Utils","link":"Utils.html#v:nat"},{"display_html":"<a href=\"#v:coerceNat\">coerceNat</a> :: (<a href=\"/package/base-4.12.0.0/docs/Data-Int.html#t:Int\" title=\"Data.Int\">Int</a> -&gt; <a href=\"/package/base-4.12.0.0/docs/Data-Int.html#t:Int\" title=\"Data.Int\">Int</a> -&gt; <a href=\"/package/base-4.12.0.0/docs/Data-Int.html#t:Int\" title=\"Data.Int\">Int</a>) -&gt; <a href=\"Utils.html#t:Natural\" title=\"Utils\">Natural</a> a a' -&gt; <a href=\"Utils.html#t:Natural\" title=\"Utils\">Natural</a> b b' -&gt; <a href=\"Utils.html#t:Natural\" title=\"Utils\">Natural</a> c c'","name":"coerceNat","module":"Utils","link":"Utils.html#v:coerceNat"},{"display_html":"<a href=\"#v:coerceNat2\">coerceNat2</a> :: ((<a href=\"/package/base-4.12.0.0/docs/Data-Int.html#t:Int\" title=\"Data.Int\">Int</a>, <a href=\"/package/base-4.12.0.0/docs/Data-Int.html#t:Int\" title=\"Data.Int\">Int</a>) -&gt; <a href=\"/package/base-4.12.0.0/docs/Data-Int.html#t:Int\" title=\"Data.Int\">Int</a> -&gt; <a href=\"/package/base-4.12.0.0/docs/Data-Int.html#t:Int\" title=\"Data.Int\">Int</a>) -&gt; (<a href=\"Utils.html#t:Natural\" title=\"Utils\">Natural</a> a a', <a href=\"Utils.html#t:Natural\" title=\"Utils\">Natural</a> b b') -&gt; <a href=\"Utils.html#t:Natural\" title=\"Utils\">Natural</a> c c' -&gt; <a href=\"Utils.html#t:Natural\" title=\"Utils\">Natural</a> d d'","name":"coerceNat2","module":"Utils","link":"Utils.html#v:coerceNat2"},{"display_html":"<a href=\"#v:coerceNat3\">coerceNat3</a> :: (<a href=\"/package/base-4.12.0.0/docs/Data-Int.html#t:Int\" title=\"Data.Int\">Int</a> -&gt; <a href=\"/package/base-4.12.0.0/docs/Data-Int.html#t:Int\" title=\"Data.Int\">Int</a> -&gt; a) -&gt; <a href=\"Utils.html#t:Natural\" title=\"Utils\">Natural</a> b b' -&gt; <a href=\"Utils.html#t:Natural\" title=\"Utils\">Natural</a> c c' -&gt; a","name":"coerceNat3","module":"Utils","link":"Utils.html#v:coerceNat3"},{"display_html":"<span class=\"keyword\">newtype</span> <a href=\"#t:Matrix\">Matrix</a> e (cols :: <a href=\"/package/base-4.12.0.0/docs/Data-Kind.html#t:Type\" title=\"Data.Kind\">Type</a>) (rows :: <a href=\"/package/base-4.12.0.0/docs/Data-Kind.html#t:Type\" title=\"Data.Kind\">Type</a>) = <a href=\"#v:M\">M</a> (Matrix e (<a href=\"Matrix-Type.html#t:Normalize\" title=\"Matrix.Type\">Normalize</a> cols) (<a href=\"Matrix-Type.html#t:Normalize\" title=\"Matrix.Type\">Normalize</a> rows))","name":"Matrix M","module":"Matrix.Type","link":"Matrix-Type.html#t:Matrix"},{"display_html":"<span class=\"keyword\">type</span> <a href=\"#t:Zero\">Zero</a> = <a href=\"/package/base-4.12.0.0/docs/Data-Void.html#t:Void\" title=\"Data.Void\">Void</a>","name":"Zero","module":"Matrix.Type","link":"Matrix-Type.html#t:Zero"},{"display_html":"<span class=\"keyword\">type</span> <a href=\"#t:One\">One</a> = ()","name":"One","module":"Matrix.Type","link":"Matrix-Type.html#t:One"},{"display_html":"<a href=\"#v:empty\">empty</a> :: <a href=\"Matrix-Type.html#t:Matrix\" title=\"Matrix.Type\">Matrix</a> e <a href=\"Matrix-Type.html#t:Zero\" title=\"Matrix.Type\">Zero</a> <a href=\"Matrix-Type.html#t:Zero\" title=\"Matrix.Type\">Zero</a>","name":"empty","module":"Matrix.Type","link":"Matrix-Type.html#v:empty"},{"display_html":"<a href=\"#v:one\">one</a> :: e -&gt; <a href=\"Matrix-Type.html#t:Matrix\" title=\"Matrix.Type\">Matrix</a> e <a href=\"Matrix-Type.html#t:One\" title=\"Matrix.Type\">One</a> <a href=\"Matrix-Type.html#t:One\" title=\"Matrix.Type\">One</a>","name":"one","module":"Matrix.Type","link":"Matrix-Type.html#v:one"},{"display_html":"<a href=\"#v:junc\">junc</a> :: <a href=\"Matrix-Type.html#t:Normalize\" title=\"Matrix.Type\">Normalize</a> (<a href=\"/package/base-4.12.0.0/docs/Data-Either.html#t:Either\" title=\"Data.Either\">Either</a> a b) ~ <a href=\"/package/base-4.12.0.0/docs/Data-Either.html#t:Either\" title=\"Data.Either\">Either</a> (<a href=\"Matrix-Type.html#t:Normalize\" title=\"Matrix.Type\">Normalize</a> a) (<a href=\"Matrix-Type.html#t:Normalize\" title=\"Matrix.Type\">Normalize</a> b) =&gt; <a href=\"Matrix-Type.html#t:Matrix\" title=\"Matrix.Type\">Matrix</a> e a rows -&gt; <a href=\"Matrix-Type.html#t:Matrix\" title=\"Matrix.Type\">Matrix</a> e b rows -&gt; <a href=\"Matrix-Type.html#t:Matrix\" title=\"Matrix.Type\">Matrix</a> e (<a href=\"/package/base-4.12.0.0/docs/Data-Either.html#t:Either\" title=\"Data.Either\">Either</a> a b) rows","name":"junc","module":"Matrix.Type","link":"Matrix-Type.html#v:junc"},{"display_html":"<a href=\"#v:split\">split</a> :: <a href=\"Matrix-Type.html#t:Normalize\" title=\"Matrix.Type\">Normalize</a> (<a href=\"/package/base-4.12.0.0/docs/Data-Either.html#t:Either\" title=\"Data.Either\">Either</a> a b) ~ <a href=\"/package/base-4.12.0.0/docs/Data-Either.html#t:Either\" title=\"Data.Either\">Either</a> (<a href=\"Matrix-Type.html#t:Normalize\" title=\"Matrix.Type\">Normalize</a> a) (<a href=\"Matrix-Type.html#t:Normalize\" title=\"Matrix.Type\">Normalize</a> b) =&gt; <a href=\"Matrix-Type.html#t:Matrix\" title=\"Matrix.Type\">Matrix</a> e cols a -&gt; <a href=\"Matrix-Type.html#t:Matrix\" title=\"Matrix.Type\">Matrix</a> e cols b -&gt; <a href=\"Matrix-Type.html#t:Matrix\" title=\"Matrix.Type\">Matrix</a> e cols (<a href=\"/package/base-4.12.0.0/docs/Data-Either.html#t:Either\" title=\"Data.Either\">Either</a> a b)","name":"split","module":"Matrix.Type","link":"Matrix-Type.html#v:split"},{"display_html":"<span class=\"keyword\">type family</span> <a href=\"#t:FromNat\">FromNat</a> (n :: <a href=\"/package/base-4.12.0.0/docs/GHC-TypeNats.html#t:Nat\" title=\"GHC.TypeNats\">Nat</a>) :: <a href=\"/package/base-4.12.0.0/docs/Data-Kind.html#t:Type\" title=\"Data.Kind\">Type</a> <span class=\"keyword\">where ...</span>","name":"FromNat","module":"Matrix.Type","link":"Matrix-Type.html#t:FromNat"},{"display_html":"<span class=\"keyword\">type family</span> <a href=\"#t:Count\">Count</a> (d :: <a href=\"/package/base-4.12.0.0/docs/Data-Kind.html#t:Type\" title=\"Data.Kind\">Type</a>) :: <a href=\"/package/base-4.12.0.0/docs/GHC-TypeNats.html#t:Nat\" title=\"GHC.TypeNats\">Nat</a> <span class=\"keyword\">where ...</span>","name":"Count","module":"Matrix.Type","link":"Matrix-Type.html#t:Count"},{"display_html":"<span class=\"keyword\">type family</span> <a href=\"#t:Normalize\">Normalize</a> (d :: <a href=\"/package/base-4.12.0.0/docs/Data-Kind.html#t:Type\" title=\"Data.Kind\">Type</a>) :: <a href=\"/package/base-4.12.0.0/docs/Data-Kind.html#t:Type\" title=\"Data.Kind\">Type</a> <span class=\"keyword\">where ...</span>","name":"Normalize","module":"Matrix.Type","link":"Matrix-Type.html#t:Normalize"},{"display_html":"<span class=\"keyword\">class</span> <a href=\"#t:FromLists\">FromLists</a> e cols rows","name":"FromLists","module":"Matrix.Type","link":"Matrix-Type.html#t:FromLists"},{"display_html":"<a href=\"#v:fromLists\">fromLists</a> :: <a href=\"Matrix-Type.html#t:FromLists\" title=\"Matrix.Type\">FromLists</a> e (<a href=\"Matrix-Type.html#t:Normalize\" title=\"Matrix.Type\">Normalize</a> cols) (<a href=\"Matrix-Type.html#t:Normalize\" title=\"Matrix.Type\">Normalize</a> rows) =&gt; [[e]] -&gt; <a href=\"Matrix-Type.html#t:Matrix\" title=\"Matrix.Type\">Matrix</a> e cols rows","name":"fromLists","module":"Matrix.Type","link":"Matrix-Type.html#v:fromLists"},{"display_html":"<a href=\"#v:toLists\">toLists</a> :: <a href=\"Matrix-Type.html#t:Matrix\" title=\"Matrix.Type\">Matrix</a> e cols rows -&gt; [[e]]","name":"toLists","module":"Matrix.Type","link":"Matrix-Type.html#v:toLists"},{"display_html":"<a href=\"#v:toList\">toList</a> :: <a href=\"Matrix-Type.html#t:Matrix\" title=\"Matrix.Type\">Matrix</a> e cols rows -&gt; [e]","name":"toList","module":"Matrix.Type","link":"Matrix-Type.html#v:toList"},{"display_html":"<a href=\"#v:matrixBuilder\">matrixBuilder</a> :: (<a href=\"Matrix-Type.html#t:FromLists\" title=\"Matrix.Type\">FromLists</a> e (<a href=\"Matrix-Type.html#t:Normalize\" title=\"Matrix.Type\">Normalize</a> cols) (<a href=\"Matrix-Type.html#t:Normalize\" title=\"Matrix.Type\">Normalize</a> rows), <a href=\"/package/base-4.12.0.0/docs/GHC-TypeNats.html#t:KnownNat\" title=\"GHC.TypeNats\">KnownNat</a> (<a href=\"Matrix-Type.html#t:Count\" title=\"Matrix.Type\">Count</a> (<a href=\"Matrix-Type.html#t:Normalize\" title=\"Matrix.Type\">Normalize</a> cols)), <a href=\"/package/base-4.12.0.0/docs/GHC-TypeNats.html#t:KnownNat\" title=\"GHC.TypeNats\">KnownNat</a> (<a href=\"Matrix-Type.html#t:Count\" title=\"Matrix.Type\">Count</a> (<a href=\"Matrix-Type.html#t:Normalize\" title=\"Matrix.Type\">Normalize</a> rows))) =&gt; ((<a href=\"/package/base-4.12.0.0/docs/Data-Int.html#t:Int\" title=\"Data.Int\">Int</a>, <a href=\"/package/base-4.12.0.0/docs/Data-Int.html#t:Int\" title=\"Data.Int\">Int</a>) -&gt; e) -&gt; <a href=\"Matrix-Type.html#t:Matrix\" title=\"Matrix.Type\">Matrix</a> e cols rows","name":"matrixBuilder","module":"Matrix.Type","link":"Matrix-Type.html#v:matrixBuilder"},{"display_html":"<a href=\"#v:row\">row</a> :: <a href=\"Matrix-Type.html#t:FromLists\" title=\"Matrix.Type\">FromLists</a> e (<a href=\"Matrix-Type.html#t:Normalize\" title=\"Matrix.Type\">Normalize</a> cols) () =&gt; [e] -&gt; <a href=\"Matrix-Type.html#t:Matrix\" title=\"Matrix.Type\">Matrix</a> e cols <a href=\"Matrix-Type.html#t:One\" title=\"Matrix.Type\">One</a>","name":"row","module":"Matrix.Type","link":"Matrix-Type.html#v:row"},{"display_html":"<a href=\"#v:col\">col</a> :: <a href=\"Matrix-Type.html#t:FromLists\" title=\"Matrix.Type\">FromLists</a> e () (<a href=\"Matrix-Type.html#t:Normalize\" title=\"Matrix.Type\">Normalize</a> rows) =&gt; [e] -&gt; <a href=\"Matrix-Type.html#t:Matrix\" title=\"Matrix.Type\">Matrix</a> e <a href=\"Matrix-Type.html#t:One\" title=\"Matrix.Type\">One</a> rows","name":"col","module":"Matrix.Type","link":"Matrix-Type.html#v:col"},{"display_html":"<a href=\"#v:zeros\">zeros</a> :: (<a href=\"/package/base-4.12.0.0/docs/Prelude.html#t:Num\" title=\"Prelude\">Num</a> e, <a href=\"Matrix-Type.html#t:FromLists\" title=\"Matrix.Type\">FromLists</a> e (<a href=\"Matrix-Type.html#t:Normalize\" title=\"Matrix.Type\">Normalize</a> cols) (<a href=\"Matrix-Type.html#t:Normalize\" title=\"Matrix.Type\">Normalize</a> rows), <a href=\"/package/base-4.12.0.0/docs/GHC-TypeNats.html#t:KnownNat\" title=\"GHC.TypeNats\">KnownNat</a> (<a href=\"Matrix-Type.html#t:Count\" title=\"Matrix.Type\">Count</a> (<a href=\"Matrix-Type.html#t:Normalize\" title=\"Matrix.Type\">Normalize</a> cols)), <a href=\"/package/base-4.12.0.0/docs/GHC-TypeNats.html#t:KnownNat\" title=\"GHC.TypeNats\">KnownNat</a> (<a href=\"Matrix-Type.html#t:Count\" title=\"Matrix.Type\">Count</a> (<a href=\"Matrix-Type.html#t:Normalize\" title=\"Matrix.Type\">Normalize</a> rows))) =&gt; <a href=\"Matrix-Type.html#t:Matrix\" title=\"Matrix.Type\">Matrix</a> e cols rows","name":"zeros","module":"Matrix.Type","link":"Matrix-Type.html#v:zeros"},{"display_html":"<a href=\"#v:ones\">ones</a> :: (<a href=\"/package/base-4.12.0.0/docs/Prelude.html#t:Num\" title=\"Prelude\">Num</a> e, <a href=\"Matrix-Type.html#t:FromLists\" title=\"Matrix.Type\">FromLists</a> e (<a href=\"Matrix-Type.html#t:Normalize\" title=\"Matrix.Type\">Normalize</a> cols) (<a href=\"Matrix-Type.html#t:Normalize\" title=\"Matrix.Type\">Normalize</a> rows), <a href=\"/package/base-4.12.0.0/docs/GHC-TypeNats.html#t:KnownNat\" title=\"GHC.TypeNats\">KnownNat</a> (<a href=\"Matrix-Type.html#t:Count\" title=\"Matrix.Type\">Count</a> (<a href=\"Matrix-Type.html#t:Normalize\" title=\"Matrix.Type\">Normalize</a> cols)), <a href=\"/package/base-4.12.0.0/docs/GHC-TypeNats.html#t:KnownNat\" title=\"GHC.TypeNats\">KnownNat</a> (<a href=\"Matrix-Type.html#t:Count\" title=\"Matrix.Type\">Count</a> (<a href=\"Matrix-Type.html#t:Normalize\" title=\"Matrix.Type\">Normalize</a> rows))) =&gt; <a href=\"Matrix-Type.html#t:Matrix\" title=\"Matrix.Type\">Matrix</a> e cols rows","name":"ones","module":"Matrix.Type","link":"Matrix-Type.html#v:ones"},{"display_html":"<a href=\"#v:bang\">bang</a> :: <span class=\"keyword\">forall</span> e cols. (<a href=\"/package/base-4.12.0.0/docs/Prelude.html#t:Num\" title=\"Prelude\">Num</a> e, <a href=\"/package/base-4.12.0.0/docs/Prelude.html#t:Enum\" title=\"Prelude\">Enum</a> e, <a href=\"Matrix-Type.html#t:FromLists\" title=\"Matrix.Type\">FromLists</a> e (<a href=\"Matrix-Type.html#t:Normalize\" title=\"Matrix.Type\">Normalize</a> cols) (), <a href=\"/package/base-4.12.0.0/docs/GHC-TypeNats.html#t:KnownNat\" title=\"GHC.TypeNats\">KnownNat</a> (<a href=\"Matrix-Type.html#t:Count\" title=\"Matrix.Type\">Count</a> (<a href=\"Matrix-Type.html#t:Normalize\" title=\"Matrix.Type\">Normalize</a> cols))) =&gt; <a href=\"Matrix-Type.html#t:Matrix\" title=\"Matrix.Type\">Matrix</a> e cols <a href=\"Matrix-Type.html#t:One\" title=\"Matrix.Type\">One</a>","name":"bang","module":"Matrix.Type","link":"Matrix-Type.html#v:bang"},{"display_html":"<a href=\"#v:constant\">constant</a> :: (<a href=\"/package/base-4.12.0.0/docs/Prelude.html#t:Num\" title=\"Prelude\">Num</a> e, <a href=\"Matrix-Type.html#t:FromLists\" title=\"Matrix.Type\">FromLists</a> e (<a href=\"Matrix-Type.html#t:Normalize\" title=\"Matrix.Type\">Normalize</a> cols) (<a href=\"Matrix-Type.html#t:Normalize\" title=\"Matrix.Type\">Normalize</a> rows), <a href=\"/package/base-4.12.0.0/docs/GHC-TypeNats.html#t:KnownNat\" title=\"GHC.TypeNats\">KnownNat</a> (<a href=\"Matrix-Type.html#t:Count\" title=\"Matrix.Type\">Count</a> (<a href=\"Matrix-Type.html#t:Normalize\" title=\"Matrix.Type\">Normalize</a> cols)), <a href=\"/package/base-4.12.0.0/docs/GHC-TypeNats.html#t:KnownNat\" title=\"GHC.TypeNats\">KnownNat</a> (<a href=\"Matrix-Type.html#t:Count\" title=\"Matrix.Type\">Count</a> (<a href=\"Matrix-Type.html#t:Normalize\" title=\"Matrix.Type\">Normalize</a> rows))) =&gt; e -&gt; <a href=\"Matrix-Type.html#t:Matrix\" title=\"Matrix.Type\">Matrix</a> e cols rows","name":"constant","module":"Matrix.Type","link":"Matrix-Type.html#v:constant"},{"display_html":"<a href=\"#v:fmapM\">fmapM</a> :: (<a href=\"/package/base-4.12.0.0/docs/Prelude.html#t:Bounded\" title=\"Prelude\">Bounded</a> a, <a href=\"/package/base-4.12.0.0/docs/Prelude.html#t:Bounded\" title=\"Prelude\">Bounded</a> b, <a href=\"/package/base-4.12.0.0/docs/Prelude.html#t:Enum\" title=\"Prelude\">Enum</a> a, <a href=\"/package/base-4.12.0.0/docs/Prelude.html#t:Enum\" title=\"Prelude\">Enum</a> b, <a href=\"/package/base-4.12.0.0/docs/Data-Eq.html#t:Eq\" title=\"Data.Eq\">Eq</a> b, <a href=\"/package/base-4.12.0.0/docs/Prelude.html#t:Num\" title=\"Prelude\">Num</a> e, <a href=\"/package/base-4.12.0.0/docs/Data-Ord.html#t:Ord\" title=\"Data.Ord\">Ord</a> e, <a href=\"/package/base-4.12.0.0/docs/GHC-TypeNats.html#t:KnownNat\" title=\"GHC.TypeNats\">KnownNat</a> (<a href=\"Matrix-Type.html#t:Count\" title=\"Matrix.Type\">Count</a> (<a href=\"Matrix-Type.html#t:Normalize\" title=\"Matrix.Type\">Normalize</a> a)), <a href=\"/package/base-4.12.0.0/docs/GHC-TypeNats.html#t:KnownNat\" title=\"GHC.TypeNats\">KnownNat</a> (<a href=\"Matrix-Type.html#t:Count\" title=\"Matrix.Type\">Count</a> (<a href=\"Matrix-Type.html#t:Normalize\" title=\"Matrix.Type\">Normalize</a> b)), <a href=\"Matrix-Type.html#t:FromLists\" title=\"Matrix.Type\">FromLists</a> e (<a href=\"Matrix-Type.html#t:Normalize\" title=\"Matrix.Type\">Normalize</a> b) (<a href=\"Matrix-Type.html#t:Normalize\" title=\"Matrix.Type\">Normalize</a> a)) =&gt; (a -&gt; b) -&gt; <a href=\"Matrix-Type.html#t:Matrix\" title=\"Matrix.Type\">Matrix</a> e c a -&gt; <a href=\"Matrix-Type.html#t:Matrix\" title=\"Matrix.Type\">Matrix</a> e c b","name":"fmapM","module":"Matrix.Type","link":"Matrix-Type.html#v:fmapM"},{"display_html":"<a href=\"#v:unitM\">unitM</a> :: <a href=\"/package/base-4.12.0.0/docs/Prelude.html#t:Num\" title=\"Prelude\">Num</a> e =&gt; <a href=\"Matrix-Type.html#t:Matrix\" title=\"Matrix.Type\">Matrix</a> e () ()","name":"unitM","module":"Matrix.Type","link":"Matrix-Type.html#v:unitM"},{"display_html":"<a href=\"#v:multM\">multM</a> :: (<a href=\"/package/base-4.12.0.0/docs/GHC-TypeNats.html#t:KnownNat\" title=\"GHC.TypeNats\">KnownNat</a> (<a href=\"Matrix-Type.html#t:Count\" title=\"Matrix.Type\">Count</a> (<a href=\"Matrix-Type.html#t:Normalize\" title=\"Matrix.Type\">Normalize</a> a)), <a href=\"/package/base-4.12.0.0/docs/GHC-TypeNats.html#t:KnownNat\" title=\"GHC.TypeNats\">KnownNat</a> (<a href=\"Matrix-Type.html#t:Count\" title=\"Matrix.Type\">Count</a> (<a href=\"Matrix-Type.html#t:Normalize\" title=\"Matrix.Type\">Normalize</a> b)), <a href=\"/package/base-4.12.0.0/docs/GHC-TypeNats.html#t:KnownNat\" title=\"GHC.TypeNats\">KnownNat</a> (<a href=\"Matrix-Type.html#t:Count\" title=\"Matrix.Type\">Count</a> (<a href=\"Matrix-Type.html#t:Normalize\" title=\"Matrix.Type\">Normalize</a> (a, b))), <a href=\"/package/base-4.12.0.0/docs/Prelude.html#t:Num\" title=\"Prelude\">Num</a> e, <a href=\"Matrix-Type.html#t:FromLists\" title=\"Matrix.Type\">FromLists</a> e (<a href=\"Matrix-Type.html#t:Normalize\" title=\"Matrix.Type\">Normalize</a> (a, b)) (<a href=\"Matrix-Type.html#t:Normalize\" title=\"Matrix.Type\">Normalize</a> a), <a href=\"Matrix-Type.html#t:FromLists\" title=\"Matrix.Type\">FromLists</a> e (<a href=\"Matrix-Type.html#t:Normalize\" title=\"Matrix.Type\">Normalize</a> (a, b)) (<a href=\"Matrix-Type.html#t:Normalize\" title=\"Matrix.Type\">Normalize</a> b), <a href=\"Matrix-Type.html#t:Normalize\" title=\"Matrix.Type\">Normalize</a> (a, b) ~ <a href=\"Matrix-Type.html#t:Normalize\" title=\"Matrix.Type\">Normalize</a> (<a href=\"Matrix-Type.html#t:Normalize\" title=\"Matrix.Type\">Normalize</a> a, <a href=\"Matrix-Type.html#t:Normalize\" title=\"Matrix.Type\">Normalize</a> b)) =&gt; <a href=\"Matrix-Type.html#t:Matrix\" title=\"Matrix.Type\">Matrix</a> e c a -&gt; <a href=\"Matrix-Type.html#t:Matrix\" title=\"Matrix.Type\">Matrix</a> e c b -&gt; <a href=\"Matrix-Type.html#t:Matrix\" title=\"Matrix.Type\">Matrix</a> e c (a, b)","name":"multM","module":"Matrix.Type","link":"Matrix-Type.html#v:multM"},{"display_html":"<a href=\"#v:selectM\">selectM</a> :: (<a href=\"/package/base-4.12.0.0/docs/Prelude.html#t:Num\" title=\"Prelude\">Num</a> e, <a href=\"Matrix-Type.html#t:FromLists\" title=\"Matrix.Type\">FromLists</a> e (<a href=\"Matrix-Type.html#t:Normalize\" title=\"Matrix.Type\">Normalize</a> b) (<a href=\"Matrix-Type.html#t:Normalize\" title=\"Matrix.Type\">Normalize</a> b), <a href=\"/package/base-4.12.0.0/docs/GHC-TypeNats.html#t:KnownNat\" title=\"GHC.TypeNats\">KnownNat</a> (<a href=\"Matrix-Type.html#t:Count\" title=\"Matrix.Type\">Count</a> (<a href=\"Matrix-Type.html#t:Normalize\" title=\"Matrix.Type\">Normalize</a> b)), <a href=\"Matrix-Type.html#t:Normalize\" title=\"Matrix.Type\">Normalize</a> (<a href=\"/package/base-4.12.0.0/docs/Data-Either.html#t:Either\" title=\"Data.Either\">Either</a> a b) ~ <a href=\"/package/base-4.12.0.0/docs/Data-Either.html#t:Either\" title=\"Data.Either\">Either</a> (<a href=\"Matrix-Type.html#t:Normalize\" title=\"Matrix.Type\">Normalize</a> a) (<a href=\"Matrix-Type.html#t:Normalize\" title=\"Matrix.Type\">Normalize</a> b)) =&gt; <a href=\"Matrix-Type.html#t:Matrix\" title=\"Matrix.Type\">Matrix</a> e cols (<a href=\"/package/base-4.12.0.0/docs/Data-Either.html#t:Either\" title=\"Data.Either\">Either</a> a b) -&gt; <a href=\"Matrix-Type.html#t:Matrix\" title=\"Matrix.Type\">Matrix</a> e a b -&gt; <a href=\"Matrix-Type.html#t:Matrix\" title=\"Matrix.Type\">Matrix</a> e cols b","name":"selectM","module":"Matrix.Type","link":"Matrix-Type.html#v:selectM"},{"display_html":"<a href=\"#v:returnM\">returnM</a> :: <span class=\"keyword\">forall</span> e a. (<a href=\"/package/base-4.12.0.0/docs/Prelude.html#t:Num\" title=\"Prelude\">Num</a> e, <a href=\"/package/base-4.12.0.0/docs/Prelude.html#t:Enum\" title=\"Prelude\">Enum</a> e, <a href=\"/package/base-4.12.0.0/docs/Prelude.html#t:Enum\" title=\"Prelude\">Enum</a> a, <a href=\"Matrix-Type.html#t:FromLists\" title=\"Matrix.Type\">FromLists</a> e () (<a href=\"Matrix-Type.html#t:Normalize\" title=\"Matrix.Type\">Normalize</a> a), <a href=\"/package/base-4.12.0.0/docs/GHC-TypeNats.html#t:KnownNat\" title=\"GHC.TypeNats\">KnownNat</a> (<a href=\"Matrix-Type.html#t:Count\" title=\"Matrix.Type\">Count</a> a)) =&gt; a -&gt; <a href=\"Matrix-Type.html#t:Matrix\" title=\"Matrix.Type\">Matrix</a> e <a href=\"Matrix-Type.html#t:One\" title=\"Matrix.Type\">One</a> a","name":"returnM","module":"Matrix.Type","link":"Matrix-Type.html#v:returnM"},{"display_html":"<a href=\"#v:bindM\">bindM</a> :: <a href=\"/package/base-4.12.0.0/docs/Prelude.html#t:Num\" title=\"Prelude\">Num</a> e =&gt; <a href=\"Matrix-Type.html#t:Matrix\" title=\"Matrix.Type\">Matrix</a> e a b -&gt; <a href=\"Matrix-Type.html#t:Matrix\" title=\"Matrix.Type\">Matrix</a> e b c -&gt; <a href=\"Matrix-Type.html#t:Matrix\" title=\"Matrix.Type\">Matrix</a> e a c","name":"bindM","module":"Matrix.Type","link":"Matrix-Type.html#v:bindM"},{"display_html":"<a href=\"#v:columns\">columns</a> :: <a href=\"/package/base-4.12.0.0/docs/GHC-TypeNats.html#t:KnownNat\" title=\"GHC.TypeNats\">KnownNat</a> (<a href=\"Matrix-Type.html#t:Count\" title=\"Matrix.Type\">Count</a> (<a href=\"Matrix-Type.html#t:Normalize\" title=\"Matrix.Type\">Normalize</a> cols)) =&gt; <a href=\"Matrix-Type.html#t:Matrix\" title=\"Matrix.Type\">Matrix</a> e cols rows -&gt; <a href=\"/package/base-4.12.0.0/docs/Data-Int.html#t:Int\" title=\"Data.Int\">Int</a>","name":"columns","module":"Matrix.Type","link":"Matrix-Type.html#v:columns"},{"display_html":"<a href=\"#v:rows\">rows</a> :: <a href=\"/package/base-4.12.0.0/docs/GHC-TypeNats.html#t:KnownNat\" title=\"GHC.TypeNats\">KnownNat</a> (<a href=\"Matrix-Type.html#t:Count\" title=\"Matrix.Type\">Count</a> (<a href=\"Matrix-Type.html#t:Normalize\" title=\"Matrix.Type\">Normalize</a> rows)) =&gt; <a href=\"Matrix-Type.html#t:Matrix\" title=\"Matrix.Type\">Matrix</a> e cols rows -&gt; <a href=\"/package/base-4.12.0.0/docs/Data-Int.html#t:Int\" title=\"Data.Int\">Int</a>","name":"rows","module":"Matrix.Type","link":"Matrix-Type.html#v:rows"},{"display_html":"<a href=\"#v:tr\">tr</a> :: <a href=\"Matrix-Type.html#t:Matrix\" title=\"Matrix.Type\">Matrix</a> e cols rows -&gt; <a href=\"Matrix-Type.html#t:Matrix\" title=\"Matrix.Type\">Matrix</a> e rows cols","name":"tr","module":"Matrix.Type","link":"Matrix-Type.html#v:tr"},{"display_html":"<a href=\"#v:cond\">cond</a> :: (<a href=\"Matrix-Type.html#t:Normalize\" title=\"Matrix.Type\">Normalize</a> (<a href=\"Matrix-Type.html#t:Normalize\" title=\"Matrix.Type\">Normalize</a> a) ~ <a href=\"Matrix-Type.html#t:Normalize\" title=\"Matrix.Type\">Normalize</a> a, <a href=\"/package/base-4.12.0.0/docs/GHC-TypeNats.html#t:KnownNat\" title=\"GHC.TypeNats\">KnownNat</a> (<a href=\"Matrix-Type.html#t:Count\" title=\"Matrix.Type\">Count</a> (<a href=\"Matrix-Type.html#t:Normalize\" title=\"Matrix.Type\">Normalize</a> a)), <a href=\"Matrix-Type.html#t:FromLists\" title=\"Matrix.Type\">FromLists</a> e () (<a href=\"Matrix-Type.html#t:Normalize\" title=\"Matrix.Type\">Normalize</a> a), <a href=\"Matrix-Type.html#t:FromLists\" title=\"Matrix.Type\">FromLists</a> e (<a href=\"Matrix-Type.html#t:Normalize\" title=\"Matrix.Type\">Normalize</a> a) (), <a href=\"Matrix-Type.html#t:FromLists\" title=\"Matrix.Type\">FromLists</a> e (<a href=\"Matrix-Type.html#t:Normalize\" title=\"Matrix.Type\">Normalize</a> a) (<a href=\"Matrix-Type.html#t:Normalize\" title=\"Matrix.Type\">Normalize</a> a), <a href=\"/package/base-4.12.0.0/docs/Prelude.html#t:Bounded\" title=\"Prelude\">Bounded</a> a, <a href=\"/package/base-4.12.0.0/docs/Prelude.html#t:Enum\" title=\"Prelude\">Enum</a> a, <a href=\"/package/base-4.12.0.0/docs/Prelude.html#t:Num\" title=\"Prelude\">Num</a> e, <a href=\"/package/base-4.12.0.0/docs/Data-Ord.html#t:Ord\" title=\"Data.Ord\">Ord</a> e) =&gt; (a -&gt; <a href=\"/package/base-4.12.0.0/docs/Data-Bool.html#t:Bool\" title=\"Data.Bool\">Bool</a>) -&gt; <a href=\"Matrix-Type.html#t:Matrix\" title=\"Matrix.Type\">Matrix</a> e a b -&gt; <a href=\"Matrix-Type.html#t:Matrix\" title=\"Matrix.Type\">Matrix</a> e a b -&gt; <a href=\"Matrix-Type.html#t:Matrix\" title=\"Matrix.Type\">Matrix</a> e a b","name":"cond","module":"Matrix.Type","link":"Matrix-Type.html#v:cond"},{"display_html":"<a href=\"#v:abideJS\">abideJS</a> :: <a href=\"Matrix-Type.html#t:Matrix\" title=\"Matrix.Type\">Matrix</a> e cols rows -&gt; <a href=\"Matrix-Type.html#t:Matrix\" title=\"Matrix.Type\">Matrix</a> e cols rows","name":"abideJS","module":"Matrix.Type","link":"Matrix-Type.html#v:abideJS"},{"display_html":"<a href=\"#v:abideSJ\">abideSJ</a> :: <a href=\"Matrix-Type.html#t:Matrix\" title=\"Matrix.Type\">Matrix</a> e cols rows -&gt; <a href=\"Matrix-Type.html#t:Matrix\" title=\"Matrix.Type\">Matrix</a> e cols rows","name":"abideSJ","module":"Matrix.Type","link":"Matrix-Type.html#v:abideSJ"},{"display_html":"<a href=\"#v:-61--61--61-\">(===)</a> :: <a href=\"Matrix-Type.html#t:Normalize\" title=\"Matrix.Type\">Normalize</a> (<a href=\"/package/base-4.12.0.0/docs/Data-Either.html#t:Either\" title=\"Data.Either\">Either</a> a b) ~ <a href=\"/package/base-4.12.0.0/docs/Data-Either.html#t:Either\" title=\"Data.Either\">Either</a> (<a href=\"Matrix-Type.html#t:Normalize\" title=\"Matrix.Type\">Normalize</a> a) (<a href=\"Matrix-Type.html#t:Normalize\" title=\"Matrix.Type\">Normalize</a> b) =&gt; <a href=\"Matrix-Type.html#t:Matrix\" title=\"Matrix.Type\">Matrix</a> e cols a -&gt; <a href=\"Matrix-Type.html#t:Matrix\" title=\"Matrix.Type\">Matrix</a> e cols b -&gt; <a href=\"Matrix-Type.html#t:Matrix\" title=\"Matrix.Type\">Matrix</a> e cols (<a href=\"/package/base-4.12.0.0/docs/Data-Either.html#t:Either\" title=\"Data.Either\">Either</a> a b)","name":"===","module":"Matrix.Type","link":"Matrix-Type.html#v:-61--61--61-"},{"display_html":"<a href=\"#v:p1\">p1</a> :: (<a href=\"/package/base-4.12.0.0/docs/Prelude.html#t:Num\" title=\"Prelude\">Num</a> e, <a href=\"/package/base-4.12.0.0/docs/GHC-TypeNats.html#t:KnownNat\" title=\"GHC.TypeNats\">KnownNat</a> (<a href=\"Matrix-Type.html#t:Count\" title=\"Matrix.Type\">Count</a> (<a href=\"Matrix-Type.html#t:Normalize\" title=\"Matrix.Type\">Normalize</a> n)), <a href=\"/package/base-4.12.0.0/docs/GHC-TypeNats.html#t:KnownNat\" title=\"GHC.TypeNats\">KnownNat</a> (<a href=\"Matrix-Type.html#t:Count\" title=\"Matrix.Type\">Count</a> (<a href=\"Matrix-Type.html#t:Normalize\" title=\"Matrix.Type\">Normalize</a> m)), <a href=\"Matrix-Type.html#t:FromLists\" title=\"Matrix.Type\">FromLists</a> e (<a href=\"Matrix-Type.html#t:Normalize\" title=\"Matrix.Type\">Normalize</a> n) (<a href=\"Matrix-Type.html#t:Normalize\" title=\"Matrix.Type\">Normalize</a> m), <a href=\"Matrix-Type.html#t:FromLists\" title=\"Matrix.Type\">FromLists</a> e (<a href=\"Matrix-Type.html#t:Normalize\" title=\"Matrix.Type\">Normalize</a> m) (<a href=\"Matrix-Type.html#t:Normalize\" title=\"Matrix.Type\">Normalize</a> m), <a href=\"Matrix-Type.html#t:Normalize\" title=\"Matrix.Type\">Normalize</a> (<a href=\"/package/base-4.12.0.0/docs/Data-Either.html#t:Either\" title=\"Data.Either\">Either</a> m n) ~ <a href=\"/package/base-4.12.0.0/docs/Data-Either.html#t:Either\" title=\"Data.Either\">Either</a> (<a href=\"Matrix-Type.html#t:Normalize\" title=\"Matrix.Type\">Normalize</a> m) (<a href=\"Matrix-Type.html#t:Normalize\" title=\"Matrix.Type\">Normalize</a> n)) =&gt; <a href=\"Matrix-Type.html#t:Matrix\" title=\"Matrix.Type\">Matrix</a> e (<a href=\"/package/base-4.12.0.0/docs/Data-Either.html#t:Either\" title=\"Data.Either\">Either</a> m n) m","name":"p1","module":"Matrix.Type","link":"Matrix-Type.html#v:p1"},{"display_html":"<a href=\"#v:p2\">p2</a> :: (<a href=\"/package/base-4.12.0.0/docs/Prelude.html#t:Num\" title=\"Prelude\">Num</a> e, <a href=\"/package/base-4.12.0.0/docs/GHC-TypeNats.html#t:KnownNat\" title=\"GHC.TypeNats\">KnownNat</a> (<a href=\"Matrix-Type.html#t:Count\" title=\"Matrix.Type\">Count</a> (<a href=\"Matrix-Type.html#t:Normalize\" title=\"Matrix.Type\">Normalize</a> n)), <a href=\"/package/base-4.12.0.0/docs/GHC-TypeNats.html#t:KnownNat\" title=\"GHC.TypeNats\">KnownNat</a> (<a href=\"Matrix-Type.html#t:Count\" title=\"Matrix.Type\">Count</a> (<a href=\"Matrix-Type.html#t:Normalize\" title=\"Matrix.Type\">Normalize</a> m)), <a href=\"Matrix-Type.html#t:FromLists\" title=\"Matrix.Type\">FromLists</a> e (<a href=\"Matrix-Type.html#t:Normalize\" title=\"Matrix.Type\">Normalize</a> m) (<a href=\"Matrix-Type.html#t:Normalize\" title=\"Matrix.Type\">Normalize</a> n), <a href=\"Matrix-Type.html#t:FromLists\" title=\"Matrix.Type\">FromLists</a> e (<a href=\"Matrix-Type.html#t:Normalize\" title=\"Matrix.Type\">Normalize</a> n) (<a href=\"Matrix-Type.html#t:Normalize\" title=\"Matrix.Type\">Normalize</a> n), <a href=\"Matrix-Type.html#t:Normalize\" title=\"Matrix.Type\">Normalize</a> (<a href=\"/package/base-4.12.0.0/docs/Data-Either.html#t:Either\" title=\"Data.Either\">Either</a> m n) ~ <a href=\"/package/base-4.12.0.0/docs/Data-Either.html#t:Either\" title=\"Data.Either\">Either</a> (<a href=\"Matrix-Type.html#t:Normalize\" title=\"Matrix.Type\">Normalize</a> m) (<a href=\"Matrix-Type.html#t:Normalize\" title=\"Matrix.Type\">Normalize</a> n)) =&gt; <a href=\"Matrix-Type.html#t:Matrix\" title=\"Matrix.Type\">Matrix</a> e (<a href=\"/package/base-4.12.0.0/docs/Data-Either.html#t:Either\" title=\"Data.Either\">Either</a> m n) n","name":"p2","module":"Matrix.Type","link":"Matrix-Type.html#v:p2"},{"display_html":"<a href=\"#v:-124--124--124-\">(|||)</a> :: <a href=\"Matrix-Type.html#t:Normalize\" title=\"Matrix.Type\">Normalize</a> (<a href=\"/package/base-4.12.0.0/docs/Data-Either.html#t:Either\" title=\"Data.Either\">Either</a> a b) ~ <a href=\"/package/base-4.12.0.0/docs/Data-Either.html#t:Either\" title=\"Data.Either\">Either</a> (<a href=\"Matrix-Type.html#t:Normalize\" title=\"Matrix.Type\">Normalize</a> a) (<a href=\"Matrix-Type.html#t:Normalize\" title=\"Matrix.Type\">Normalize</a> b) =&gt; <a href=\"Matrix-Type.html#t:Matrix\" title=\"Matrix.Type\">Matrix</a> e a rows -&gt; <a href=\"Matrix-Type.html#t:Matrix\" title=\"Matrix.Type\">Matrix</a> e b rows -&gt; <a href=\"Matrix-Type.html#t:Matrix\" title=\"Matrix.Type\">Matrix</a> e (<a href=\"/package/base-4.12.0.0/docs/Data-Either.html#t:Either\" title=\"Data.Either\">Either</a> a b) rows","name":"|||","module":"Matrix.Type","link":"Matrix-Type.html#v:-124--124--124-"},{"display_html":"<a href=\"#v:i1\">i1</a> :: (<a href=\"/package/base-4.12.0.0/docs/Prelude.html#t:Num\" title=\"Prelude\">Num</a> e, <a href=\"/package/base-4.12.0.0/docs/GHC-TypeNats.html#t:KnownNat\" title=\"GHC.TypeNats\">KnownNat</a> (<a href=\"Matrix-Type.html#t:Count\" title=\"Matrix.Type\">Count</a> (<a href=\"Matrix-Type.html#t:Normalize\" title=\"Matrix.Type\">Normalize</a> n)), <a href=\"/package/base-4.12.0.0/docs/GHC-TypeNats.html#t:KnownNat\" title=\"GHC.TypeNats\">KnownNat</a> (<a href=\"Matrix-Type.html#t:Count\" title=\"Matrix.Type\">Count</a> (<a href=\"Matrix-Type.html#t:Normalize\" title=\"Matrix.Type\">Normalize</a> m)), <a href=\"Matrix-Type.html#t:FromLists\" title=\"Matrix.Type\">FromLists</a> e (<a href=\"Matrix-Type.html#t:Normalize\" title=\"Matrix.Type\">Normalize</a> n) (<a href=\"Matrix-Type.html#t:Normalize\" title=\"Matrix.Type\">Normalize</a> m), <a href=\"Matrix-Type.html#t:FromLists\" title=\"Matrix.Type\">FromLists</a> e (<a href=\"Matrix-Type.html#t:Normalize\" title=\"Matrix.Type\">Normalize</a> m) (<a href=\"Matrix-Type.html#t:Normalize\" title=\"Matrix.Type\">Normalize</a> m), <a href=\"Matrix-Type.html#t:Normalize\" title=\"Matrix.Type\">Normalize</a> (<a href=\"/package/base-4.12.0.0/docs/Data-Either.html#t:Either\" title=\"Data.Either\">Either</a> m n) ~ <a href=\"/package/base-4.12.0.0/docs/Data-Either.html#t:Either\" title=\"Data.Either\">Either</a> (<a href=\"Matrix-Type.html#t:Normalize\" title=\"Matrix.Type\">Normalize</a> m) (<a href=\"Matrix-Type.html#t:Normalize\" title=\"Matrix.Type\">Normalize</a> n)) =&gt; <a href=\"Matrix-Type.html#t:Matrix\" title=\"Matrix.Type\">Matrix</a> e m (<a href=\"/package/base-4.12.0.0/docs/Data-Either.html#t:Either\" title=\"Data.Either\">Either</a> m n)","name":"i1","module":"Matrix.Type","link":"Matrix-Type.html#v:i1"},{"display_html":"<a href=\"#v:i2\">i2</a> :: (<a href=\"/package/base-4.12.0.0/docs/Prelude.html#t:Num\" title=\"Prelude\">Num</a> e, <a href=\"/package/base-4.12.0.0/docs/GHC-TypeNats.html#t:KnownNat\" title=\"GHC.TypeNats\">KnownNat</a> (<a href=\"Matrix-Type.html#t:Count\" title=\"Matrix.Type\">Count</a> (<a href=\"Matrix-Type.html#t:Normalize\" title=\"Matrix.Type\">Normalize</a> n)), <a href=\"/package/base-4.12.0.0/docs/GHC-TypeNats.html#t:KnownNat\" title=\"GHC.TypeNats\">KnownNat</a> (<a href=\"Matrix-Type.html#t:Count\" title=\"Matrix.Type\">Count</a> (<a href=\"Matrix-Type.html#t:Normalize\" title=\"Matrix.Type\">Normalize</a> m)), <a href=\"Matrix-Type.html#t:FromLists\" title=\"Matrix.Type\">FromLists</a> e (<a href=\"Matrix-Type.html#t:Normalize\" title=\"Matrix.Type\">Normalize</a> m) (<a href=\"Matrix-Type.html#t:Normalize\" title=\"Matrix.Type\">Normalize</a> n), <a href=\"Matrix-Type.html#t:FromLists\" title=\"Matrix.Type\">FromLists</a> e (<a href=\"Matrix-Type.html#t:Normalize\" title=\"Matrix.Type\">Normalize</a> n) (<a href=\"Matrix-Type.html#t:Normalize\" title=\"Matrix.Type\">Normalize</a> n), <a href=\"Matrix-Type.html#t:Normalize\" title=\"Matrix.Type\">Normalize</a> (<a href=\"/package/base-4.12.0.0/docs/Data-Either.html#t:Either\" title=\"Data.Either\">Either</a> m n) ~ <a href=\"/package/base-4.12.0.0/docs/Data-Either.html#t:Either\" title=\"Data.Either\">Either</a> (<a href=\"Matrix-Type.html#t:Normalize\" title=\"Matrix.Type\">Normalize</a> m) (<a href=\"Matrix-Type.html#t:Normalize\" title=\"Matrix.Type\">Normalize</a> n)) =&gt; <a href=\"Matrix-Type.html#t:Matrix\" title=\"Matrix.Type\">Matrix</a> e n (<a href=\"/package/base-4.12.0.0/docs/Data-Either.html#t:Either\" title=\"Data.Either\">Either</a> m n)","name":"i2","module":"Matrix.Type","link":"Matrix-Type.html#v:i2"},{"display_html":"<a href=\"#v:-45--124--45-\">(-|-)</a> :: (<a href=\"/package/base-4.12.0.0/docs/Prelude.html#t:Num\" title=\"Prelude\">Num</a> e, <a href=\"/package/base-4.12.0.0/docs/GHC-TypeNats.html#t:KnownNat\" title=\"GHC.TypeNats\">KnownNat</a> (<a href=\"Matrix-Type.html#t:Count\" title=\"Matrix.Type\">Count</a> (<a href=\"Matrix-Type.html#t:Normalize\" title=\"Matrix.Type\">Normalize</a> j)), <a href=\"/package/base-4.12.0.0/docs/GHC-TypeNats.html#t:KnownNat\" title=\"GHC.TypeNats\">KnownNat</a> (<a href=\"Matrix-Type.html#t:Count\" title=\"Matrix.Type\">Count</a> (<a href=\"Matrix-Type.html#t:Normalize\" title=\"Matrix.Type\">Normalize</a> k)), <a href=\"Matrix-Type.html#t:FromLists\" title=\"Matrix.Type\">FromLists</a> e (<a href=\"Matrix-Type.html#t:Normalize\" title=\"Matrix.Type\">Normalize</a> k) (<a href=\"Matrix-Type.html#t:Normalize\" title=\"Matrix.Type\">Normalize</a> k), <a href=\"Matrix-Type.html#t:FromLists\" title=\"Matrix.Type\">FromLists</a> e (<a href=\"Matrix-Type.html#t:Normalize\" title=\"Matrix.Type\">Normalize</a> j) (<a href=\"Matrix-Type.html#t:Normalize\" title=\"Matrix.Type\">Normalize</a> k), <a href=\"Matrix-Type.html#t:FromLists\" title=\"Matrix.Type\">FromLists</a> e (<a href=\"Matrix-Type.html#t:Normalize\" title=\"Matrix.Type\">Normalize</a> k) (<a href=\"Matrix-Type.html#t:Normalize\" title=\"Matrix.Type\">Normalize</a> j), <a href=\"Matrix-Type.html#t:FromLists\" title=\"Matrix.Type\">FromLists</a> e (<a href=\"Matrix-Type.html#t:Normalize\" title=\"Matrix.Type\">Normalize</a> j) (<a href=\"Matrix-Type.html#t:Normalize\" title=\"Matrix.Type\">Normalize</a> j), <a href=\"Matrix-Type.html#t:Normalize\" title=\"Matrix.Type\">Normalize</a> (<a href=\"/package/base-4.12.0.0/docs/Data-Either.html#t:Either\" title=\"Data.Either\">Either</a> n m) ~ <a href=\"/package/base-4.12.0.0/docs/Data-Either.html#t:Either\" title=\"Data.Either\">Either</a> (<a href=\"Matrix-Type.html#t:Normalize\" title=\"Matrix.Type\">Normalize</a> n) (<a href=\"Matrix-Type.html#t:Normalize\" title=\"Matrix.Type\">Normalize</a> m), <a href=\"Matrix-Type.html#t:Normalize\" title=\"Matrix.Type\">Normalize</a> (<a href=\"/package/base-4.12.0.0/docs/Data-Either.html#t:Either\" title=\"Data.Either\">Either</a> k j) ~ <a href=\"/package/base-4.12.0.0/docs/Data-Either.html#t:Either\" title=\"Data.Either\">Either</a> (<a href=\"Matrix-Type.html#t:Normalize\" title=\"Matrix.Type\">Normalize</a> k) (<a href=\"Matrix-Type.html#t:Normalize\" title=\"Matrix.Type\">Normalize</a> j)) =&gt; <a href=\"Matrix-Type.html#t:Matrix\" title=\"Matrix.Type\">Matrix</a> e n k -&gt; <a href=\"Matrix-Type.html#t:Matrix\" title=\"Matrix.Type\">Matrix</a> e m j -&gt; <a href=\"Matrix-Type.html#t:Matrix\" title=\"Matrix.Type\">Matrix</a> e (<a href=\"/package/base-4.12.0.0/docs/Data-Either.html#t:Either\" title=\"Data.Either\">Either</a> n m) (<a href=\"/package/base-4.12.0.0/docs/Data-Either.html#t:Either\" title=\"Data.Either\">Either</a> k j)","name":"-|-","module":"Matrix.Type","link":"Matrix-Type.html#v:-45--124--45-"},{"display_html":"<a href=\"#v:-62--60-\">(&gt;&lt;)</a> :: <span class=\"keyword\">forall</span> e m p n q. (<a href=\"/package/base-4.12.0.0/docs/Prelude.html#t:Num\" title=\"Prelude\">Num</a> e, <a href=\"/package/base-4.12.0.0/docs/GHC-TypeNats.html#t:KnownNat\" title=\"GHC.TypeNats\">KnownNat</a> (<a href=\"Matrix-Type.html#t:Count\" title=\"Matrix.Type\">Count</a> (<a href=\"Matrix-Type.html#t:Normalize\" title=\"Matrix.Type\">Normalize</a> m)), <a href=\"/package/base-4.12.0.0/docs/GHC-TypeNats.html#t:KnownNat\" title=\"GHC.TypeNats\">KnownNat</a> (<a href=\"Matrix-Type.html#t:Count\" title=\"Matrix.Type\">Count</a> (<a href=\"Matrix-Type.html#t:Normalize\" title=\"Matrix.Type\">Normalize</a> n)), <a href=\"/package/base-4.12.0.0/docs/GHC-TypeNats.html#t:KnownNat\" title=\"GHC.TypeNats\">KnownNat</a> (<a href=\"Matrix-Type.html#t:Count\" title=\"Matrix.Type\">Count</a> (<a href=\"Matrix-Type.html#t:Normalize\" title=\"Matrix.Type\">Normalize</a> p)), <a href=\"/package/base-4.12.0.0/docs/GHC-TypeNats.html#t:KnownNat\" title=\"GHC.TypeNats\">KnownNat</a> (<a href=\"Matrix-Type.html#t:Count\" title=\"Matrix.Type\">Count</a> (<a href=\"Matrix-Type.html#t:Normalize\" title=\"Matrix.Type\">Normalize</a> q)), <a href=\"/package/base-4.12.0.0/docs/GHC-TypeNats.html#t:KnownNat\" title=\"GHC.TypeNats\">KnownNat</a> (<a href=\"Matrix-Type.html#t:Count\" title=\"Matrix.Type\">Count</a> (<a href=\"Matrix-Type.html#t:Normalize\" title=\"Matrix.Type\">Normalize</a> (m, n))), <a href=\"/package/base-4.12.0.0/docs/GHC-TypeNats.html#t:KnownNat\" title=\"GHC.TypeNats\">KnownNat</a> (<a href=\"Matrix-Type.html#t:Count\" title=\"Matrix.Type\">Count</a> (<a href=\"Matrix-Type.html#t:Normalize\" title=\"Matrix.Type\">Normalize</a> (p, q))), <a href=\"Matrix-Type.html#t:FromLists\" title=\"Matrix.Type\">FromLists</a> e (<a href=\"Matrix-Type.html#t:Normalize\" title=\"Matrix.Type\">Normalize</a> (m, n)) (<a href=\"Matrix-Type.html#t:Normalize\" title=\"Matrix.Type\">Normalize</a> m), <a href=\"Matrix-Type.html#t:FromLists\" title=\"Matrix.Type\">FromLists</a> e (<a href=\"Matrix-Type.html#t:Normalize\" title=\"Matrix.Type\">Normalize</a> (m, n)) (<a href=\"Matrix-Type.html#t:Normalize\" title=\"Matrix.Type\">Normalize</a> n), <a href=\"Matrix-Type.html#t:FromLists\" title=\"Matrix.Type\">FromLists</a> e (<a href=\"Matrix-Type.html#t:Normalize\" title=\"Matrix.Type\">Normalize</a> (p, q)) (<a href=\"Matrix-Type.html#t:Normalize\" title=\"Matrix.Type\">Normalize</a> p), <a href=\"Matrix-Type.html#t:FromLists\" title=\"Matrix.Type\">FromLists</a> e (<a href=\"Matrix-Type.html#t:Normalize\" title=\"Matrix.Type\">Normalize</a> (p, q)) (<a href=\"Matrix-Type.html#t:Normalize\" title=\"Matrix.Type\">Normalize</a> q), <a href=\"Matrix-Type.html#t:Normalize\" title=\"Matrix.Type\">Normalize</a> (m, n) ~ <a href=\"Matrix-Type.html#t:Normalize\" title=\"Matrix.Type\">Normalize</a> (<a href=\"Matrix-Type.html#t:Normalize\" title=\"Matrix.Type\">Normalize</a> m, <a href=\"Matrix-Type.html#t:Normalize\" title=\"Matrix.Type\">Normalize</a> n), <a href=\"Matrix-Type.html#t:Normalize\" title=\"Matrix.Type\">Normalize</a> (p, q) ~ <a href=\"Matrix-Type.html#t:Normalize\" title=\"Matrix.Type\">Normalize</a> (<a href=\"Matrix-Type.html#t:Normalize\" title=\"Matrix.Type\">Normalize</a> p, <a href=\"Matrix-Type.html#t:Normalize\" title=\"Matrix.Type\">Normalize</a> q)) =&gt; <a href=\"Matrix-Type.html#t:Matrix\" title=\"Matrix.Type\">Matrix</a> e m p -&gt; <a href=\"Matrix-Type.html#t:Matrix\" title=\"Matrix.Type\">Matrix</a> e n q -&gt; <a href=\"Matrix-Type.html#t:Matrix\" title=\"Matrix.Type\">Matrix</a> e (m, n) (p, q)","name":"><","module":"Matrix.Type","link":"Matrix-Type.html#v:-62--60-"},{"display_html":"<a href=\"#v:kp1\">kp1</a> :: <span class=\"keyword\">forall</span> e m k. (<a href=\"/package/base-4.12.0.0/docs/Prelude.html#t:Num\" title=\"Prelude\">Num</a> e, <a href=\"/package/base-4.12.0.0/docs/GHC-TypeNats.html#t:KnownNat\" title=\"GHC.TypeNats\">KnownNat</a> (<a href=\"Matrix-Type.html#t:Count\" title=\"Matrix.Type\">Count</a> (<a href=\"Matrix-Type.html#t:Normalize\" title=\"Matrix.Type\">Normalize</a> m)), <a href=\"/package/base-4.12.0.0/docs/GHC-TypeNats.html#t:KnownNat\" title=\"GHC.TypeNats\">KnownNat</a> (<a href=\"Matrix-Type.html#t:Count\" title=\"Matrix.Type\">Count</a> (<a href=\"Matrix-Type.html#t:Normalize\" title=\"Matrix.Type\">Normalize</a> k)), <a href=\"/package/base-4.12.0.0/docs/GHC-TypeNats.html#t:KnownNat\" title=\"GHC.TypeNats\">KnownNat</a> (<a href=\"Matrix-Type.html#t:Count\" title=\"Matrix.Type\">Count</a> (<a href=\"Matrix-Type.html#t:Normalize\" title=\"Matrix.Type\">Normalize</a> (m, k))), <a href=\"Matrix-Type.html#t:FromLists\" title=\"Matrix.Type\">FromLists</a> e (<a href=\"Matrix-Type.html#t:Normalize\" title=\"Matrix.Type\">Normalize</a> (m, k)) (<a href=\"Matrix-Type.html#t:Normalize\" title=\"Matrix.Type\">Normalize</a> m), <a href=\"Matrix-Type.html#t:Normalize\" title=\"Matrix.Type\">Normalize</a> (m, k) ~ <a href=\"Matrix-Type.html#t:Normalize\" title=\"Matrix.Type\">Normalize</a> (<a href=\"Matrix-Type.html#t:Normalize\" title=\"Matrix.Type\">Normalize</a> m, <a href=\"Matrix-Type.html#t:Normalize\" title=\"Matrix.Type\">Normalize</a> k)) =&gt; <a href=\"Matrix-Type.html#t:Matrix\" title=\"Matrix.Type\">Matrix</a> e (m, k) m","name":"kp1","module":"Matrix.Type","link":"Matrix-Type.html#v:kp1"},{"display_html":"<a href=\"#v:kp2\">kp2</a> :: <span class=\"keyword\">forall</span> e m k. (<a href=\"/package/base-4.12.0.0/docs/Prelude.html#t:Num\" title=\"Prelude\">Num</a> e, <a href=\"/package/base-4.12.0.0/docs/GHC-TypeNats.html#t:KnownNat\" title=\"GHC.TypeNats\">KnownNat</a> (<a href=\"Matrix-Type.html#t:Count\" title=\"Matrix.Type\">Count</a> (<a href=\"Matrix-Type.html#t:Normalize\" title=\"Matrix.Type\">Normalize</a> k)), <a href=\"/package/base-4.12.0.0/docs/GHC-TypeNats.html#t:KnownNat\" title=\"GHC.TypeNats\">KnownNat</a> (<a href=\"Matrix-Type.html#t:Count\" title=\"Matrix.Type\">Count</a> (<a href=\"Matrix-Type.html#t:Normalize\" title=\"Matrix.Type\">Normalize</a> m)), <a href=\"/package/base-4.12.0.0/docs/GHC-TypeNats.html#t:KnownNat\" title=\"GHC.TypeNats\">KnownNat</a> (<a href=\"Matrix-Type.html#t:Count\" title=\"Matrix.Type\">Count</a> (<a href=\"Matrix-Type.html#t:Normalize\" title=\"Matrix.Type\">Normalize</a> (m, k))), <a href=\"Matrix-Type.html#t:FromLists\" title=\"Matrix.Type\">FromLists</a> e (<a href=\"Matrix-Type.html#t:Normalize\" title=\"Matrix.Type\">Normalize</a> (m, k)) (<a href=\"Matrix-Type.html#t:Normalize\" title=\"Matrix.Type\">Normalize</a> k), <a href=\"Matrix-Type.html#t:Normalize\" title=\"Matrix.Type\">Normalize</a> (m, k) ~ <a href=\"Matrix-Type.html#t:Normalize\" title=\"Matrix.Type\">Normalize</a> (<a href=\"Matrix-Type.html#t:Normalize\" title=\"Matrix.Type\">Normalize</a> m, <a href=\"Matrix-Type.html#t:Normalize\" title=\"Matrix.Type\">Normalize</a> k)) =&gt; <a href=\"Matrix-Type.html#t:Matrix\" title=\"Matrix.Type\">Matrix</a> e (m, k) k","name":"kp2","module":"Matrix.Type","link":"Matrix-Type.html#v:kp2"},{"display_html":"<a href=\"#v:khatri\">khatri</a> :: <span class=\"keyword\">forall</span> e cols a b. (<a href=\"/package/base-4.12.0.0/docs/Prelude.html#t:Num\" title=\"Prelude\">Num</a> e, <a href=\"/package/base-4.12.0.0/docs/GHC-TypeNats.html#t:KnownNat\" title=\"GHC.TypeNats\">KnownNat</a> (<a href=\"Matrix-Type.html#t:Count\" title=\"Matrix.Type\">Count</a> (<a href=\"Matrix-Type.html#t:Normalize\" title=\"Matrix.Type\">Normalize</a> a)), <a href=\"/package/base-4.12.0.0/docs/GHC-TypeNats.html#t:KnownNat\" title=\"GHC.TypeNats\">KnownNat</a> (<a href=\"Matrix-Type.html#t:Count\" title=\"Matrix.Type\">Count</a> (<a href=\"Matrix-Type.html#t:Normalize\" title=\"Matrix.Type\">Normalize</a> b)), <a href=\"/package/base-4.12.0.0/docs/GHC-TypeNats.html#t:KnownNat\" title=\"GHC.TypeNats\">KnownNat</a> (<a href=\"Matrix-Type.html#t:Count\" title=\"Matrix.Type\">Count</a> (<a href=\"Matrix-Type.html#t:Normalize\" title=\"Matrix.Type\">Normalize</a> (a, b))), <a href=\"Matrix-Type.html#t:FromLists\" title=\"Matrix.Type\">FromLists</a> e (<a href=\"Matrix-Type.html#t:Normalize\" title=\"Matrix.Type\">Normalize</a> (a, b)) (<a href=\"Matrix-Type.html#t:Normalize\" title=\"Matrix.Type\">Normalize</a> a), <a href=\"Matrix-Type.html#t:FromLists\" title=\"Matrix.Type\">FromLists</a> e (<a href=\"Matrix-Type.html#t:Normalize\" title=\"Matrix.Type\">Normalize</a> (a, b)) (<a href=\"Matrix-Type.html#t:Normalize\" title=\"Matrix.Type\">Normalize</a> b), <a href=\"Matrix-Type.html#t:Normalize\" title=\"Matrix.Type\">Normalize</a> (a, b) ~ <a href=\"Matrix-Type.html#t:Normalize\" title=\"Matrix.Type\">Normalize</a> (<a href=\"Matrix-Type.html#t:Normalize\" title=\"Matrix.Type\">Normalize</a> a, <a href=\"Matrix-Type.html#t:Normalize\" title=\"Matrix.Type\">Normalize</a> b)) =&gt; <a href=\"Matrix-Type.html#t:Matrix\" title=\"Matrix.Type\">Matrix</a> e cols a -&gt; <a href=\"Matrix-Type.html#t:Matrix\" title=\"Matrix.Type\">Matrix</a> e cols b -&gt; <a href=\"Matrix-Type.html#t:Matrix\" title=\"Matrix.Type\">Matrix</a> e cols (a, b)","name":"khatri","module":"Matrix.Type","link":"Matrix-Type.html#v:khatri"},{"display_html":"<a href=\"#v:identity\">identity</a> :: (<a href=\"/package/base-4.12.0.0/docs/Prelude.html#t:Num\" title=\"Prelude\">Num</a> e, <a href=\"Matrix-Type.html#t:FromLists\" title=\"Matrix.Type\">FromLists</a> e (<a href=\"Matrix-Type.html#t:Normalize\" title=\"Matrix.Type\">Normalize</a> a) (<a href=\"Matrix-Type.html#t:Normalize\" title=\"Matrix.Type\">Normalize</a> a), <a href=\"/package/base-4.12.0.0/docs/GHC-TypeNats.html#t:KnownNat\" title=\"GHC.TypeNats\">KnownNat</a> (<a href=\"Matrix-Type.html#t:Count\" title=\"Matrix.Type\">Count</a> (<a href=\"Matrix-Type.html#t:Normalize\" title=\"Matrix.Type\">Normalize</a> a))) =&gt; <a href=\"Matrix-Type.html#t:Matrix\" title=\"Matrix.Type\">Matrix</a> e a a","name":"identity","module":"Matrix.Type","link":"Matrix-Type.html#v:identity"},{"display_html":"<a href=\"#v:comp\">comp</a> :: <a href=\"/package/base-4.12.0.0/docs/Prelude.html#t:Num\" title=\"Prelude\">Num</a> e =&gt; <a href=\"Matrix-Type.html#t:Matrix\" title=\"Matrix.Type\">Matrix</a> e cr rows -&gt; <a href=\"Matrix-Type.html#t:Matrix\" title=\"Matrix.Type\">Matrix</a> e cols cr -&gt; <a href=\"Matrix-Type.html#t:Matrix\" title=\"Matrix.Type\">Matrix</a> e cols rows","name":"comp","module":"Matrix.Type","link":"Matrix-Type.html#v:comp"},{"display_html":"<a href=\"#v:fromF\">fromF</a> :: (<a href=\"/package/base-4.12.0.0/docs/Prelude.html#t:Bounded\" title=\"Prelude\">Bounded</a> a, <a href=\"/package/base-4.12.0.0/docs/Prelude.html#t:Bounded\" title=\"Prelude\">Bounded</a> b, <a href=\"/package/base-4.12.0.0/docs/Prelude.html#t:Enum\" title=\"Prelude\">Enum</a> a, <a href=\"/package/base-4.12.0.0/docs/Prelude.html#t:Enum\" title=\"Prelude\">Enum</a> b, <a href=\"/package/base-4.12.0.0/docs/Data-Eq.html#t:Eq\" title=\"Data.Eq\">Eq</a> b, <a href=\"/package/base-4.12.0.0/docs/Prelude.html#t:Num\" title=\"Prelude\">Num</a> e, <a href=\"/package/base-4.12.0.0/docs/Data-Ord.html#t:Ord\" title=\"Data.Ord\">Ord</a> e, <a href=\"/package/base-4.12.0.0/docs/GHC-TypeNats.html#t:KnownNat\" title=\"GHC.TypeNats\">KnownNat</a> (<a href=\"Matrix-Type.html#t:Count\" title=\"Matrix.Type\">Count</a> (<a href=\"Matrix-Type.html#t:Normalize\" title=\"Matrix.Type\">Normalize</a> cols)), <a href=\"/package/base-4.12.0.0/docs/GHC-TypeNats.html#t:KnownNat\" title=\"GHC.TypeNats\">KnownNat</a> (<a href=\"Matrix-Type.html#t:Count\" title=\"Matrix.Type\">Count</a> (<a href=\"Matrix-Type.html#t:Normalize\" title=\"Matrix.Type\">Normalize</a> rows)), <a href=\"Matrix-Type.html#t:FromLists\" title=\"Matrix.Type\">FromLists</a> e (<a href=\"Matrix-Type.html#t:Normalize\" title=\"Matrix.Type\">Normalize</a> rows) (<a href=\"Matrix-Type.html#t:Normalize\" title=\"Matrix.Type\">Normalize</a> cols)) =&gt; (a -&gt; b) -&gt; <a href=\"Matrix-Type.html#t:Matrix\" title=\"Matrix.Type\">Matrix</a> e cols rows","name":"fromF","module":"Matrix.Type","link":"Matrix-Type.html#v:fromF"},{"display_html":"<a href=\"#v:fromF-39-\">fromF'</a> :: (<a href=\"/package/base-4.12.0.0/docs/Prelude.html#t:Bounded\" title=\"Prelude\">Bounded</a> a, <a href=\"/package/base-4.12.0.0/docs/Prelude.html#t:Bounded\" title=\"Prelude\">Bounded</a> b, <a href=\"/package/base-4.12.0.0/docs/Prelude.html#t:Enum\" title=\"Prelude\">Enum</a> a, <a href=\"/package/base-4.12.0.0/docs/Prelude.html#t:Enum\" title=\"Prelude\">Enum</a> b, <a href=\"/package/base-4.12.0.0/docs/Data-Eq.html#t:Eq\" title=\"Data.Eq\">Eq</a> b, <a href=\"/package/base-4.12.0.0/docs/Prelude.html#t:Num\" title=\"Prelude\">Num</a> e, <a href=\"/package/base-4.12.0.0/docs/Data-Ord.html#t:Ord\" title=\"Data.Ord\">Ord</a> e, <a href=\"/package/base-4.12.0.0/docs/GHC-TypeNats.html#t:KnownNat\" title=\"GHC.TypeNats\">KnownNat</a> (<a href=\"Matrix-Type.html#t:Count\" title=\"Matrix.Type\">Count</a> (<a href=\"Matrix-Type.html#t:Normalize\" title=\"Matrix.Type\">Normalize</a> a)), <a href=\"/package/base-4.12.0.0/docs/GHC-TypeNats.html#t:KnownNat\" title=\"GHC.TypeNats\">KnownNat</a> (<a href=\"Matrix-Type.html#t:Count\" title=\"Matrix.Type\">Count</a> (<a href=\"Matrix-Type.html#t:Normalize\" title=\"Matrix.Type\">Normalize</a> b)), <a href=\"Matrix-Type.html#t:FromLists\" title=\"Matrix.Type\">FromLists</a> e (<a href=\"Matrix-Type.html#t:Normalize\" title=\"Matrix.Type\">Normalize</a> b) (<a href=\"Matrix-Type.html#t:Normalize\" title=\"Matrix.Type\">Normalize</a> a)) =&gt; (a -&gt; b) -&gt; <a href=\"Matrix-Type.html#t:Matrix\" title=\"Matrix.Type\">Matrix</a> e a b","name":"fromF'","module":"Matrix.Type","link":"Matrix-Type.html#v:fromF-39-"},{"display_html":"<a href=\"#v:pretty\">pretty</a> :: (<a href=\"/package/base-4.12.0.0/docs/GHC-TypeNats.html#t:KnownNat\" title=\"GHC.TypeNats\">KnownNat</a> (<a href=\"Matrix-Type.html#t:Count\" title=\"Matrix.Type\">Count</a> (<a href=\"Matrix-Type.html#t:Normalize\" title=\"Matrix.Type\">Normalize</a> cols)), <a href=\"/package/base-4.12.0.0/docs/Text-Show.html#t:Show\" title=\"Text.Show\">Show</a> e) =&gt; <a href=\"Matrix-Type.html#t:Matrix\" title=\"Matrix.Type\">Matrix</a> e cols rows -&gt; <a href=\"/package/base-4.12.0.0/docs/Data-String.html#t:String\" title=\"Data.String\">String</a>","name":"pretty","module":"Matrix.Type","link":"Matrix-Type.html#v:pretty"},{"display_html":"<a href=\"#v:prettyPrint\">prettyPrint</a> :: (<a href=\"/package/base-4.12.0.0/docs/GHC-TypeNats.html#t:KnownNat\" title=\"GHC.TypeNats\">KnownNat</a> (<a href=\"Matrix-Type.html#t:Count\" title=\"Matrix.Type\">Count</a> (<a href=\"Matrix-Type.html#t:Normalize\" title=\"Matrix.Type\">Normalize</a> cols)), <a href=\"/package/base-4.12.0.0/docs/Text-Show.html#t:Show\" title=\"Text.Show\">Show</a> e) =&gt; <a href=\"Matrix-Type.html#t:Matrix\" title=\"Matrix.Type\">Matrix</a> e cols rows -&gt; <a href=\"/package/base-4.12.0.0/docs/System-IO.html#t:IO\" title=\"System.IO\">IO</a> ()","name":"prettyPrint","module":"Matrix.Type","link":"Matrix-Type.html#v:prettyPrint"},{"display_html":"<span class=\"keyword\">newtype</span> <a href=\"#t:Matrix\">Matrix</a> e (cols :: <a href=\"/package/base-4.12.0.0/docs/GHC-TypeNats.html#t:Nat\" title=\"GHC.TypeNats\">Nat</a>) (rows :: <a href=\"/package/base-4.12.0.0/docs/GHC-TypeNats.html#t:Nat\" title=\"GHC.TypeNats\">Nat</a>) = <a href=\"#v:M\">M</a> (Matrix e (<a href=\"Matrix-Nat.html#t:FromNat\" title=\"Matrix.Nat\">FromNat</a> cols) (<a href=\"Matrix-Nat.html#t:FromNat\" title=\"Matrix.Nat\">FromNat</a> rows))","name":"Matrix M","module":"Matrix.Nat","link":"Matrix-Nat.html#t:Matrix"},{"display_html":"<a href=\"#v:empty\">empty</a> :: <a href=\"Matrix-Nat.html#t:Matrix\" title=\"Matrix.Nat\">Matrix</a> e 0 0","name":"empty","module":"Matrix.Nat","link":"Matrix-Nat.html#v:empty"},{"display_html":"<a href=\"#v:one\">one</a> :: e -&gt; <a href=\"Matrix-Nat.html#t:Matrix\" title=\"Matrix.Nat\">Matrix</a> e 1 1","name":"one","module":"Matrix.Nat","link":"Matrix-Nat.html#v:one"},{"display_html":"<a href=\"#v:junc\">junc</a> :: <a href=\"Matrix-Nat.html#t:FromNat\" title=\"Matrix.Nat\">FromNat</a> cols3 ~ <a href=\"/package/base-4.12.0.0/docs/Data-Either.html#t:Either\" title=\"Data.Either\">Either</a> (<a href=\"Matrix-Nat.html#t:FromNat\" title=\"Matrix.Nat\">FromNat</a> cols1) (<a href=\"Matrix-Nat.html#t:FromNat\" title=\"Matrix.Nat\">FromNat</a> cols2) =&gt; <a href=\"Matrix-Nat.html#t:Matrix\" title=\"Matrix.Nat\">Matrix</a> e cols1 rows -&gt; <a href=\"Matrix-Nat.html#t:Matrix\" title=\"Matrix.Nat\">Matrix</a> e cols2 rows -&gt; <a href=\"Matrix-Nat.html#t:Matrix\" title=\"Matrix.Nat\">Matrix</a> e cols3 rows","name":"junc","module":"Matrix.Nat","link":"Matrix-Nat.html#v:junc"},{"display_html":"<a href=\"#v:split\">split</a> :: <a href=\"Matrix-Nat.html#t:FromNat\" title=\"Matrix.Nat\">FromNat</a> rows3 ~ <a href=\"/package/base-4.12.0.0/docs/Data-Either.html#t:Either\" title=\"Data.Either\">Either</a> (<a href=\"Matrix-Nat.html#t:FromNat\" title=\"Matrix.Nat\">FromNat</a> rows1) (<a href=\"Matrix-Nat.html#t:FromNat\" title=\"Matrix.Nat\">FromNat</a> rows2) =&gt; <a href=\"Matrix-Nat.html#t:Matrix\" title=\"Matrix.Nat\">Matrix</a> e cols rows1 -&gt; <a href=\"Matrix-Nat.html#t:Matrix\" title=\"Matrix.Nat\">Matrix</a> e cols rows2 -&gt; <a href=\"Matrix-Nat.html#t:Matrix\" title=\"Matrix.Nat\">Matrix</a> e cols rows3","name":"split","module":"Matrix.Nat","link":"Matrix-Nat.html#v:split"},{"display_html":"<span class=\"keyword\">type family</span> <a href=\"#t:FromNat\">FromNat</a> (n :: <a href=\"/package/base-4.12.0.0/docs/GHC-TypeNats.html#t:Nat\" title=\"GHC.TypeNats\">Nat</a>) :: <a href=\"/package/base-4.12.0.0/docs/Data-Kind.html#t:Type\" title=\"Data.Kind\">Type</a> <span class=\"keyword\">where ...</span>","name":"FromNat","module":"Matrix.Nat","link":"Matrix-Nat.html#t:FromNat"},{"display_html":"<span class=\"keyword\">type family</span> <a href=\"#t:Count\">Count</a> (d :: <a href=\"/package/base-4.12.0.0/docs/Data-Kind.html#t:Type\" title=\"Data.Kind\">Type</a>) :: <a href=\"/package/base-4.12.0.0/docs/GHC-TypeNats.html#t:Nat\" title=\"GHC.TypeNats\">Nat</a> <span class=\"keyword\">where ...</span>","name":"Count","module":"Matrix.Nat","link":"Matrix-Nat.html#t:Count"},{"display_html":"<span class=\"keyword\">type family</span> <a href=\"#t:Normalize\">Normalize</a> (d :: <a href=\"/package/base-4.12.0.0/docs/Data-Kind.html#t:Type\" title=\"Data.Kind\">Type</a>) :: <a href=\"/package/base-4.12.0.0/docs/Data-Kind.html#t:Type\" title=\"Data.Kind\">Type</a> <span class=\"keyword\">where ...</span>","name":"Normalize","module":"Matrix.Nat","link":"Matrix-Nat.html#t:Normalize"},{"display_html":"<span class=\"keyword\">class</span> <a href=\"#t:FromLists\">FromLists</a> e cols rows","name":"FromLists","module":"Matrix.Nat","link":"Matrix-Nat.html#t:FromLists"},{"display_html":"<a href=\"#v:fromLists\">fromLists</a> :: <a href=\"Matrix-Nat.html#t:FromLists\" title=\"Matrix.Nat\">FromLists</a> e (<a href=\"Matrix-Nat.html#t:FromNat\" title=\"Matrix.Nat\">FromNat</a> cols) (<a href=\"Matrix-Nat.html#t:FromNat\" title=\"Matrix.Nat\">FromNat</a> rows) =&gt; [[e]] -&gt; <a href=\"Matrix-Nat.html#t:Matrix\" title=\"Matrix.Nat\">Matrix</a> e cols rows","name":"fromLists","module":"Matrix.Nat","link":"Matrix-Nat.html#v:fromLists"},{"display_html":"<a href=\"#v:toLists\">toLists</a> :: <a href=\"Matrix-Nat.html#t:Matrix\" title=\"Matrix.Nat\">Matrix</a> e cols rows -&gt; [[e]]","name":"toLists","module":"Matrix.Nat","link":"Matrix-Nat.html#v:toLists"},{"display_html":"<a href=\"#v:toList\">toList</a> :: <a href=\"Matrix-Nat.html#t:Matrix\" title=\"Matrix.Nat\">Matrix</a> e cols rows -&gt; [e]","name":"toList","module":"Matrix.Nat","link":"Matrix-Nat.html#v:toList"},{"display_html":"<a href=\"#v:matrixBuilder\">matrixBuilder</a> :: (<a href=\"Matrix-Nat.html#t:FromLists\" title=\"Matrix.Nat\">FromLists</a> e (<a href=\"Matrix-Nat.html#t:FromNat\" title=\"Matrix.Nat\">FromNat</a> cols) (<a href=\"Matrix-Nat.html#t:FromNat\" title=\"Matrix.Nat\">FromNat</a> rows), <a href=\"/package/base-4.12.0.0/docs/GHC-TypeNats.html#t:KnownNat\" title=\"GHC.TypeNats\">KnownNat</a> (<a href=\"Matrix-Nat.html#t:Count\" title=\"Matrix.Nat\">Count</a> (<a href=\"Matrix-Nat.html#t:FromNat\" title=\"Matrix.Nat\">FromNat</a> cols)), <a href=\"/package/base-4.12.0.0/docs/GHC-TypeNats.html#t:KnownNat\" title=\"GHC.TypeNats\">KnownNat</a> (<a href=\"Matrix-Nat.html#t:Count\" title=\"Matrix.Nat\">Count</a> (<a href=\"Matrix-Nat.html#t:FromNat\" title=\"Matrix.Nat\">FromNat</a> rows))) =&gt; ((<a href=\"/package/base-4.12.0.0/docs/Data-Int.html#t:Int\" title=\"Data.Int\">Int</a>, <a href=\"/package/base-4.12.0.0/docs/Data-Int.html#t:Int\" title=\"Data.Int\">Int</a>) -&gt; e) -&gt; <a href=\"Matrix-Nat.html#t:Matrix\" title=\"Matrix.Nat\">Matrix</a> e cols rows","name":"matrixBuilder","module":"Matrix.Nat","link":"Matrix-Nat.html#v:matrixBuilder"},{"display_html":"<a href=\"#v:row\">row</a> :: <a href=\"Matrix-Nat.html#t:FromLists\" title=\"Matrix.Nat\">FromLists</a> e (<a href=\"Matrix-Nat.html#t:FromNat\" title=\"Matrix.Nat\">FromNat</a> cols) () =&gt; [e] -&gt; <a href=\"Matrix-Nat.html#t:Matrix\" title=\"Matrix.Nat\">Matrix</a> e cols 1","name":"row","module":"Matrix.Nat","link":"Matrix-Nat.html#v:row"},{"display_html":"<a href=\"#v:col\">col</a> :: <a href=\"Matrix-Nat.html#t:FromLists\" title=\"Matrix.Nat\">FromLists</a> e () (<a href=\"Matrix-Nat.html#t:FromNat\" title=\"Matrix.Nat\">FromNat</a> rows) =&gt; [e] -&gt; <a href=\"Matrix-Nat.html#t:Matrix\" title=\"Matrix.Nat\">Matrix</a> e 1 rows","name":"col","module":"Matrix.Nat","link":"Matrix-Nat.html#v:col"},{"display_html":"<a href=\"#v:zeros\">zeros</a> :: (<a href=\"/package/base-4.12.0.0/docs/Prelude.html#t:Num\" title=\"Prelude\">Num</a> e, <a href=\"Matrix-Nat.html#t:FromLists\" title=\"Matrix.Nat\">FromLists</a> e (<a href=\"Matrix-Nat.html#t:FromNat\" title=\"Matrix.Nat\">FromNat</a> cols) (<a href=\"Matrix-Nat.html#t:FromNat\" title=\"Matrix.Nat\">FromNat</a> rows), <a href=\"/package/base-4.12.0.0/docs/GHC-TypeNats.html#t:KnownNat\" title=\"GHC.TypeNats\">KnownNat</a> (<a href=\"Matrix-Nat.html#t:Count\" title=\"Matrix.Nat\">Count</a> (<a href=\"Matrix-Nat.html#t:FromNat\" title=\"Matrix.Nat\">FromNat</a> cols)), <a href=\"/package/base-4.12.0.0/docs/GHC-TypeNats.html#t:KnownNat\" title=\"GHC.TypeNats\">KnownNat</a> (<a href=\"Matrix-Nat.html#t:Count\" title=\"Matrix.Nat\">Count</a> (<a href=\"Matrix-Nat.html#t:FromNat\" title=\"Matrix.Nat\">FromNat</a> rows))) =&gt; <a href=\"Matrix-Nat.html#t:Matrix\" title=\"Matrix.Nat\">Matrix</a> e cols rows","name":"zeros","module":"Matrix.Nat","link":"Matrix-Nat.html#v:zeros"},{"display_html":"<a href=\"#v:ones\">ones</a> :: (<a href=\"/package/base-4.12.0.0/docs/Prelude.html#t:Num\" title=\"Prelude\">Num</a> e, <a href=\"Matrix-Nat.html#t:FromLists\" title=\"Matrix.Nat\">FromLists</a> e (<a href=\"Matrix-Nat.html#t:FromNat\" title=\"Matrix.Nat\">FromNat</a> cols) (<a href=\"Matrix-Nat.html#t:FromNat\" title=\"Matrix.Nat\">FromNat</a> rows), <a href=\"/package/base-4.12.0.0/docs/GHC-TypeNats.html#t:KnownNat\" title=\"GHC.TypeNats\">KnownNat</a> (<a href=\"Matrix-Nat.html#t:Count\" title=\"Matrix.Nat\">Count</a> (<a href=\"Matrix-Nat.html#t:FromNat\" title=\"Matrix.Nat\">FromNat</a> cols)), <a href=\"/package/base-4.12.0.0/docs/GHC-TypeNats.html#t:KnownNat\" title=\"GHC.TypeNats\">KnownNat</a> (<a href=\"Matrix-Nat.html#t:Count\" title=\"Matrix.Nat\">Count</a> (<a href=\"Matrix-Nat.html#t:FromNat\" title=\"Matrix.Nat\">FromNat</a> rows))) =&gt; <a href=\"Matrix-Nat.html#t:Matrix\" title=\"Matrix.Nat\">Matrix</a> e cols rows","name":"ones","module":"Matrix.Nat","link":"Matrix-Nat.html#v:ones"},{"display_html":"<a href=\"#v:bang\">bang</a> :: <span class=\"keyword\">forall</span> e cols. (<a href=\"/package/base-4.12.0.0/docs/Prelude.html#t:Num\" title=\"Prelude\">Num</a> e, <a href=\"/package/base-4.12.0.0/docs/Prelude.html#t:Enum\" title=\"Prelude\">Enum</a> e, <a href=\"Matrix-Nat.html#t:FromLists\" title=\"Matrix.Nat\">FromLists</a> e (<a href=\"Matrix-Nat.html#t:FromNat\" title=\"Matrix.Nat\">FromNat</a> cols) (), <a href=\"/package/base-4.12.0.0/docs/GHC-TypeNats.html#t:KnownNat\" title=\"GHC.TypeNats\">KnownNat</a> (<a href=\"Matrix-Nat.html#t:Count\" title=\"Matrix.Nat\">Count</a> (<a href=\"Matrix-Nat.html#t:FromNat\" title=\"Matrix.Nat\">FromNat</a> cols))) =&gt; <a href=\"Matrix-Nat.html#t:Matrix\" title=\"Matrix.Nat\">Matrix</a> e cols 1","name":"bang","module":"Matrix.Nat","link":"Matrix-Nat.html#v:bang"},{"display_html":"<a href=\"#v:constant\">constant</a> :: (<a href=\"/package/base-4.12.0.0/docs/Prelude.html#t:Num\" title=\"Prelude\">Num</a> e, <a href=\"Matrix-Nat.html#t:FromLists\" title=\"Matrix.Nat\">FromLists</a> e (<a href=\"Matrix-Nat.html#t:FromNat\" title=\"Matrix.Nat\">FromNat</a> cols) (<a href=\"Matrix-Nat.html#t:FromNat\" title=\"Matrix.Nat\">FromNat</a> rows), <a href=\"/package/base-4.12.0.0/docs/GHC-TypeNats.html#t:KnownNat\" title=\"GHC.TypeNats\">KnownNat</a> (<a href=\"Matrix-Nat.html#t:Count\" title=\"Matrix.Nat\">Count</a> (<a href=\"Matrix-Nat.html#t:FromNat\" title=\"Matrix.Nat\">FromNat</a> cols)), <a href=\"/package/base-4.12.0.0/docs/GHC-TypeNats.html#t:KnownNat\" title=\"GHC.TypeNats\">KnownNat</a> (<a href=\"Matrix-Nat.html#t:Count\" title=\"Matrix.Nat\">Count</a> (<a href=\"Matrix-Nat.html#t:FromNat\" title=\"Matrix.Nat\">FromNat</a> rows))) =&gt; e -&gt; <a href=\"Matrix-Nat.html#t:Matrix\" title=\"Matrix.Nat\">Matrix</a> e cols rows","name":"constant","module":"Matrix.Nat","link":"Matrix-Nat.html#v:constant"},{"display_html":"<a href=\"#v:columns\">columns</a> :: <a href=\"/package/base-4.12.0.0/docs/GHC-TypeNats.html#t:KnownNat\" title=\"GHC.TypeNats\">KnownNat</a> (<a href=\"Matrix-Nat.html#t:Count\" title=\"Matrix.Nat\">Count</a> (<a href=\"Matrix-Nat.html#t:FromNat\" title=\"Matrix.Nat\">FromNat</a> cols)) =&gt; <a href=\"Matrix-Nat.html#t:Matrix\" title=\"Matrix.Nat\">Matrix</a> e cols rows -&gt; <a href=\"/package/base-4.12.0.0/docs/Data-Int.html#t:Int\" title=\"Data.Int\">Int</a>","name":"columns","module":"Matrix.Nat","link":"Matrix-Nat.html#v:columns"},{"display_html":"<a href=\"#v:rows\">rows</a> :: <a href=\"/package/base-4.12.0.0/docs/GHC-TypeNats.html#t:KnownNat\" title=\"GHC.TypeNats\">KnownNat</a> (<a href=\"Matrix-Nat.html#t:Count\" title=\"Matrix.Nat\">Count</a> (<a href=\"Matrix-Nat.html#t:FromNat\" title=\"Matrix.Nat\">FromNat</a> rows)) =&gt; <a href=\"Matrix-Nat.html#t:Matrix\" title=\"Matrix.Nat\">Matrix</a> e cols rows -&gt; <a href=\"/package/base-4.12.0.0/docs/Data-Int.html#t:Int\" title=\"Data.Int\">Int</a>","name":"rows","module":"Matrix.Nat","link":"Matrix-Nat.html#v:rows"},{"display_html":"<a href=\"#v:tr\">tr</a> :: <a href=\"Matrix-Nat.html#t:Matrix\" title=\"Matrix.Nat\">Matrix</a> e cols rows -&gt; <a href=\"Matrix-Nat.html#t:Matrix\" title=\"Matrix.Nat\">Matrix</a> e rows cols","name":"tr","module":"Matrix.Nat","link":"Matrix-Nat.html#v:tr"},{"display_html":"<a href=\"#v:select\">select</a> :: (<a href=\"/package/base-4.12.0.0/docs/Prelude.html#t:Num\" title=\"Prelude\">Num</a> e, <a href=\"Matrix-Nat.html#t:FromLists\" title=\"Matrix.Nat\">FromLists</a> e (<a href=\"Matrix-Nat.html#t:FromNat\" title=\"Matrix.Nat\">FromNat</a> rows1) (<a href=\"Matrix-Nat.html#t:FromNat\" title=\"Matrix.Nat\">FromNat</a> rows1), <a href=\"/package/base-4.12.0.0/docs/GHC-TypeNats.html#t:KnownNat\" title=\"GHC.TypeNats\">KnownNat</a> (<a href=\"Matrix-Nat.html#t:Count\" title=\"Matrix.Nat\">Count</a> (<a href=\"Matrix-Nat.html#t:FromNat\" title=\"Matrix.Nat\">FromNat</a> rows1)), <a href=\"Matrix-Nat.html#t:FromNat\" title=\"Matrix.Nat\">FromNat</a> rows2 ~ <a href=\"Matrix-Nat.html#t:FromNat\" title=\"Matrix.Nat\">FromNat</a> rows1, <a href=\"Matrix-Nat.html#t:FromNat\" title=\"Matrix.Nat\">FromNat</a> cols1 ~ <a href=\"Matrix-Nat.html#t:FromNat\" title=\"Matrix.Nat\">FromNat</a> cols2, <a href=\"Matrix-Nat.html#t:FromNat\" title=\"Matrix.Nat\">FromNat</a> rows3 ~ <a href=\"/package/base-4.12.0.0/docs/Data-Either.html#t:Either\" title=\"Data.Either\">Either</a> (<a href=\"Matrix-Nat.html#t:FromNat\" title=\"Matrix.Nat\">FromNat</a> cols3) (<a href=\"Matrix-Nat.html#t:FromNat\" title=\"Matrix.Nat\">FromNat</a> rows1)) =&gt; <a href=\"Matrix-Nat.html#t:Matrix\" title=\"Matrix.Nat\">Matrix</a> e cols1 rows3 -&gt; <a href=\"Matrix-Nat.html#t:Matrix\" title=\"Matrix.Nat\">Matrix</a> e cols3 rows1 -&gt; <a href=\"Matrix-Nat.html#t:Matrix\" title=\"Matrix.Nat\">Matrix</a> e cols2 rows2","name":"select","module":"Matrix.Nat","link":"Matrix-Nat.html#v:select"},{"display_html":"<a href=\"#v:cond\">cond</a> :: (<a href=\"Matrix-Nat.html#t:FromNat\" title=\"Matrix.Nat\">FromNat</a> (<a href=\"Matrix-Nat.html#t:Count\" title=\"Matrix.Nat\">Count</a> (<a href=\"Matrix-Nat.html#t:FromNat\" title=\"Matrix.Nat\">FromNat</a> cols)) ~ <a href=\"Matrix-Nat.html#t:FromNat\" title=\"Matrix.Nat\">FromNat</a> cols, <a href=\"/package/base-4.12.0.0/docs/GHC-TypeNats.html#t:KnownNat\" title=\"GHC.TypeNats\">KnownNat</a> (<a href=\"Matrix-Nat.html#t:Count\" title=\"Matrix.Nat\">Count</a> (<a href=\"Matrix-Nat.html#t:FromNat\" title=\"Matrix.Nat\">FromNat</a> cols)), <a href=\"Matrix-Nat.html#t:FromLists\" title=\"Matrix.Nat\">FromLists</a> e () (<a href=\"Matrix-Nat.html#t:FromNat\" title=\"Matrix.Nat\">FromNat</a> cols), <a href=\"Matrix-Nat.html#t:FromLists\" title=\"Matrix.Nat\">FromLists</a> e (<a href=\"Matrix-Nat.html#t:FromNat\" title=\"Matrix.Nat\">FromNat</a> cols) (), <a href=\"Matrix-Nat.html#t:FromLists\" title=\"Matrix.Nat\">FromLists</a> e (<a href=\"Matrix-Nat.html#t:FromNat\" title=\"Matrix.Nat\">FromNat</a> cols) (<a href=\"Matrix-Nat.html#t:FromNat\" title=\"Matrix.Nat\">FromNat</a> cols), <a href=\"/package/base-4.12.0.0/docs/Prelude.html#t:Bounded\" title=\"Prelude\">Bounded</a> a, <a href=\"/package/base-4.12.0.0/docs/Prelude.html#t:Enum\" title=\"Prelude\">Enum</a> a, <a href=\"/package/base-4.12.0.0/docs/Prelude.html#t:Num\" title=\"Prelude\">Num</a> e, <a href=\"/package/base-4.12.0.0/docs/Data-Ord.html#t:Ord\" title=\"Data.Ord\">Ord</a> e) =&gt; (a -&gt; <a href=\"/package/base-4.12.0.0/docs/Data-Bool.html#t:Bool\" title=\"Data.Bool\">Bool</a>) -&gt; <a href=\"Matrix-Nat.html#t:Matrix\" title=\"Matrix.Nat\">Matrix</a> e cols rows -&gt; <a href=\"Matrix-Nat.html#t:Matrix\" title=\"Matrix.Nat\">Matrix</a> e cols rows -&gt; <a href=\"Matrix-Nat.html#t:Matrix\" title=\"Matrix.Nat\">Matrix</a> e cols rows","name":"cond","module":"Matrix.Nat","link":"Matrix-Nat.html#v:cond"},{"display_html":"<a href=\"#v:abideJS\">abideJS</a> :: <a href=\"Matrix-Nat.html#t:Matrix\" title=\"Matrix.Nat\">Matrix</a> e cols rows -&gt; <a href=\"Matrix-Nat.html#t:Matrix\" title=\"Matrix.Nat\">Matrix</a> e cols rows","name":"abideJS","module":"Matrix.Nat","link":"Matrix-Nat.html#v:abideJS"},{"display_html":"<a href=\"#v:abideSJ\">abideSJ</a> :: <a href=\"Matrix-Nat.html#t:Matrix\" title=\"Matrix.Nat\">Matrix</a> e cols rows -&gt; <a href=\"Matrix-Nat.html#t:Matrix\" title=\"Matrix.Nat\">Matrix</a> e cols rows","name":"abideSJ","module":"Matrix.Nat","link":"Matrix-Nat.html#v:abideSJ"},{"display_html":"<a href=\"#v:-61--61--61-\">(===)</a> :: <a href=\"Matrix-Nat.html#t:FromNat\" title=\"Matrix.Nat\">FromNat</a> rows3 ~ <a href=\"/package/base-4.12.0.0/docs/Data-Either.html#t:Either\" title=\"Data.Either\">Either</a> (<a href=\"Matrix-Nat.html#t:FromNat\" title=\"Matrix.Nat\">FromNat</a> rows1) (<a href=\"Matrix-Nat.html#t:FromNat\" title=\"Matrix.Nat\">FromNat</a> rows2) =&gt; <a href=\"Matrix-Nat.html#t:Matrix\" title=\"Matrix.Nat\">Matrix</a> e cols rows1 -&gt; <a href=\"Matrix-Nat.html#t:Matrix\" title=\"Matrix.Nat\">Matrix</a> e cols rows2 -&gt; <a href=\"Matrix-Nat.html#t:Matrix\" title=\"Matrix.Nat\">Matrix</a> e cols rows3","name":"===","module":"Matrix.Nat","link":"Matrix-Nat.html#v:-61--61--61-"},{"display_html":"<a href=\"#v:p1\">p1</a> :: (<a href=\"/package/base-4.12.0.0/docs/Prelude.html#t:Num\" title=\"Prelude\">Num</a> e, <a href=\"/package/base-4.12.0.0/docs/GHC-TypeNats.html#t:KnownNat\" title=\"GHC.TypeNats\">KnownNat</a> (<a href=\"Matrix-Nat.html#t:Count\" title=\"Matrix.Nat\">Count</a> (<a href=\"Matrix-Nat.html#t:FromNat\" title=\"Matrix.Nat\">FromNat</a> n)), <a href=\"/package/base-4.12.0.0/docs/GHC-TypeNats.html#t:KnownNat\" title=\"GHC.TypeNats\">KnownNat</a> (<a href=\"Matrix-Nat.html#t:Count\" title=\"Matrix.Nat\">Count</a> (<a href=\"Matrix-Nat.html#t:FromNat\" title=\"Matrix.Nat\">FromNat</a> m)), <a href=\"Matrix-Nat.html#t:FromLists\" title=\"Matrix.Nat\">FromLists</a> e (<a href=\"Matrix-Nat.html#t:FromNat\" title=\"Matrix.Nat\">FromNat</a> n) (<a href=\"Matrix-Nat.html#t:FromNat\" title=\"Matrix.Nat\">FromNat</a> m), <a href=\"Matrix-Nat.html#t:FromLists\" title=\"Matrix.Nat\">FromLists</a> e (<a href=\"Matrix-Nat.html#t:FromNat\" title=\"Matrix.Nat\">FromNat</a> m) (<a href=\"Matrix-Nat.html#t:FromNat\" title=\"Matrix.Nat\">FromNat</a> m), <a href=\"Matrix-Nat.html#t:FromNat\" title=\"Matrix.Nat\">FromNat</a> (m <a href=\"/package/base-4.12.0.0/docs/GHC-TypeNats.html#t:-43-\" title=\"GHC.TypeNats\">+</a> n) ~ <a href=\"/package/base-4.12.0.0/docs/Data-Either.html#t:Either\" title=\"Data.Either\">Either</a> (<a href=\"Matrix-Nat.html#t:FromNat\" title=\"Matrix.Nat\">FromNat</a> m) (<a href=\"Matrix-Nat.html#t:FromNat\" title=\"Matrix.Nat\">FromNat</a> n)) =&gt; <a href=\"Matrix-Nat.html#t:Matrix\" title=\"Matrix.Nat\">Matrix</a> e (m <a href=\"/package/base-4.12.0.0/docs/GHC-TypeNats.html#t:-43-\" title=\"GHC.TypeNats\">+</a> n) m","name":"p1","module":"Matrix.Nat","link":"Matrix-Nat.html#v:p1"},{"display_html":"<a href=\"#v:p2\">p2</a> :: (<a href=\"/package/base-4.12.0.0/docs/Prelude.html#t:Num\" title=\"Prelude\">Num</a> e, <a href=\"/package/base-4.12.0.0/docs/GHC-TypeNats.html#t:KnownNat\" title=\"GHC.TypeNats\">KnownNat</a> (<a href=\"Matrix-Nat.html#t:Count\" title=\"Matrix.Nat\">Count</a> (<a href=\"Matrix-Nat.html#t:FromNat\" title=\"Matrix.Nat\">FromNat</a> n)), <a href=\"/package/base-4.12.0.0/docs/GHC-TypeNats.html#t:KnownNat\" title=\"GHC.TypeNats\">KnownNat</a> (<a href=\"Matrix-Nat.html#t:Count\" title=\"Matrix.Nat\">Count</a> (<a href=\"Matrix-Nat.html#t:FromNat\" title=\"Matrix.Nat\">FromNat</a> m)), <a href=\"Matrix-Nat.html#t:FromLists\" title=\"Matrix.Nat\">FromLists</a> e (<a href=\"Matrix-Nat.html#t:FromNat\" title=\"Matrix.Nat\">FromNat</a> m) (<a href=\"Matrix-Nat.html#t:FromNat\" title=\"Matrix.Nat\">FromNat</a> n), <a href=\"Matrix-Nat.html#t:FromLists\" title=\"Matrix.Nat\">FromLists</a> e (<a href=\"Matrix-Nat.html#t:FromNat\" title=\"Matrix.Nat\">FromNat</a> n) (<a href=\"Matrix-Nat.html#t:FromNat\" title=\"Matrix.Nat\">FromNat</a> n), <a href=\"Matrix-Nat.html#t:FromNat\" title=\"Matrix.Nat\">FromNat</a> (m <a href=\"/package/base-4.12.0.0/docs/GHC-TypeNats.html#t:-43-\" title=\"GHC.TypeNats\">+</a> n) ~ <a href=\"/package/base-4.12.0.0/docs/Data-Either.html#t:Either\" title=\"Data.Either\">Either</a> (<a href=\"Matrix-Nat.html#t:FromNat\" title=\"Matrix.Nat\">FromNat</a> m) (<a href=\"Matrix-Nat.html#t:FromNat\" title=\"Matrix.Nat\">FromNat</a> n)) =&gt; <a href=\"Matrix-Nat.html#t:Matrix\" title=\"Matrix.Nat\">Matrix</a> e (m <a href=\"/package/base-4.12.0.0/docs/GHC-TypeNats.html#t:-43-\" title=\"GHC.TypeNats\">+</a> n) n","name":"p2","module":"Matrix.Nat","link":"Matrix-Nat.html#v:p2"},{"display_html":"<a href=\"#v:-124--124--124-\">(|||)</a> :: <a href=\"Matrix-Nat.html#t:FromNat\" title=\"Matrix.Nat\">FromNat</a> cols3 ~ <a href=\"/package/base-4.12.0.0/docs/Data-Either.html#t:Either\" title=\"Data.Either\">Either</a> (<a href=\"Matrix-Nat.html#t:FromNat\" title=\"Matrix.Nat\">FromNat</a> cols1) (<a href=\"Matrix-Nat.html#t:FromNat\" title=\"Matrix.Nat\">FromNat</a> cols2) =&gt; <a href=\"Matrix-Nat.html#t:Matrix\" title=\"Matrix.Nat\">Matrix</a> e cols1 rows -&gt; <a href=\"Matrix-Nat.html#t:Matrix\" title=\"Matrix.Nat\">Matrix</a> e cols2 rows -&gt; <a href=\"Matrix-Nat.html#t:Matrix\" title=\"Matrix.Nat\">Matrix</a> e cols3 rows","name":"|||","module":"Matrix.Nat","link":"Matrix-Nat.html#v:-124--124--124-"},{"display_html":"<a href=\"#v:i1\">i1</a> :: (<a href=\"/package/base-4.12.0.0/docs/Prelude.html#t:Num\" title=\"Prelude\">Num</a> e, <a href=\"/package/base-4.12.0.0/docs/GHC-TypeNats.html#t:KnownNat\" title=\"GHC.TypeNats\">KnownNat</a> (<a href=\"Matrix-Nat.html#t:Count\" title=\"Matrix.Nat\">Count</a> (<a href=\"Matrix-Nat.html#t:FromNat\" title=\"Matrix.Nat\">FromNat</a> n)), <a href=\"/package/base-4.12.0.0/docs/GHC-TypeNats.html#t:KnownNat\" title=\"GHC.TypeNats\">KnownNat</a> (<a href=\"Matrix-Nat.html#t:Count\" title=\"Matrix.Nat\">Count</a> (<a href=\"Matrix-Nat.html#t:FromNat\" title=\"Matrix.Nat\">FromNat</a> rows)), <a href=\"Matrix-Nat.html#t:FromLists\" title=\"Matrix.Nat\">FromLists</a> e (<a href=\"Matrix-Nat.html#t:FromNat\" title=\"Matrix.Nat\">FromNat</a> n) (<a href=\"Matrix-Nat.html#t:FromNat\" title=\"Matrix.Nat\">FromNat</a> rows), <a href=\"Matrix-Nat.html#t:FromLists\" title=\"Matrix.Nat\">FromLists</a> e (<a href=\"Matrix-Nat.html#t:FromNat\" title=\"Matrix.Nat\">FromNat</a> rows) (<a href=\"Matrix-Nat.html#t:FromNat\" title=\"Matrix.Nat\">FromNat</a> rows), <a href=\"Matrix-Nat.html#t:FromNat\" title=\"Matrix.Nat\">FromNat</a> (rows <a href=\"/package/base-4.12.0.0/docs/GHC-TypeNats.html#t:-43-\" title=\"GHC.TypeNats\">+</a> n) ~ <a href=\"/package/base-4.12.0.0/docs/Data-Either.html#t:Either\" title=\"Data.Either\">Either</a> (<a href=\"Matrix-Nat.html#t:FromNat\" title=\"Matrix.Nat\">FromNat</a> rows) (<a href=\"Matrix-Nat.html#t:FromNat\" title=\"Matrix.Nat\">FromNat</a> n)) =&gt; <a href=\"Matrix-Nat.html#t:Matrix\" title=\"Matrix.Nat\">Matrix</a> e rows (rows <a href=\"/package/base-4.12.0.0/docs/GHC-TypeNats.html#t:-43-\" title=\"GHC.TypeNats\">+</a> n)","name":"i1","module":"Matrix.Nat","link":"Matrix-Nat.html#v:i1"},{"display_html":"<a href=\"#v:i2\">i2</a> :: (<a href=\"/package/base-4.12.0.0/docs/Prelude.html#t:Num\" title=\"Prelude\">Num</a> e, <a href=\"/package/base-4.12.0.0/docs/GHC-TypeNats.html#t:KnownNat\" title=\"GHC.TypeNats\">KnownNat</a> (<a href=\"Matrix-Nat.html#t:Count\" title=\"Matrix.Nat\">Count</a> (<a href=\"Matrix-Nat.html#t:FromNat\" title=\"Matrix.Nat\">FromNat</a> rows)), <a href=\"/package/base-4.12.0.0/docs/GHC-TypeNats.html#t:KnownNat\" title=\"GHC.TypeNats\">KnownNat</a> (<a href=\"Matrix-Nat.html#t:Count\" title=\"Matrix.Nat\">Count</a> (<a href=\"Matrix-Nat.html#t:FromNat\" title=\"Matrix.Nat\">FromNat</a> m)), <a href=\"Matrix-Nat.html#t:FromLists\" title=\"Matrix.Nat\">FromLists</a> e (<a href=\"Matrix-Nat.html#t:FromNat\" title=\"Matrix.Nat\">FromNat</a> m) (<a href=\"Matrix-Nat.html#t:FromNat\" title=\"Matrix.Nat\">FromNat</a> rows), <a href=\"Matrix-Nat.html#t:FromLists\" title=\"Matrix.Nat\">FromLists</a> e (<a href=\"Matrix-Nat.html#t:FromNat\" title=\"Matrix.Nat\">FromNat</a> rows) (<a href=\"Matrix-Nat.html#t:FromNat\" title=\"Matrix.Nat\">FromNat</a> rows), <a href=\"Matrix-Nat.html#t:FromNat\" title=\"Matrix.Nat\">FromNat</a> (m <a href=\"/package/base-4.12.0.0/docs/GHC-TypeNats.html#t:-43-\" title=\"GHC.TypeNats\">+</a> rows) ~ <a href=\"/package/base-4.12.0.0/docs/Data-Either.html#t:Either\" title=\"Data.Either\">Either</a> (<a href=\"Matrix-Nat.html#t:FromNat\" title=\"Matrix.Nat\">FromNat</a> m) (<a href=\"Matrix-Nat.html#t:FromNat\" title=\"Matrix.Nat\">FromNat</a> rows)) =&gt; <a href=\"Matrix-Nat.html#t:Matrix\" title=\"Matrix.Nat\">Matrix</a> e rows (m <a href=\"/package/base-4.12.0.0/docs/GHC-TypeNats.html#t:-43-\" title=\"GHC.TypeNats\">+</a> rows)","name":"i2","module":"Matrix.Nat","link":"Matrix-Nat.html#v:i2"},{"display_html":"<a href=\"#v:-45--124--45-\">(-|-)</a> :: (<a href=\"/package/base-4.12.0.0/docs/Prelude.html#t:Num\" title=\"Prelude\">Num</a> e, <a href=\"/package/base-4.12.0.0/docs/GHC-TypeNats.html#t:KnownNat\" title=\"GHC.TypeNats\">KnownNat</a> (<a href=\"Matrix-Nat.html#t:Count\" title=\"Matrix.Nat\">Count</a> (<a href=\"Matrix-Nat.html#t:FromNat\" title=\"Matrix.Nat\">FromNat</a> j)), <a href=\"/package/base-4.12.0.0/docs/GHC-TypeNats.html#t:KnownNat\" title=\"GHC.TypeNats\">KnownNat</a> (<a href=\"Matrix-Nat.html#t:Count\" title=\"Matrix.Nat\">Count</a> (<a href=\"Matrix-Nat.html#t:FromNat\" title=\"Matrix.Nat\">FromNat</a> k)), <a href=\"Matrix-Nat.html#t:FromLists\" title=\"Matrix.Nat\">FromLists</a> e (<a href=\"Matrix-Nat.html#t:FromNat\" title=\"Matrix.Nat\">FromNat</a> k) (<a href=\"Matrix-Nat.html#t:FromNat\" title=\"Matrix.Nat\">FromNat</a> k), <a href=\"Matrix-Nat.html#t:FromLists\" title=\"Matrix.Nat\">FromLists</a> e (<a href=\"Matrix-Nat.html#t:FromNat\" title=\"Matrix.Nat\">FromNat</a> j) (<a href=\"Matrix-Nat.html#t:FromNat\" title=\"Matrix.Nat\">FromNat</a> k), <a href=\"Matrix-Nat.html#t:FromLists\" title=\"Matrix.Nat\">FromLists</a> e (<a href=\"Matrix-Nat.html#t:FromNat\" title=\"Matrix.Nat\">FromNat</a> k) (<a href=\"Matrix-Nat.html#t:FromNat\" title=\"Matrix.Nat\">FromNat</a> j), <a href=\"Matrix-Nat.html#t:FromLists\" title=\"Matrix.Nat\">FromLists</a> e (<a href=\"Matrix-Nat.html#t:FromNat\" title=\"Matrix.Nat\">FromNat</a> j) (<a href=\"Matrix-Nat.html#t:FromNat\" title=\"Matrix.Nat\">FromNat</a> j), <a href=\"Matrix-Nat.html#t:FromNat\" title=\"Matrix.Nat\">FromNat</a> (n <a href=\"/package/base-4.12.0.0/docs/GHC-TypeNats.html#t:-43-\" title=\"GHC.TypeNats\">+</a> m) ~ <a href=\"/package/base-4.12.0.0/docs/Data-Either.html#t:Either\" title=\"Data.Either\">Either</a> (<a href=\"Matrix-Nat.html#t:FromNat\" title=\"Matrix.Nat\">FromNat</a> n) (<a href=\"Matrix-Nat.html#t:FromNat\" title=\"Matrix.Nat\">FromNat</a> m), <a href=\"Matrix-Nat.html#t:FromNat\" title=\"Matrix.Nat\">FromNat</a> (k <a href=\"/package/base-4.12.0.0/docs/GHC-TypeNats.html#t:-43-\" title=\"GHC.TypeNats\">+</a> j) ~ <a href=\"/package/base-4.12.0.0/docs/Data-Either.html#t:Either\" title=\"Data.Either\">Either</a> (<a href=\"Matrix-Nat.html#t:FromNat\" title=\"Matrix.Nat\">FromNat</a> k) (<a href=\"Matrix-Nat.html#t:FromNat\" title=\"Matrix.Nat\">FromNat</a> j)) =&gt; <a href=\"Matrix-Nat.html#t:Matrix\" title=\"Matrix.Nat\">Matrix</a> e n k -&gt; <a href=\"Matrix-Nat.html#t:Matrix\" title=\"Matrix.Nat\">Matrix</a> e m j -&gt; <a href=\"Matrix-Nat.html#t:Matrix\" title=\"Matrix.Nat\">Matrix</a> e (n <a href=\"/package/base-4.12.0.0/docs/GHC-TypeNats.html#t:-43-\" title=\"GHC.TypeNats\">+</a> m) (k <a href=\"/package/base-4.12.0.0/docs/GHC-TypeNats.html#t:-43-\" title=\"GHC.TypeNats\">+</a> j)","name":"-|-","module":"Matrix.Nat","link":"Matrix-Nat.html#v:-45--124--45-"},{"display_html":"<a href=\"#v:-62--60-\">(&gt;&lt;)</a> :: <span class=\"keyword\">forall</span> e m p n q. (<a href=\"/package/base-4.12.0.0/docs/Prelude.html#t:Num\" title=\"Prelude\">Num</a> e, <a href=\"/package/base-4.12.0.0/docs/GHC-TypeNats.html#t:KnownNat\" title=\"GHC.TypeNats\">KnownNat</a> (<a href=\"Matrix-Nat.html#t:Count\" title=\"Matrix.Nat\">Count</a> (<a href=\"Matrix-Nat.html#t:FromNat\" title=\"Matrix.Nat\">FromNat</a> m)), <a href=\"/package/base-4.12.0.0/docs/GHC-TypeNats.html#t:KnownNat\" title=\"GHC.TypeNats\">KnownNat</a> (<a href=\"Matrix-Nat.html#t:Count\" title=\"Matrix.Nat\">Count</a> (<a href=\"Matrix-Nat.html#t:FromNat\" title=\"Matrix.Nat\">FromNat</a> n)), <a href=\"/package/base-4.12.0.0/docs/GHC-TypeNats.html#t:KnownNat\" title=\"GHC.TypeNats\">KnownNat</a> (<a href=\"Matrix-Nat.html#t:Count\" title=\"Matrix.Nat\">Count</a> (<a href=\"Matrix-Nat.html#t:FromNat\" title=\"Matrix.Nat\">FromNat</a> p)), <a href=\"/package/base-4.12.0.0/docs/GHC-TypeNats.html#t:KnownNat\" title=\"GHC.TypeNats\">KnownNat</a> (<a href=\"Matrix-Nat.html#t:Count\" title=\"Matrix.Nat\">Count</a> (<a href=\"Matrix-Nat.html#t:FromNat\" title=\"Matrix.Nat\">FromNat</a> q)), <a href=\"/package/base-4.12.0.0/docs/GHC-TypeNats.html#t:KnownNat\" title=\"GHC.TypeNats\">KnownNat</a> (<a href=\"Matrix-Nat.html#t:Count\" title=\"Matrix.Nat\">Count</a> (<a href=\"Matrix-Nat.html#t:FromNat\" title=\"Matrix.Nat\">FromNat</a> (m <a href=\"/package/base-4.12.0.0/docs/GHC-TypeNats.html#t:-42-\" title=\"GHC.TypeNats\">*</a> n))), <a href=\"/package/base-4.12.0.0/docs/GHC-TypeNats.html#t:KnownNat\" title=\"GHC.TypeNats\">KnownNat</a> (<a href=\"Matrix-Nat.html#t:Count\" title=\"Matrix.Nat\">Count</a> (<a href=\"Matrix-Nat.html#t:FromNat\" title=\"Matrix.Nat\">FromNat</a> (p <a href=\"/package/base-4.12.0.0/docs/GHC-TypeNats.html#t:-42-\" title=\"GHC.TypeNats\">*</a> q))), <a href=\"Matrix-Nat.html#t:FromLists\" title=\"Matrix.Nat\">FromLists</a> e (<a href=\"Matrix-Nat.html#t:FromNat\" title=\"Matrix.Nat\">FromNat</a> (m <a href=\"/package/base-4.12.0.0/docs/GHC-TypeNats.html#t:-42-\" title=\"GHC.TypeNats\">*</a> n)) (<a href=\"Matrix-Nat.html#t:FromNat\" title=\"Matrix.Nat\">FromNat</a> m), <a href=\"Matrix-Nat.html#t:FromLists\" title=\"Matrix.Nat\">FromLists</a> e (<a href=\"Matrix-Nat.html#t:FromNat\" title=\"Matrix.Nat\">FromNat</a> (m <a href=\"/package/base-4.12.0.0/docs/GHC-TypeNats.html#t:-42-\" title=\"GHC.TypeNats\">*</a> n)) (<a href=\"Matrix-Nat.html#t:FromNat\" title=\"Matrix.Nat\">FromNat</a> n), <a href=\"Matrix-Nat.html#t:FromLists\" title=\"Matrix.Nat\">FromLists</a> e (<a href=\"Matrix-Nat.html#t:FromNat\" title=\"Matrix.Nat\">FromNat</a> (p <a href=\"/package/base-4.12.0.0/docs/GHC-TypeNats.html#t:-42-\" title=\"GHC.TypeNats\">*</a> q)) (<a href=\"Matrix-Nat.html#t:FromNat\" title=\"Matrix.Nat\">FromNat</a> p), <a href=\"Matrix-Nat.html#t:FromLists\" title=\"Matrix.Nat\">FromLists</a> e (<a href=\"Matrix-Nat.html#t:FromNat\" title=\"Matrix.Nat\">FromNat</a> (p <a href=\"/package/base-4.12.0.0/docs/GHC-TypeNats.html#t:-42-\" title=\"GHC.TypeNats\">*</a> q)) (<a href=\"Matrix-Nat.html#t:FromNat\" title=\"Matrix.Nat\">FromNat</a> q), <a href=\"Matrix-Nat.html#t:FromNat\" title=\"Matrix.Nat\">FromNat</a> (m <a href=\"/package/base-4.12.0.0/docs/GHC-TypeNats.html#t:-42-\" title=\"GHC.TypeNats\">*</a> n) ~ <a href=\"Matrix-Nat.html#t:FromNat\" title=\"Matrix.Nat\">FromNat</a> (<a href=\"Matrix-Nat.html#t:Count\" title=\"Matrix.Nat\">Count</a> (<a href=\"Matrix-Nat.html#t:FromNat\" title=\"Matrix.Nat\">FromNat</a> m) <a href=\"/package/base-4.12.0.0/docs/GHC-TypeNats.html#t:-42-\" title=\"GHC.TypeNats\">*</a> <a href=\"Matrix-Nat.html#t:Count\" title=\"Matrix.Nat\">Count</a> (<a href=\"Matrix-Nat.html#t:FromNat\" title=\"Matrix.Nat\">FromNat</a> n)), <a href=\"Matrix-Nat.html#t:FromNat\" title=\"Matrix.Nat\">FromNat</a> (p <a href=\"/package/base-4.12.0.0/docs/GHC-TypeNats.html#t:-42-\" title=\"GHC.TypeNats\">*</a> q) ~ <a href=\"Matrix-Nat.html#t:FromNat\" title=\"Matrix.Nat\">FromNat</a> (<a href=\"Matrix-Nat.html#t:Count\" title=\"Matrix.Nat\">Count</a> (<a href=\"Matrix-Nat.html#t:FromNat\" title=\"Matrix.Nat\">FromNat</a> p) <a href=\"/package/base-4.12.0.0/docs/GHC-TypeNats.html#t:-42-\" title=\"GHC.TypeNats\">*</a> <a href=\"Matrix-Nat.html#t:Count\" title=\"Matrix.Nat\">Count</a> (<a href=\"Matrix-Nat.html#t:FromNat\" title=\"Matrix.Nat\">FromNat</a> q))) =&gt; <a href=\"Matrix-Nat.html#t:Matrix\" title=\"Matrix.Nat\">Matrix</a> e m p -&gt; <a href=\"Matrix-Nat.html#t:Matrix\" title=\"Matrix.Nat\">Matrix</a> e n q -&gt; <a href=\"Matrix-Nat.html#t:Matrix\" title=\"Matrix.Nat\">Matrix</a> e (m <a href=\"/package/base-4.12.0.0/docs/GHC-TypeNats.html#t:-42-\" title=\"GHC.TypeNats\">*</a> n) (p <a href=\"/package/base-4.12.0.0/docs/GHC-TypeNats.html#t:-42-\" title=\"GHC.TypeNats\">*</a> q)","name":"><","module":"Matrix.Nat","link":"Matrix-Nat.html#v:-62--60-"},{"display_html":"<a href=\"#v:kp1\">kp1</a> :: <span class=\"keyword\">forall</span> e m k. (<a href=\"/package/base-4.12.0.0/docs/Prelude.html#t:Num\" title=\"Prelude\">Num</a> e, <a href=\"/package/base-4.12.0.0/docs/GHC-TypeNats.html#t:KnownNat\" title=\"GHC.TypeNats\">KnownNat</a> (<a href=\"Matrix-Nat.html#t:Count\" title=\"Matrix.Nat\">Count</a> (<a href=\"Matrix-Nat.html#t:FromNat\" title=\"Matrix.Nat\">FromNat</a> m)), <a href=\"/package/base-4.12.0.0/docs/GHC-TypeNats.html#t:KnownNat\" title=\"GHC.TypeNats\">KnownNat</a> (<a href=\"Matrix-Nat.html#t:Count\" title=\"Matrix.Nat\">Count</a> (<a href=\"Matrix-Nat.html#t:FromNat\" title=\"Matrix.Nat\">FromNat</a> k)), <a href=\"/package/base-4.12.0.0/docs/GHC-TypeNats.html#t:KnownNat\" title=\"GHC.TypeNats\">KnownNat</a> (<a href=\"Matrix-Nat.html#t:Count\" title=\"Matrix.Nat\">Count</a> (<a href=\"Matrix-Nat.html#t:FromNat\" title=\"Matrix.Nat\">FromNat</a> (m <a href=\"/package/base-4.12.0.0/docs/GHC-TypeNats.html#t:-42-\" title=\"GHC.TypeNats\">*</a> k))), <a href=\"Matrix-Nat.html#t:FromLists\" title=\"Matrix.Nat\">FromLists</a> e (<a href=\"Matrix-Nat.html#t:FromNat\" title=\"Matrix.Nat\">FromNat</a> (m <a href=\"/package/base-4.12.0.0/docs/GHC-TypeNats.html#t:-42-\" title=\"GHC.TypeNats\">*</a> k)) (<a href=\"Matrix-Nat.html#t:FromNat\" title=\"Matrix.Nat\">FromNat</a> m), <a href=\"Matrix-Nat.html#t:FromNat\" title=\"Matrix.Nat\">FromNat</a> (m <a href=\"/package/base-4.12.0.0/docs/GHC-TypeNats.html#t:-42-\" title=\"GHC.TypeNats\">*</a> k) ~ <a href=\"Matrix-Nat.html#t:FromNat\" title=\"Matrix.Nat\">FromNat</a> (<a href=\"Matrix-Nat.html#t:Count\" title=\"Matrix.Nat\">Count</a> (<a href=\"Matrix-Nat.html#t:FromNat\" title=\"Matrix.Nat\">FromNat</a> m) <a href=\"/package/base-4.12.0.0/docs/GHC-TypeNats.html#t:-42-\" title=\"GHC.TypeNats\">*</a> <a href=\"Matrix-Nat.html#t:Count\" title=\"Matrix.Nat\">Count</a> (<a href=\"Matrix-Nat.html#t:FromNat\" title=\"Matrix.Nat\">FromNat</a> k))) =&gt; <a href=\"Matrix-Nat.html#t:Matrix\" title=\"Matrix.Nat\">Matrix</a> e (m <a href=\"/package/base-4.12.0.0/docs/GHC-TypeNats.html#t:-42-\" title=\"GHC.TypeNats\">*</a> k) m","name":"kp1","module":"Matrix.Nat","link":"Matrix-Nat.html#v:kp1"},{"display_html":"<a href=\"#v:kp2\">kp2</a> :: <span class=\"keyword\">forall</span> e m k. (<a href=\"/package/base-4.12.0.0/docs/Prelude.html#t:Num\" title=\"Prelude\">Num</a> e, <a href=\"/package/base-4.12.0.0/docs/GHC-TypeNats.html#t:KnownNat\" title=\"GHC.TypeNats\">KnownNat</a> (<a href=\"Matrix-Nat.html#t:Count\" title=\"Matrix.Nat\">Count</a> (<a href=\"Matrix-Nat.html#t:FromNat\" title=\"Matrix.Nat\">FromNat</a> k)), <a href=\"Matrix-Nat.html#t:FromLists\" title=\"Matrix.Nat\">FromLists</a> e (<a href=\"Matrix-Nat.html#t:FromNat\" title=\"Matrix.Nat\">FromNat</a> (m <a href=\"/package/base-4.12.0.0/docs/GHC-TypeNats.html#t:-42-\" title=\"GHC.TypeNats\">*</a> k)) (<a href=\"Matrix-Nat.html#t:FromNat\" title=\"Matrix.Nat\">FromNat</a> k), <a href=\"/package/base-4.12.0.0/docs/GHC-TypeNats.html#t:KnownNat\" title=\"GHC.TypeNats\">KnownNat</a> (<a href=\"Matrix-Nat.html#t:Count\" title=\"Matrix.Nat\">Count</a> (<a href=\"Matrix-Nat.html#t:FromNat\" title=\"Matrix.Nat\">FromNat</a> m)), <a href=\"/package/base-4.12.0.0/docs/GHC-TypeNats.html#t:KnownNat\" title=\"GHC.TypeNats\">KnownNat</a> (<a href=\"Matrix-Nat.html#t:Count\" title=\"Matrix.Nat\">Count</a> (<a href=\"Matrix-Nat.html#t:FromNat\" title=\"Matrix.Nat\">FromNat</a> (m <a href=\"/package/base-4.12.0.0/docs/GHC-TypeNats.html#t:-42-\" title=\"GHC.TypeNats\">*</a> k))), <a href=\"Matrix-Nat.html#t:FromNat\" title=\"Matrix.Nat\">FromNat</a> (m <a href=\"/package/base-4.12.0.0/docs/GHC-TypeNats.html#t:-42-\" title=\"GHC.TypeNats\">*</a> k) ~ <a href=\"Matrix-Nat.html#t:FromNat\" title=\"Matrix.Nat\">FromNat</a> (<a href=\"Matrix-Nat.html#t:Count\" title=\"Matrix.Nat\">Count</a> (<a href=\"Matrix-Nat.html#t:FromNat\" title=\"Matrix.Nat\">FromNat</a> m) <a href=\"/package/base-4.12.0.0/docs/GHC-TypeNats.html#t:-42-\" title=\"GHC.TypeNats\">*</a> <a href=\"Matrix-Nat.html#t:Count\" title=\"Matrix.Nat\">Count</a> (<a href=\"Matrix-Nat.html#t:FromNat\" title=\"Matrix.Nat\">FromNat</a> k))) =&gt; <a href=\"Matrix-Nat.html#t:Matrix\" title=\"Matrix.Nat\">Matrix</a> e (m <a href=\"/package/base-4.12.0.0/docs/GHC-TypeNats.html#t:-42-\" title=\"GHC.TypeNats\">*</a> k) k","name":"kp2","module":"Matrix.Nat","link":"Matrix-Nat.html#v:kp2"},{"display_html":"<a href=\"#v:khatri\">khatri</a> :: <span class=\"keyword\">forall</span> e cols a b. (<a href=\"/package/base-4.12.0.0/docs/Prelude.html#t:Num\" title=\"Prelude\">Num</a> e, <a href=\"/package/base-4.12.0.0/docs/GHC-TypeNats.html#t:KnownNat\" title=\"GHC.TypeNats\">KnownNat</a> (<a href=\"Matrix-Nat.html#t:Count\" title=\"Matrix.Nat\">Count</a> (<a href=\"Matrix-Nat.html#t:FromNat\" title=\"Matrix.Nat\">FromNat</a> a)), <a href=\"/package/base-4.12.0.0/docs/GHC-TypeNats.html#t:KnownNat\" title=\"GHC.TypeNats\">KnownNat</a> (<a href=\"Matrix-Nat.html#t:Count\" title=\"Matrix.Nat\">Count</a> (<a href=\"Matrix-Nat.html#t:FromNat\" title=\"Matrix.Nat\">FromNat</a> b)), <a href=\"/package/base-4.12.0.0/docs/GHC-TypeNats.html#t:KnownNat\" title=\"GHC.TypeNats\">KnownNat</a> (<a href=\"Matrix-Nat.html#t:Count\" title=\"Matrix.Nat\">Count</a> (<a href=\"Matrix-Nat.html#t:FromNat\" title=\"Matrix.Nat\">FromNat</a> (a <a href=\"/package/base-4.12.0.0/docs/GHC-TypeNats.html#t:-42-\" title=\"GHC.TypeNats\">*</a> b))), <a href=\"Matrix-Nat.html#t:FromLists\" title=\"Matrix.Nat\">FromLists</a> e (<a href=\"Matrix-Nat.html#t:FromNat\" title=\"Matrix.Nat\">FromNat</a> (a <a href=\"/package/base-4.12.0.0/docs/GHC-TypeNats.html#t:-42-\" title=\"GHC.TypeNats\">*</a> b)) (<a href=\"Matrix-Nat.html#t:FromNat\" title=\"Matrix.Nat\">FromNat</a> a), <a href=\"Matrix-Nat.html#t:FromLists\" title=\"Matrix.Nat\">FromLists</a> e (<a href=\"Matrix-Nat.html#t:FromNat\" title=\"Matrix.Nat\">FromNat</a> (a <a href=\"/package/base-4.12.0.0/docs/GHC-TypeNats.html#t:-42-\" title=\"GHC.TypeNats\">*</a> b)) (<a href=\"Matrix-Nat.html#t:FromNat\" title=\"Matrix.Nat\">FromNat</a> b), <a href=\"Matrix-Nat.html#t:FromNat\" title=\"Matrix.Nat\">FromNat</a> (a <a href=\"/package/base-4.12.0.0/docs/GHC-TypeNats.html#t:-42-\" title=\"GHC.TypeNats\">*</a> b) ~ <a href=\"Matrix-Nat.html#t:FromNat\" title=\"Matrix.Nat\">FromNat</a> (<a href=\"Matrix-Nat.html#t:Count\" title=\"Matrix.Nat\">Count</a> (<a href=\"Matrix-Nat.html#t:FromNat\" title=\"Matrix.Nat\">FromNat</a> a) <a href=\"/package/base-4.12.0.0/docs/GHC-TypeNats.html#t:-42-\" title=\"GHC.TypeNats\">*</a> <a href=\"Matrix-Nat.html#t:Count\" title=\"Matrix.Nat\">Count</a> (<a href=\"Matrix-Nat.html#t:FromNat\" title=\"Matrix.Nat\">FromNat</a> b))) =&gt; <a href=\"Matrix-Nat.html#t:Matrix\" title=\"Matrix.Nat\">Matrix</a> e cols a -&gt; <a href=\"Matrix-Nat.html#t:Matrix\" title=\"Matrix.Nat\">Matrix</a> e cols b -&gt; <a href=\"Matrix-Nat.html#t:Matrix\" title=\"Matrix.Nat\">Matrix</a> e cols (a <a href=\"/package/base-4.12.0.0/docs/GHC-TypeNats.html#t:-42-\" title=\"GHC.TypeNats\">*</a> b)","name":"khatri","module":"Matrix.Nat","link":"Matrix-Nat.html#v:khatri"},{"display_html":"<a href=\"#v:identity\">identity</a> :: (<a href=\"/package/base-4.12.0.0/docs/Prelude.html#t:Num\" title=\"Prelude\">Num</a> e, <a href=\"Matrix-Nat.html#t:FromLists\" title=\"Matrix.Nat\">FromLists</a> e (<a href=\"Matrix-Nat.html#t:FromNat\" title=\"Matrix.Nat\">FromNat</a> cols) (<a href=\"Matrix-Nat.html#t:FromNat\" title=\"Matrix.Nat\">FromNat</a> cols), <a href=\"/package/base-4.12.0.0/docs/GHC-TypeNats.html#t:KnownNat\" title=\"GHC.TypeNats\">KnownNat</a> (<a href=\"Matrix-Nat.html#t:Count\" title=\"Matrix.Nat\">Count</a> (<a href=\"Matrix-Nat.html#t:FromNat\" title=\"Matrix.Nat\">FromNat</a> cols))) =&gt; <a href=\"Matrix-Nat.html#t:Matrix\" title=\"Matrix.Nat\">Matrix</a> e cols cols","name":"identity","module":"Matrix.Nat","link":"Matrix-Nat.html#v:identity"},{"display_html":"<a href=\"#v:comp\">comp</a> :: <a href=\"/package/base-4.12.0.0/docs/Prelude.html#t:Num\" title=\"Prelude\">Num</a> e =&gt; <a href=\"Matrix-Nat.html#t:Matrix\" title=\"Matrix.Nat\">Matrix</a> e cr rows -&gt; <a href=\"Matrix-Nat.html#t:Matrix\" title=\"Matrix.Nat\">Matrix</a> e cols cr -&gt; <a href=\"Matrix-Nat.html#t:Matrix\" title=\"Matrix.Nat\">Matrix</a> e cols rows","name":"comp","module":"Matrix.Nat","link":"Matrix-Nat.html#v:comp"},{"display_html":"<a href=\"#v:fromF\">fromF</a> :: (<a href=\"/package/base-4.12.0.0/docs/Prelude.html#t:Bounded\" title=\"Prelude\">Bounded</a> a, <a href=\"/package/base-4.12.0.0/docs/Prelude.html#t:Bounded\" title=\"Prelude\">Bounded</a> b, <a href=\"/package/base-4.12.0.0/docs/Prelude.html#t:Enum\" title=\"Prelude\">Enum</a> a, <a href=\"/package/base-4.12.0.0/docs/Prelude.html#t:Enum\" title=\"Prelude\">Enum</a> b, <a href=\"/package/base-4.12.0.0/docs/Data-Eq.html#t:Eq\" title=\"Data.Eq\">Eq</a> b, <a href=\"/package/base-4.12.0.0/docs/Prelude.html#t:Num\" title=\"Prelude\">Num</a> e, <a href=\"/package/base-4.12.0.0/docs/Data-Ord.html#t:Ord\" title=\"Data.Ord\">Ord</a> e, <a href=\"/package/base-4.12.0.0/docs/GHC-TypeNats.html#t:KnownNat\" title=\"GHC.TypeNats\">KnownNat</a> (<a href=\"Matrix-Nat.html#t:Count\" title=\"Matrix.Nat\">Count</a> (<a href=\"Matrix-Nat.html#t:FromNat\" title=\"Matrix.Nat\">FromNat</a> cols)), <a href=\"/package/base-4.12.0.0/docs/GHC-TypeNats.html#t:KnownNat\" title=\"GHC.TypeNats\">KnownNat</a> (<a href=\"Matrix-Nat.html#t:Count\" title=\"Matrix.Nat\">Count</a> (<a href=\"Matrix-Nat.html#t:FromNat\" title=\"Matrix.Nat\">FromNat</a> rows)), <a href=\"Matrix-Nat.html#t:FromLists\" title=\"Matrix.Nat\">FromLists</a> e (<a href=\"Matrix-Nat.html#t:FromNat\" title=\"Matrix.Nat\">FromNat</a> rows) (<a href=\"Matrix-Nat.html#t:FromNat\" title=\"Matrix.Nat\">FromNat</a> cols)) =&gt; (a -&gt; b) -&gt; <a href=\"Matrix-Nat.html#t:Matrix\" title=\"Matrix.Nat\">Matrix</a> e cols rows","name":"fromF","module":"Matrix.Nat","link":"Matrix-Nat.html#v:fromF"},{"display_html":"<a href=\"#v:fromF-39-\">fromF'</a> :: (<a href=\"/package/base-4.12.0.0/docs/Prelude.html#t:Bounded\" title=\"Prelude\">Bounded</a> a, <a href=\"/package/base-4.12.0.0/docs/Prelude.html#t:Bounded\" title=\"Prelude\">Bounded</a> b, <a href=\"/package/base-4.12.0.0/docs/Prelude.html#t:Enum\" title=\"Prelude\">Enum</a> a, <a href=\"/package/base-4.12.0.0/docs/Prelude.html#t:Enum\" title=\"Prelude\">Enum</a> b, <a href=\"/package/base-4.12.0.0/docs/Data-Eq.html#t:Eq\" title=\"Data.Eq\">Eq</a> b, <a href=\"/package/base-4.12.0.0/docs/Prelude.html#t:Num\" title=\"Prelude\">Num</a> e, <a href=\"/package/base-4.12.0.0/docs/Data-Ord.html#t:Ord\" title=\"Data.Ord\">Ord</a> e, <a href=\"/package/base-4.12.0.0/docs/GHC-TypeNats.html#t:KnownNat\" title=\"GHC.TypeNats\">KnownNat</a> (<a href=\"Matrix-Nat.html#t:Count\" title=\"Matrix.Nat\">Count</a> (<a href=\"Matrix-Nat.html#t:Normalize\" title=\"Matrix.Nat\">Normalize</a> a)), <a href=\"/package/base-4.12.0.0/docs/GHC-TypeNats.html#t:KnownNat\" title=\"GHC.TypeNats\">KnownNat</a> (<a href=\"Matrix-Nat.html#t:Count\" title=\"Matrix.Nat\">Count</a> (<a href=\"Matrix-Nat.html#t:Normalize\" title=\"Matrix.Nat\">Normalize</a> b)), <a href=\"Matrix-Nat.html#t:FromLists\" title=\"Matrix.Nat\">FromLists</a> e (<a href=\"Matrix-Nat.html#t:Normalize\" title=\"Matrix.Nat\">Normalize</a> b) (<a href=\"Matrix-Nat.html#t:Normalize\" title=\"Matrix.Nat\">Normalize</a> a)) =&gt; (a -&gt; b) -&gt; <a href=\"Matrix-Nat.html#t:Matrix\" title=\"Matrix.Nat\">Matrix</a> e (<a href=\"Matrix-Nat.html#t:Count\" title=\"Matrix.Nat\">Count</a> a) (<a href=\"Matrix-Nat.html#t:Count\" title=\"Matrix.Nat\">Count</a> b)","name":"fromF'","module":"Matrix.Nat","link":"Matrix-Nat.html#v:fromF-39-"},{"display_html":"<a href=\"#v:pretty\">pretty</a> :: (<a href=\"/package/base-4.12.0.0/docs/GHC-TypeNats.html#t:KnownNat\" title=\"GHC.TypeNats\">KnownNat</a> (<a href=\"Matrix-Nat.html#t:Count\" title=\"Matrix.Nat\">Count</a> (<a href=\"Matrix-Nat.html#t:FromNat\" title=\"Matrix.Nat\">FromNat</a> cols)), <a href=\"/package/base-4.12.0.0/docs/Text-Show.html#t:Show\" title=\"Text.Show\">Show</a> e) =&gt; <a href=\"Matrix-Nat.html#t:Matrix\" title=\"Matrix.Nat\">Matrix</a> e cols rows -&gt; <a href=\"/package/base-4.12.0.0/docs/Data-String.html#t:String\" title=\"Data.String\">String</a>","name":"pretty","module":"Matrix.Nat","link":"Matrix-Nat.html#v:pretty"},{"display_html":"<a href=\"#v:prettyPrint\">prettyPrint</a> :: (<a href=\"/package/base-4.12.0.0/docs/GHC-TypeNats.html#t:KnownNat\" title=\"GHC.TypeNats\">KnownNat</a> (<a href=\"Matrix-Nat.html#t:Count\" title=\"Matrix.Nat\">Count</a> (<a href=\"Matrix-Nat.html#t:FromNat\" title=\"Matrix.Nat\">FromNat</a> cols)), <a href=\"/package/base-4.12.0.0/docs/Text-Show.html#t:Show\" title=\"Text.Show\">Show</a> e) =&gt; <a href=\"Matrix-Nat.html#t:Matrix\" title=\"Matrix.Nat\">Matrix</a> e cols rows -&gt; <a href=\"/package/base-4.12.0.0/docs/System-IO.html#t:IO\" title=\"System.IO\">IO</a> ()","name":"prettyPrint","module":"Matrix.Nat","link":"Matrix-Nat.html#v:prettyPrint"},{"display_html":"<span class=\"keyword\">newtype</span> <a href=\"#t:Dist\">Dist</a> a = <a href=\"#v:D\">D</a> (<a href=\"Matrix-Type.html#t:Matrix\" title=\"Matrix.Type\">Matrix</a> <a href=\"Dist.html#t:Prob\" title=\"Dist\">Prob</a> () a)","name":"Dist D","module":"Dist","link":"Dist.html#t:Dist"},{"display_html":"<span class=\"keyword\">type</span> <a href=\"#t:Prob\">Prob</a> = <a href=\"/package/base-4.12.0.0/docs/Prelude.html#t:Double\" title=\"Prelude\">Double</a>","name":"Prob","module":"Dist","link":"Dist.html#t:Prob"},{"display_html":"<a href=\"#v:fmapD\">fmapD</a> :: (<a href=\"/package/base-4.12.0.0/docs/Prelude.html#t:Bounded\" title=\"Prelude\">Bounded</a> a, <a href=\"/package/base-4.12.0.0/docs/Prelude.html#t:Bounded\" title=\"Prelude\">Bounded</a> b, <a href=\"/package/base-4.12.0.0/docs/Prelude.html#t:Enum\" title=\"Prelude\">Enum</a> a, <a href=\"/package/base-4.12.0.0/docs/Prelude.html#t:Enum\" title=\"Prelude\">Enum</a> b, <a href=\"/package/base-4.12.0.0/docs/Data-Eq.html#t:Eq\" title=\"Data.Eq\">Eq</a> b, <a href=\"/package/base-4.12.0.0/docs/GHC-TypeNats.html#t:KnownNat\" title=\"GHC.TypeNats\">KnownNat</a> (<a href=\"Matrix-Type.html#t:Count\" title=\"Matrix.Type\">Count</a> (<a href=\"Matrix-Type.html#t:Normalize\" title=\"Matrix.Type\">Normalize</a> a)), <a href=\"/package/base-4.12.0.0/docs/GHC-TypeNats.html#t:KnownNat\" title=\"GHC.TypeNats\">KnownNat</a> (<a href=\"Matrix-Type.html#t:Count\" title=\"Matrix.Type\">Count</a> (<a href=\"Matrix-Type.html#t:Normalize\" title=\"Matrix.Type\">Normalize</a> b)), <a href=\"Matrix-Type.html#t:FromLists\" title=\"Matrix.Type\">FromLists</a> <a href=\"Dist.html#t:Prob\" title=\"Dist\">Prob</a> (<a href=\"Matrix-Type.html#t:Normalize\" title=\"Matrix.Type\">Normalize</a> b) (<a href=\"Matrix-Type.html#t:Normalize\" title=\"Matrix.Type\">Normalize</a> a)) =&gt; (a -&gt; b) -&gt; <a href=\"Dist.html#t:Dist\" title=\"Dist\">Dist</a> a -&gt; <a href=\"Dist.html#t:Dist\" title=\"Dist\">Dist</a> b","name":"fmapD","module":"Dist","link":"Dist.html#v:fmapD"},{"display_html":"<a href=\"#v:unitD\">unitD</a> :: <a href=\"Dist.html#t:Dist\" title=\"Dist\">Dist</a> ()","name":"unitD","module":"Dist","link":"Dist.html#v:unitD"},{"display_html":"<a href=\"#v:multD\">multD</a> :: (<a href=\"/package/base-4.12.0.0/docs/GHC-TypeNats.html#t:KnownNat\" title=\"GHC.TypeNats\">KnownNat</a> (<a href=\"Matrix-Type.html#t:Count\" title=\"Matrix.Type\">Count</a> (<a href=\"Matrix-Type.html#t:Normalize\" title=\"Matrix.Type\">Normalize</a> a)), <a href=\"/package/base-4.12.0.0/docs/GHC-TypeNats.html#t:KnownNat\" title=\"GHC.TypeNats\">KnownNat</a> (<a href=\"Matrix-Type.html#t:Count\" title=\"Matrix.Type\">Count</a> (<a href=\"Matrix-Type.html#t:Normalize\" title=\"Matrix.Type\">Normalize</a> b)), <a href=\"/package/base-4.12.0.0/docs/GHC-TypeNats.html#t:KnownNat\" title=\"GHC.TypeNats\">KnownNat</a> (<a href=\"Matrix-Type.html#t:Count\" title=\"Matrix.Type\">Count</a> (<a href=\"Matrix-Type.html#t:Normalize\" title=\"Matrix.Type\">Normalize</a> (a, b))), <a href=\"Matrix-Type.html#t:FromLists\" title=\"Matrix.Type\">FromLists</a> <a href=\"Dist.html#t:Prob\" title=\"Dist\">Prob</a> (<a href=\"Matrix-Type.html#t:Normalize\" title=\"Matrix.Type\">Normalize</a> (a, b)) (<a href=\"Matrix-Type.html#t:Normalize\" title=\"Matrix.Type\">Normalize</a> a), <a href=\"Matrix-Type.html#t:FromLists\" title=\"Matrix.Type\">FromLists</a> <a href=\"Dist.html#t:Prob\" title=\"Dist\">Prob</a> (<a href=\"Matrix-Type.html#t:Normalize\" title=\"Matrix.Type\">Normalize</a> (a, b)) (<a href=\"Matrix-Type.html#t:Normalize\" title=\"Matrix.Type\">Normalize</a> b), <a href=\"Matrix-Type.html#t:Normalize\" title=\"Matrix.Type\">Normalize</a> (a, b) ~ <a href=\"Matrix-Type.html#t:Normalize\" title=\"Matrix.Type\">Normalize</a> (<a href=\"Matrix-Type.html#t:Normalize\" title=\"Matrix.Type\">Normalize</a> a, <a href=\"Matrix-Type.html#t:Normalize\" title=\"Matrix.Type\">Normalize</a> b)) =&gt; <a href=\"Dist.html#t:Dist\" title=\"Dist\">Dist</a> a -&gt; <a href=\"Dist.html#t:Dist\" title=\"Dist\">Dist</a> b -&gt; <a href=\"Dist.html#t:Dist\" title=\"Dist\">Dist</a> (a, b)","name":"multD","module":"Dist","link":"Dist.html#v:multD"},{"display_html":"<a href=\"#v:selectD\">selectD</a> :: (<a href=\"Matrix-Type.html#t:Normalize\" title=\"Matrix.Type\">Normalize</a> (<a href=\"/package/base-4.12.0.0/docs/Data-Either.html#t:Either\" title=\"Data.Either\">Either</a> a b) ~ <a href=\"/package/base-4.12.0.0/docs/Data-Either.html#t:Either\" title=\"Data.Either\">Either</a> (<a href=\"Matrix-Type.html#t:Normalize\" title=\"Matrix.Type\">Normalize</a> a) (<a href=\"Matrix-Type.html#t:Normalize\" title=\"Matrix.Type\">Normalize</a> b), <a href=\"Matrix-Type.html#t:FromLists\" title=\"Matrix.Type\">FromLists</a> <a href=\"Dist.html#t:Prob\" title=\"Dist\">Prob</a> (<a href=\"Matrix-Type.html#t:Normalize\" title=\"Matrix.Type\">Normalize</a> b) (<a href=\"Matrix-Type.html#t:Normalize\" title=\"Matrix.Type\">Normalize</a> b), <a href=\"/package/base-4.12.0.0/docs/GHC-TypeNats.html#t:KnownNat\" title=\"GHC.TypeNats\">KnownNat</a> (<a href=\"Matrix-Type.html#t:Count\" title=\"Matrix.Type\">Count</a> (<a href=\"Matrix-Type.html#t:Normalize\" title=\"Matrix.Type\">Normalize</a> b))) =&gt; <a href=\"Dist.html#t:Dist\" title=\"Dist\">Dist</a> (<a href=\"/package/base-4.12.0.0/docs/Data-Either.html#t:Either\" title=\"Data.Either\">Either</a> a b) -&gt; <a href=\"Matrix-Type.html#t:Matrix\" title=\"Matrix.Type\">Matrix</a> <a href=\"Dist.html#t:Prob\" title=\"Dist\">Prob</a> a b -&gt; <a href=\"Dist.html#t:Dist\" title=\"Dist\">Dist</a> b","name":"selectD","module":"Dist","link":"Dist.html#v:selectD"},{"display_html":"<a href=\"#v:returnD\">returnD</a> :: <span class=\"keyword\">forall</span> a. (<a href=\"/package/base-4.12.0.0/docs/Prelude.html#t:Enum\" title=\"Prelude\">Enum</a> a, <a href=\"Matrix-Type.html#t:FromLists\" title=\"Matrix.Type\">FromLists</a> <a href=\"Dist.html#t:Prob\" title=\"Dist\">Prob</a> () (<a href=\"Matrix-Type.html#t:Normalize\" title=\"Matrix.Type\">Normalize</a> a), <a href=\"/package/base-4.12.0.0/docs/GHC-TypeNats.html#t:KnownNat\" title=\"GHC.TypeNats\">KnownNat</a> (<a href=\"Matrix-Type.html#t:Count\" title=\"Matrix.Type\">Count</a> a)) =&gt; a -&gt; <a href=\"Dist.html#t:Dist\" title=\"Dist\">Dist</a> a","name":"returnD","module":"Dist","link":"Dist.html#v:returnD"},{"display_html":"<a href=\"#v:bindD\">bindD</a> :: <a href=\"Dist.html#t:Dist\" title=\"Dist\">Dist</a> a -&gt; <a href=\"Matrix-Type.html#t:Matrix\" title=\"Matrix.Type\">Matrix</a> <a href=\"Dist.html#t:Prob\" title=\"Dist\">Prob</a> a b -&gt; <a href=\"Dist.html#t:Dist\" title=\"Dist\">Dist</a> b","name":"bindD","module":"Dist","link":"Dist.html#v:bindD"},{"display_html":"<a href=\"#v:choose\">choose</a> :: <a href=\"Matrix-Type.html#t:FromLists\" title=\"Matrix.Type\">FromLists</a> <a href=\"Dist.html#t:Prob\" title=\"Dist\">Prob</a> () (<a href=\"Matrix-Type.html#t:Normalize\" title=\"Matrix.Type\">Normalize</a> a) =&gt; <a href=\"Dist.html#t:Prob\" title=\"Dist\">Prob</a> -&gt; <a href=\"Dist.html#t:Dist\" title=\"Dist\">Dist</a> a","name":"choose","module":"Dist","link":"Dist.html#v:choose"},{"display_html":"<a href=\"#v:shape\">shape</a> :: <a href=\"Matrix-Type.html#t:FromLists\" title=\"Matrix.Type\">FromLists</a> <a href=\"Dist.html#t:Prob\" title=\"Dist\">Prob</a> () (<a href=\"Matrix-Type.html#t:Normalize\" title=\"Matrix.Type\">Normalize</a> a) =&gt; (<a href=\"Dist.html#t:Prob\" title=\"Dist\">Prob</a> -&gt; <a href=\"Dist.html#t:Prob\" title=\"Dist\">Prob</a>) -&gt; [a] -&gt; <a href=\"Dist.html#t:Dist\" title=\"Dist\">Dist</a> a","name":"shape","module":"Dist","link":"Dist.html#v:shape"},{"display_html":"<a href=\"#v:linear\">linear</a> :: <a href=\"Matrix-Type.html#t:FromLists\" title=\"Matrix.Type\">FromLists</a> <a href=\"Dist.html#t:Prob\" title=\"Dist\">Prob</a> () (<a href=\"Matrix-Type.html#t:Normalize\" title=\"Matrix.Type\">Normalize</a> a) =&gt; [a] -&gt; <a href=\"Dist.html#t:Dist\" title=\"Dist\">Dist</a> a","name":"linear","module":"Dist","link":"Dist.html#v:linear"},{"display_html":"<a href=\"#v:uniform\">uniform</a> :: <a href=\"Matrix-Type.html#t:FromLists\" title=\"Matrix.Type\">FromLists</a> <a href=\"Dist.html#t:Prob\" title=\"Dist\">Prob</a> () (<a href=\"Matrix-Type.html#t:Normalize\" title=\"Matrix.Type\">Normalize</a> a) =&gt; [a] -&gt; <a href=\"Dist.html#t:Dist\" title=\"Dist\">Dist</a> a","name":"uniform","module":"Dist","link":"Dist.html#v:uniform"},{"display_html":"<a href=\"#v:negExp\">negExp</a> :: <a href=\"Matrix-Type.html#t:FromLists\" title=\"Matrix.Type\">FromLists</a> <a href=\"Dist.html#t:Prob\" title=\"Dist\">Prob</a> () (<a href=\"Matrix-Type.html#t:Normalize\" title=\"Matrix.Type\">Normalize</a> a) =&gt; [a] -&gt; <a href=\"Dist.html#t:Dist\" title=\"Dist\">Dist</a> a","name":"negExp","module":"Dist","link":"Dist.html#v:negExp"},{"display_html":"<a href=\"#v:normal\">normal</a> :: <a href=\"Matrix-Type.html#t:FromLists\" title=\"Matrix.Type\">FromLists</a> <a href=\"Dist.html#t:Prob\" title=\"Dist\">Prob</a> () (<a href=\"Matrix-Type.html#t:Normalize\" title=\"Matrix.Type\">Normalize</a> a) =&gt; [a] -&gt; <a href=\"Dist.html#t:Dist\" title=\"Dist\">Dist</a> a","name":"normal","module":"Dist","link":"Dist.html#v:normal"},{"display_html":"<a href=\"#v:toValues\">toValues</a> :: <span class=\"keyword\">forall</span> a. (<a href=\"/package/base-4.12.0.0/docs/Prelude.html#t:Enum\" title=\"Prelude\">Enum</a> a, <a href=\"/package/base-4.12.0.0/docs/GHC-TypeNats.html#t:KnownNat\" title=\"GHC.TypeNats\">KnownNat</a> (<a href=\"Matrix-Type.html#t:Count\" title=\"Matrix.Type\">Count</a> a), <a href=\"Matrix-Type.html#t:FromLists\" title=\"Matrix.Type\">FromLists</a> <a href=\"Dist.html#t:Prob\" title=\"Dist\">Prob</a> () (<a href=\"Matrix-Type.html#t:Normalize\" title=\"Matrix.Type\">Normalize</a> a)) =&gt; <a href=\"Dist.html#t:Dist\" title=\"Dist\">Dist</a> a -&gt; [(a, <a href=\"Dist.html#t:Prob\" title=\"Dist\">Prob</a>)]","name":"toValues","module":"Dist","link":"Dist.html#v:toValues"},{"display_html":"<a href=\"#v:prettyDist\">prettyDist</a> :: <span class=\"keyword\">forall</span> a. (<a href=\"/package/base-4.12.0.0/docs/Text-Show.html#t:Show\" title=\"Text.Show\">Show</a> a, <a href=\"/package/base-4.12.0.0/docs/Prelude.html#t:Enum\" title=\"Prelude\">Enum</a> a, <a href=\"/package/base-4.12.0.0/docs/GHC-TypeNats.html#t:KnownNat\" title=\"GHC.TypeNats\">KnownNat</a> (<a href=\"Matrix-Type.html#t:Count\" title=\"Matrix.Type\">Count</a> a), <a href=\"Matrix-Type.html#t:FromLists\" title=\"Matrix.Type\">FromLists</a> <a href=\"Dist.html#t:Prob\" title=\"Dist\">Prob</a> () (<a href=\"Matrix-Type.html#t:Normalize\" title=\"Matrix.Type\">Normalize</a> a)) =&gt; <a href=\"Dist.html#t:Dist\" title=\"Dist\">Dist</a> a -&gt; <a href=\"/package/base-4.12.0.0/docs/Data-String.html#t:String\" title=\"Data.String\">String</a>","name":"prettyDist","module":"Dist","link":"Dist.html#v:prettyDist"},{"display_html":"<a href=\"#v:prettyPrintDist\">prettyPrintDist</a> :: <span class=\"keyword\">forall</span> a. (<a href=\"/package/base-4.12.0.0/docs/Text-Show.html#t:Show\" title=\"Text.Show\">Show</a> a, <a href=\"/package/base-4.12.0.0/docs/Prelude.html#t:Enum\" title=\"Prelude\">Enum</a> a, <a href=\"/package/base-4.12.0.0/docs/GHC-TypeNats.html#t:KnownNat\" title=\"GHC.TypeNats\">KnownNat</a> (<a href=\"Matrix-Type.html#t:Count\" title=\"Matrix.Type\">Count</a> a), <a href=\"Matrix-Type.html#t:FromLists\" title=\"Matrix.Type\">FromLists</a> <a href=\"Dist.html#t:Prob\" title=\"Dist\">Prob</a> () (<a href=\"Matrix-Type.html#t:Normalize\" title=\"Matrix.Type\">Normalize</a> a)) =&gt; <a href=\"Dist.html#t:Dist\" title=\"Dist\">Dist</a> a -&gt; <a href=\"/package/base-4.12.0.0/docs/System-IO.html#t:IO\" title=\"System.IO\">IO</a> ()","name":"prettyPrintDist","module":"Dist","link":"Dist.html#v:prettyPrintDist"}]
build/x86_64-linux/ghc-8.6.5/laop-0.1.0.0/doc/html/laop-0.1.0.0-docs/haddock-bundle.min.jsnew file+2
@@ -0,0 +1,2 @@
1+!function e(t,n,o){function r(s,a){if(!n[s]){if(!t[s]){var l="function"==typeof require&&require;if(!a&&l)return l(s,!0);if(i)return i(s,!0);var c=new Error("Cannot find module '"+s+"'");throw c.code="MODULE_NOT_FOUND",c}var u=n[s]={exports:{}};t[s][0].call(u.exports,function(e){var n=t[s][1][e];return r(n||e)},u,u.exports,e,t,n,o)}return n[s].exports}for(var i="function"==typeof require&&require,s=0;s<o.length;s++)r(o[s]);return r}({1:[function(e,t,n){"use strict";Object.defineProperty(n,"__esModule",{value:!0}),n.setCookie=function(e,t){document.cookie=e+"="+encodeURIComponent(t)+";path=/;"},n.clearCookie=function(e){document.cookie=e+"=;path=/;expires=Thu, 01-Jan-1970 00:00:01 GMT;"},n.getCookie=function(e){for(var t=e+"=",n=document.cookie.split(";"),o=0;o<n.length;o++){for(var r=n[o];" "==r.charAt(0);)r=r.substring(1,r.length);if(0==r.indexOf(t))return decodeURIComponent(r.substring(t.length,r.length))}return null}},{}],2:[function(e,t,n){"use strict";function o(e){var t=d[e];if(void 0==t)throw new Error("could not find <details> element with id '"+e+"'");return t}function r(e){for(var t=e.target,n=t.id,r=o(n),i=r.element.open,s=0,l=r.toggles;s<l.length;s++){var c=l[s];c.classList.contains("details-toggle-control")&&(c.classList.add(i?"collapser":"expander"),c.classList.remove(i?"expander":"collapser"))}t.open==r.openByDefault?delete p[n]:p[n]=!0,a()}function i(){for(var e=0,t=Array.prototype.slice.call(document.getElementsByTagName("details"));e<t.length;e++){var n=t[e];"string"==typeof n.id&&n.id.length>0&&(d[n.id]={element:n,openByDefault:!!n.open,toggles:[]},n.addEventListener("toggle",r))}}function s(e){var t=o(e).element;t.open=!t.open}function a(){var e=Object.keys(p);document.cookie="toggled="+encodeURIComponent(e.join("+"))}function l(){var e=h.getCookie("toggled");if(e)for(var t=0,n=e.split("+");t<n.length;t++){var o=n[t],r=d[o];p[o]=!0,r&&(r.element.open=!r.element.open)}}function c(e){e.preventDefault();var t=e.currentTarget.getAttribute("data-details-id");if(!t)throw new Error("element with class 'details-toggle' has no 'data-details-id' attribute!");s(t)}function u(){Array.prototype.slice.call(document.getElementsByClassName("details-toggle")).forEach(function(e){var t=e.getAttribute("data-details-id");if(!t)throw new Error("element with class 'details-toggle' has no 'data-details-id' attribute!");var n=o(t);n.toggles.push(e),e.addEventListener("click",c),e.classList.contains("details-toggle-control")&&e.classList.add(n.element.open?"collapser":"expander")})}Object.defineProperty(n,"__esModule",{value:!0});var h=e("./cookies"),d={},p={};n.init=function(){i(),l(),u()}},{"./cookies":1}],3:[function(e,t,n){"use strict";Object.defineProperty(n,"__esModule",{value:!0});var o=e("./style-menu"),r=e("./details-helper"),i=e("./quick-jump");!function(e){"interactive"===document.readyState?e():document.addEventListener("readystatechange",function(){"interactive"===document.readyState&&e()})}(function(){document.body.classList.add("js-enabled"),o.init(),r.init(),i.init()})},{"./details-helper":2,"./quick-jump":4,"./style-menu":5}],4:[function(e,t,n){"use strict";function o(e,t,n){var o=new XMLHttpRequest;o.onreadystatechange=function(){if(o.readyState===XMLHttpRequest.DONE)if(200===o.status){if(t)try{t(JSON.parse(o.responseText))}catch(e){n(o)}}else n&&n(o)},o.open("GET",e,!0),o.send()}function r(e){var t=document.querySelector("#page-menu"),n=document.createElement("li");t.insertBefore(n,t.firstChild),d.render(p(v,{onClick:e,title:"Quick Jump"}),t,n)}function i(e,t){return t.length<=e?t:t.slice(0,e)}function s(){return p("table",{class:"keyboard-shortcuts"},p("tr",null,p("th",null,"Key"),p("th",null,"Shortcut")),p("tr",null,p("td",null,p("span",{class:"key"},"s")),p("td",null,"Open this search box")),p("tr",null,p("td",null,p("span",{class:"key"},"esc")),p("td",null,"Close this search box")),p("tr",null,p("td",null,p("span",{class:"key"},"↓"),",",p("span",{class:"key"},"ctrl")," + ",p("span",{class:"key"},"j")),p("td",null,"Move down in search results")),p("tr",null,p("td",null,p("span",{class:"key"},"↑"),",",p("span",{class:"key"},"ctrl")," + ",p("span",{class:"key"},"k")),p("td",null,"Move up in search results")),p("tr",null,p("td",null,p("span",{class:"key"},"↵")),p("td",null,"Go to active search result")))}function a(){return p("p",null,"You can find any exported type, constructor, class, function or pattern defined in this package by (approximate) name.")}function l(e){var t=[p("p",null,"Your search for '",e.searchString,"' produced the following list of results: ",p("code",null,"[]"),"."),p("p",null,p("code",null,"Nothing")," matches your query for '",e.searchString,"'."),p("p",null,p("code",null,"Left \"no matches for '",e.searchString,"'\" :: Either String (NonEmpty SearchResult)"))];return t[(e.searchString||"a").charCodeAt(0)%t.length]}function c(e,t){d.render(p(g,{baseUrl:e||".",showHideTrigger:t||r}),document.body)}var u=this&&this.__extends||function(){var e=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(e,t){e.__proto__=t}||function(e,t){for(var n in t)t.hasOwnProperty(n)&&(e[n]=t[n])};return function(t,n){function o(){this.constructor=t}e(t,n),t.prototype=null===n?Object.create(n):(o.prototype=n.prototype,new o)}}();Object.defineProperty(n,"__esModule",{value:!0});var h=e("fuse.js"),d=e("preact"),p=d.h,f=d.Component,v=function(e){function t(){return null!==e&&e.apply(this,arguments)||this}return u(t,e),t.prototype.render=function(e){return p("li",null,p("a",{href:"#",onClick:function(t){t.preventDefault(),e.onClick()}},e.title))},t}(f),g=function(e){function t(){var t=null!==e&&e.apply(this,arguments)||this;return t.linkIndex=0,t.focusPlease=!1,t.navigatedByKeyboard=!1,t}return u(t,e),t.prototype.componentWillMount=function(){var e=this;this.setState({searchString:"",isVisible:!1,expanded:{},activeLinkIndex:-1,moduleResults:[]}),o(this.props.baseUrl+"/doc-index.json",function(t){e.setState({fuse:new h(t,{threshold:.25,caseSensitive:!0,includeScore:!0,tokenize:!0,keys:[{name:"name",weight:.7},{name:"module",weight:.3}]}),moduleResults:[]})},function(t){console&&console.error("could not load 'doc-index.json' for searching",t),e.setState({failedLoading:!0})}),document.addEventListener("mousedown",this.hide.bind(this)),document.addEventListener("keydown",function(t){e.state.isVisible&&("Escape"===t.key?e.hide():"ArrowUp"===t.key||"k"===t.key&&t.ctrlKey?(t.preventDefault(),e.navigateLinks(-1)):"ArrowDown"===t.key||"j"===t.key&&t.ctrlKey?(t.preventDefault(),e.navigateLinks(1)):"Enter"===t.key&&e.state.activeLinkIndex>=0&&e.followActiveLink()),"s"===t.key&&"input"!==t.target.tagName.toLowerCase()&&(t.preventDefault(),e.show())})},t.prototype.hide=function(){this.setState({isVisible:!1,searchString:""})},t.prototype.show=function(){this.state.isVisible||(this.focusPlease=!0,this.setState({isVisible:!0,activeLinkIndex:-1}))},t.prototype.toggleVisibility=function(){this.state.isVisible?this.hide():this.show()},t.prototype.navigateLinks=function(e){var t=Math.max(-1,Math.min(this.linkIndex-1,this.state.activeLinkIndex+e));this.navigatedByKeyboard=!0,this.setState({activeLinkIndex:t})},t.prototype.followActiveLink=function(){this.activeLinkAction&&this.activeLinkAction()},t.prototype.updateResults=function(){var e=this.input&&this.input.value||"",t={};this.state.fuse.search(e).forEach(function(e){var n=e.item.module;(t[n]||(t[n]=[])).push(e)});var n=[];for(var o in t)!function(e){var o=t[e],r=0;o.forEach(function(e){r+=1/e.score}),n.push({module:e,totalScore:1/r,items:o})}(o);n.sort(function(e,t){return e.totalScore-t.totalScore}),this.setState({searchString:e,isVisible:!0,moduleResults:n})},t.prototype.componentDidUpdate=function(){if(this.searchResults&&this.activeLink&&this.navigatedByKeyboard){var e=this.activeLink.getClientRects()[0],t=this.searchResults.getClientRects()[0].top;e.bottom>window.innerHeight?this.searchResults.scrollTop+=e.bottom-window.innerHeight+80:e.top<t&&(this.searchResults.scrollTop-=t-e.top+80)}this.focusPlease&&this.input&&this.input.focus(),this.navigatedByKeyboard=!1,this.focusPlease=!1},t.prototype.componentDidMount=function(){this.props.showHideTrigger(this.toggleVisibility.bind(this))},t.prototype.render=function(e,t){var n=this;if(t.failedLoading){var o="file:"==window.location.protocol;return p("div",{id:"search",class:t.isVisible?"":"hidden"},p("div",{id:"search-results"},p("p",{class:"error"},"Failed to load file 'doc-index.json' containing definitions in this package."),o?p("p",{class:"error"},"To use quick jump, load this page with HTTP (from a local static file web server) instead of using the ",p("code",null,"file://")," protocol. (For security reasons, it is not possible to fetch auxiliary files using JS in a HTML page opened with ",p("code",null,"file://"),".)"):[]))}this.linkIndex=0;var r=function(e){e.stopPropagation()},c=i(10,t.moduleResults).map(function(e){return n.renderResultsInModule(e)});return p("div",{id:"search",class:t.isVisible?"":"hidden"},p("div",{id:"search-form",onMouseDown:r},p("input",{placeholder:"Search in package by name",ref:function(e){n.input=e},onFocus:this.show.bind(this),onClick:this.show.bind(this),onInput:this.updateResults.bind(this)})),p("div",{id:"search-results",ref:function(e){n.searchResults=e},onMouseDown:r,onMouseOver:function(e){for(var t=e.target;t&&"function"==typeof t.getAttribute;){var o=t.getAttribute("data-link-index");if("string"==typeof o){var r=parseInt(o,10);n.setState({activeLinkIndex:r});break}t=t.parentNode}}},""===t.searchString?[p(a,null),p(s,null)]:0==c.length?p(l,{searchString:t.searchString}):p("ul",null,c)))},t.prototype.renderResultsInModule=function(e){var t=this,n=e.items,o=e.module,r=this.state.expanded[o]||n.length<=10,s=r?n:i(8,n),a=function(e){return p("li",{class:"search-result"},t.navigationLink(t.props.baseUrl+"/"+e.link,{},p(m,{html:e.display_html})))};return p("li",{class:"search-module"},p("h4",null,o),p("ul",null,s.map(function(e){return a(e.item)}),r?[]:p("li",{class:"more-results"},this.actionLink(function(){var e=Object.assign({},t.state.expanded);e[o]=!0,t.setState({expanded:e})},{},"show "+(n.length-s.length)+" more results from this module"))))},t.prototype.navigationLink=function(e,t){for(var n=this,o=[],r=2;r<arguments.length;r++)o[r-2]=arguments[r];var i=Object.assign({href:e,onClick:this.hide.bind(this)},t);return this.menuLink.apply(this,[i,function(){window.location.href=e,n.hide()}].concat(o))},t.prototype.actionLink=function(e,t){for(var n=[],o=2;o<arguments.length;o++)n[o-2]=arguments[o];var r=Object.assign({href:"#",onClick:function(t){t.preventDefault(),e()}},t);return this.menuLink.apply(this,[r,e].concat(n))},t.prototype.menuLink=function(e,t){for(var n=this,o=[],r=2;r<arguments.length;r++)o[r-2]=arguments[r];var i=this.linkIndex;i===this.state.activeLinkIndex&&(e.class=(e.class?e.class+" ":"")+"active-link",e.ref=function(e){e&&(n.activeLink=e)},this.activeLinkAction=t);var s=Object.assign({"data-link-index":i},e);return this.linkIndex+=1,p.apply(void 0,["a",s].concat(o))},t}(f),m=function(e){function t(){return null!==e&&e.apply(this,arguments)||this}return u(t,e),t.prototype.shouldComponentUpdate=function(e){return this.props.html!==e.html},t.prototype.render=function(e){return p("div",{dangerouslySetInnerHTML:{__html:e.html}})},t}(f);n.init=c,window.quickNav={init:c}},{"fuse.js":6,preact:7}],5:[function(e,t,n){"use strict";function o(e){return(" "+e+" ").replace(g," ")}function r(e){return e.replace(m,"")}function i(e,t){return o(e.className||"").indexOf(" "+t+" ")>=0}function s(e,t){var n=o(e.className||"");n.indexOf(" "+t+" ")<0&&(e.className=r(n+" "+t))}function a(e,t){var n=o(e.className||"");n=n.replace(" "+t+" "," "),e.className=r(n)}function l(e,t,n,o){return null==o&&(o=!i(e,t)),o?(a(e,n),s(e,t)):(a(e,t),s(e,n)),o}function c(e){var t=document.getElementById("page-menu");if(t&&t.firstChild){var n=t.firstChild.cloneNode(!1);n.innerHTML=e,t.appendChild(n)}}function u(){return Array.prototype.slice.call(document.getElementsByTagName("link")).filter(function(e){return-1!=e.rel.indexOf("style")&&e.title})}function h(){var e=u(),t="";e.forEach(function(e){t+="<li><a href='#' onclick=\"setActiveStyleSheet('"+e.title+"'); return false;\">"+e.title+"</a></li>"}),e.length>1&&c("<div id='style-menu-holder'><a href='#' onclick='styleMenu(); return false;'>Style &#9662;</a><ul id='style-menu' class='hide'>"+t+"</ul></div>")}function d(e){for(var t=u(),n=null,o=0;o<t.length;o++){var r=t[o];r.disabled=!0,r.title==e&&(n=r)}n?(n.disabled=!1,v.setCookie("haddock-style",e)):(t[0].disabled=!1,v.clearCookie("haddock-style")),f(!1)}function p(){var e=v.getCookie("haddock-style");e&&d(e)}function f(e){var t=document.getElementById("style-menu");t&&y(t,e)}Object.defineProperty(n,"__esModule",{value:!0});var v=e("./cookies"),g=/\s\s+/g,m=/^\s+|\s+$/g,y=function(e,t){return function(n,o){return l(n,e,t,o)}}("show","hide");n.init=function(){h(),p()}},{"./cookies":1}],6:[function(e,t,n){!function(e,o){"object"==typeof n&&"object"==typeof t?t.exports=o():"function"==typeof define&&define.amd?define("Fuse",[],o):"object"==typeof n?n.Fuse=o():e.Fuse=o()}(this,function(){return function(e){function t(o){if(n[o])return n[o].exports;var r=n[o]={i:o,l:!1,exports:{}};return e[o].call(r.exports,r,r.exports,t),r.l=!0,r.exports}var n={};return t.m=e,t.c=n,t.i=function(e){return e},t.d=function(e,n,o){t.o(e,n)||Object.defineProperty(e,n,{configurable:!1,enumerable:!0,get:o})},t.n=function(e){var n=e&&e.__esModule?function(){return e.default}:function(){return e};return t.d(n,"a",n),n},t.o=function(e,t){return Object.prototype.hasOwnProperty.call(e,t)},t.p="",t(t.s=8)}([function(e,t,n){"use strict";e.exports=function(e){return"[object Array]"===Object.prototype.toString.call(e)}},function(e,t,n){"use strict";function o(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}var r=function(){function e(e,t){for(var n=0;n<t.length;n++){var o=t[n];o.enumerable=o.enumerable||!1,o.configurable=!0,"value"in o&&(o.writable=!0),Object.defineProperty(e,o.key,o)}}return function(t,n,o){return n&&e(t.prototype,n),o&&e(t,o),t}}(),i=n(5),s=n(7),a=n(4),l=function(){function e(t,n){var r=n.location,i=void 0===r?0:r,s=n.distance,l=void 0===s?100:s,c=n.threshold,u=void 0===c?.6:c,h=n.maxPatternLength,d=void 0===h?32:h,p=n.isCaseSensitive,f=void 0!==p&&p,v=n.tokenSeparator,g=void 0===v?/ +/g:v,m=n.findAllMatches,y=void 0!==m&&m,_=n.minMatchCharLength,k=void 0===_?1:_;o(this,e),this.options={location:i,distance:l,threshold:u,maxPatternLength:d,isCaseSensitive:f,tokenSeparator:g,findAllMatches:y,minMatchCharLength:k},this.pattern=this.options.isCaseSensitive?t:t.toLowerCase(),this.pattern.length<=d&&(this.patternAlphabet=a(this.pattern))}return r(e,[{key:"search",value:function(e){if(this.options.isCaseSensitive||(e=e.toLowerCase()),this.pattern===e)return{isMatch:!0,score:0,matchedIndices:[[0,e.length-1]]};var t=this.options,n=t.maxPatternLength,o=t.tokenSeparator;if(this.pattern.length>n)return i(e,this.pattern,o);var r=this.options,a=r.location,l=r.distance,c=r.threshold,u=r.findAllMatches,h=r.minMatchCharLength;return s(e,this.pattern,this.patternAlphabet,{location:a,distance:l,threshold:c,findAllMatches:u,minMatchCharLength:h})}}]),e}();e.exports=l},function(e,t,n){"use strict";var o=n(0),r=function e(t,n,r){if(n){var i=n.indexOf("."),s=n,a=null;-1!==i&&(s=n.slice(0,i),a=n.slice(i+1));var l=t[s];if(null!==l&&void 0!==l)if(a||"string"!=typeof l&&"number"!=typeof l)if(o(l))for(var c=0,u=l.length;c<u;c+=1)e(l[c],a,r);else a&&e(l,a,r);else r.push(l.toString())}else r.push(t);return r};e.exports=function(e,t){return r(e,t,[])}},function(e,t,n){"use strict";e.exports=function(){for(var e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:[],t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:1,n=[],o=-1,r=-1,i=0,s=e.length;i<s;i+=1){var a=e[i];a&&-1===o?o=i:a||-1===o||((r=i-1)-o+1>=t&&n.push([o,r]),o=-1)}return e[i-1]&&i-o>=t&&n.push([o,i-1]),n}},function(e,t,n){"use strict";e.exports=function(e){for(var t={},n=e.length,o=0;o<n;o+=1)t[e.charAt(o)]=0;for(var r=0;r<n;r+=1)t[e.charAt(r)]|=1<<n-r-1;return t}},function(e,t,n){"use strict";var o=/[\-\[\]\/\{\}\(\)\*\+\?\.\\\^\$\|]/g;e.exports=function(e,t){var n=arguments.length>2&&void 0!==arguments[2]?arguments[2]:/ +/g,r=new RegExp(t.replace(o,"\\$&").replace(n,"|")),i=e.match(r),s=!!i,a=[];if(s)for(var l=0,c=i.length;l<c;l+=1){var u=i[l];a.push([e.indexOf(u),u.length-1])}return{score:s?.5:1,isMatch:s,matchedIndices:a}}},function(e,t,n){"use strict";e.exports=function(e,t){var n=t.errors,o=void 0===n?0:n,r=t.currentLocation,i=void 0===r?0:r,s=t.expectedLocation,a=void 0===s?0:s,l=t.distance,c=void 0===l?100:l,u=o/e.length,h=Math.abs(a-i);return c?u+h/c:h?1:u}},function(e,t,n){"use strict";var o=n(6),r=n(3);e.exports=function(e,t,n,i){for(var s=i.location,a=void 0===s?0:s,l=i.distance,c=void 0===l?100:l,u=i.threshold,h=void 0===u?.6:u,d=i.findAllMatches,p=void 0!==d&&d,f=i.minMatchCharLength,v=void 0===f?1:f,g=a,m=e.length,y=h,_=e.indexOf(t,g),k=t.length,b=[],x=0;x<m;x+=1)b[x]=0;if(-1!==_){var w=o(t,{errors:0,currentLocation:_,expectedLocation:g,distance:c});if(y=Math.min(w,y),-1!==(_=e.lastIndexOf(t,g+k))){var S=o(t,{errors:0,currentLocation:_,expectedLocation:g,distance:c});y=Math.min(S,y)}}_=-1;for(var L=[],C=1,M=k+m,N=1<<k-1,I=0;I<k;I+=1){for(var A=0,O=M;A<O;)o(t,{errors:I,currentLocation:g+O,expectedLocation:g,distance:c})<=y?A=O:M=O,O=Math.floor((M-A)/2+A);M=O;var E=Math.max(1,g-O+1),T=p?m:Math.min(g+O,m)+k,j=Array(T+2);j[T+1]=(1<<I)-1;for(var P=T;P>=E;P-=1){var R=P-1,U=n[e.charAt(R)];if(U&&(b[R]=1),j[P]=(j[P+1]<<1|1)&U,0!==I&&(j[P]|=(L[P+1]|L[P])<<1|1|L[P+1]),j[P]&N&&(C=o(t,{errors:I,currentLocation:R,expectedLocation:g,distance:c}))<=y){if(y=C,(_=R)<=g)break;E=Math.max(1,2*g-_)}}if(o(t,{errors:I+1,currentLocation:g,expectedLocation:g,distance:c})>y)break;L=j}return{isMatch:_>=0,score:0===C?.001:C,matchedIndices:r(b,v)}}},function(e,t,n){"use strict";function o(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}var r=function(){function e(e,t){for(var n=0;n<t.length;n++){var o=t[n];o.enumerable=o.enumerable||!1,o.configurable=!0,"value"in o&&(o.writable=!0),Object.defineProperty(e,o.key,o)}}return function(t,n,o){return n&&e(t.prototype,n),o&&e(t,o),t}}(),i=n(1),s=n(2),a=n(0),l=function(){function e(t,n){var r=n.location,i=void 0===r?0:r,a=n.distance,l=void 0===a?100:a,c=n.threshold,u=void 0===c?.6:c,h=n.maxPatternLength,d=void 0===h?32:h,p=n.caseSensitive,f=void 0!==p&&p,v=n.tokenSeparator,g=void 0===v?/ +/g:v,m=n.findAllMatches,y=void 0!==m&&m,_=n.minMatchCharLength,k=void 0===_?1:_,b=n.id,x=void 0===b?null:b,w=n.keys,S=void 0===w?[]:w,L=n.shouldSort,C=void 0===L||L,M=n.getFn,N=void 0===M?s:M,I=n.sortFn,A=void 0===I?function(e,t){return e.score-t.score}:I,O=n.tokenize,E=void 0!==O&&O,T=n.matchAllTokens,j=void 0!==T&&T,P=n.includeMatches,R=void 0!==P&&P,U=n.includeScore,D=void 0!==U&&U,V=n.verbose,F=void 0!==V&&V;o(this,e),this.options={location:i,distance:l,threshold:u,maxPatternLength:d,isCaseSensitive:f,tokenSeparator:g,findAllMatches:y,minMatchCharLength:k,id:x,keys:S,includeMatches:R,includeScore:D,shouldSort:C,getFn:N,sortFn:A,verbose:F,tokenize:E,matchAllTokens:j},this.setCollection(t)}return r(e,[{key:"setCollection",value:function(e){return this.list=e,e}},{key:"search",value:function(e){this._log('---------\nSearch pattern: "'+e+'"');var t=this._prepareSearchers(e),n=t.tokenSearchers,o=t.fullSearcher,r=this._search(n,o),i=r.weights,s=r.results;return this._computeScore(i,s),this.options.shouldSort&&this._sort(s),this._format(s)}},{key:"_prepareSearchers",value:function(){var e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:"",t=[];if(this.options.tokenize)for(var n=e.split(this.options.tokenSeparator),o=0,r=n.length;o<r;o+=1)t.push(new i(n[o],this.options));return{tokenSearchers:t,fullSearcher:new i(e,this.options)}}},{key:"_search",value:function(){var e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:[],t=arguments[1],n=this.list,o={},r=[];if("string"==typeof n[0]){for(var i=0,s=n.length;i<s;i+=1)this._analyze({key:"",value:n[i],record:i,index:i},{resultMap:o,results:r,tokenSearchers:e,fullSearcher:t});return{weights:null,results:r}}for(var a={},l=0,c=n.length;l<c;l+=1)for(var u=n[l],h=0,d=this.options.keys.length;h<d;h+=1){var p=this.options.keys[h];if("string"!=typeof p){if(a[p.name]={weight:1-p.weight||1},p.weight<=0||p.weight>1)throw new Error("Key weight has to be > 0 and <= 1");p=p.name}else a[p]={weight:1};this._analyze({key:p,value:this.options.getFn(u,p),record:u,index:l},{resultMap:o,results:r,tokenSearchers:e,fullSearcher:t})}return{weights:a,results:r}}},{key:"_analyze",value:function(e,t){var n=e.key,o=e.arrayIndex,r=void 0===o?-1:o,i=e.value,s=e.record,l=e.index,c=t.tokenSearchers,u=void 0===c?[]:c,h=t.fullSearcher,d=void 0===h?[]:h,p=t.resultMap,f=void 0===p?{}:p,v=t.results,g=void 0===v?[]:v;if(void 0!==i&&null!==i){var m=!1,y=-1,_=0;if("string"==typeof i){this._log("\nKey: "+(""===n?"-":n));var k=d.search(i);if(this._log('Full text: "'+i+'", score: '+k.score),this.options.tokenize){for(var b=i.split(this.options.tokenSeparator),x=[],w=0;w<u.length;w+=1){var S=u[w];this._log('\nPattern: "'+S.pattern+'"');for(var L=!1,C=0;C<b.length;C+=1){var M=b[C],N=S.search(M),I={};N.isMatch?(I[M]=N.score,m=!0,L=!0,x.push(N.score)):(I[M]=1,this.options.matchAllTokens||x.push(1)),this._log('Token: "'+M+'", score: '+I[M])}L&&(_+=1)}y=x[0];for(var A=x.length,O=1;O<A;O+=1)y+=x[O];y/=A,this._log("Token score average:",y)}var E=k.score;y>-1&&(E=(E+y)/2),this._log("Score average:",E);var T=!this.options.tokenize||!this.options.matchAllTokens||_>=u.length;if(this._log("\nCheck Matches: "+T),(m||k.isMatch)&&T){var j=f[l];j?j.output.push({key:n,arrayIndex:r,value:i,score:E,matchedIndices:k.matchedIndices}):(f[l]={item:s,output:[{key:n,arrayIndex:r,value:i,score:E,matchedIndices:k.matchedIndices}]},g.push(f[l]))}}else if(a(i))for(var P=0,R=i.length;P<R;P+=1)this._analyze({key:n,arrayIndex:P,value:i[P],record:s,index:l},{resultMap:f,results:g,tokenSearchers:u,fullSearcher:d})}}},{key:"_computeScore",value:function(e,t){this._log("\n\nComputing score:\n");for(var n=0,o=t.length;n<o;n+=1){for(var r=t[n].output,i=r.length,s=0,a=1,l=0;l<i;l+=1){var c=r[l].score,u=e?e[r[l].key].weight:1,h=c*u;1!==u?a=Math.min(a,h):(r[l].nScore=h,s+=h)}t[n].score=1===a?s/i:a,this._log(t[n])}}},{key:"_sort",value:function(e){this._log("\n\nSorting...."),e.sort(this.options.sortFn)}},{key:"_format",value:function(e){var t=[];this._log("\n\nOutput:\n\n",JSON.stringify(e));var n=[];this.options.includeMatches&&n.push(function(e,t){var n=e.output;t.matches=[];for(var o=0,r=n.length;o<r;o+=1){var i=n[o];if(0!==i.matchedIndices.length){var s={indices:i.matchedIndices,value:i.value};i.key&&(s.key=i.key),i.hasOwnProperty("arrayIndex")&&i.arrayIndex>-1&&(s.arrayIndex=i.arrayIndex),t.matches.push(s)}}}),this.options.includeScore&&n.push(function(e,t){t.score=e.score});for(var o=0,r=e.length;o<r;o+=1){var i=e[o];if(this.options.id&&(i.item=this.options.getFn(i.item,this.options.id)[0]),n.length){for(var s={item:i.item},a=0,l=n.length;a<l;a+=1)n[a](i,s);t.push(s)}else t.push(i.item)}return t}},{key:"_log",value:function(){if(this.options.verbose){var e;(e=console).log.apply(e,arguments)}}}]),e}();e.exports=l}])})},{}],7:[function(e,t,n){!function(){"use strict";function e(){}function n(t,n){var o,r,i,s,a=O;for(s=arguments.length;s-- >2;)A.push(arguments[s]);for(n&&null!=n.children&&(A.length||A.push(n.children),delete n.children);A.length;)if((r=A.pop())&&void 0!==r.pop)for(s=r.length;s--;)A.push(r[s]);else"boolean"==typeof r&&(r=null),(i="function"!=typeof t)&&(null==r?r="":"number"==typeof r?r=String(r):"string"!=typeof r&&(i=!1)),i&&o?a[a.length-1]+=r:a===O?a=[r]:a.push(r),o=i;var l=new e;return l.nodeName=t,l.children=a,l.attributes=null==n?void 0:n,l.key=null==n?void 0:n.key,void 0!==I.vnode&&I.vnode(l),l}function o(e,t){for(var n in t)e[n]=t[n];return e}function r(e){!e.__d&&(e.__d=!0)&&1==j.push(e)&&(I.debounceRendering||E)(i)}function i(){var e,t=j;for(j=[];e=t.pop();)e.__d&&L(e)}function s(e,t,n){return"string"==typeof t||"number"==typeof t?void 0!==e.splitText:"string"==typeof t.nodeName?!e._componentConstructor&&a(e,t.nodeName):n||e._componentConstructor===t.nodeName}function a(e,t){return e.__n===t||e.nodeName.toLowerCase()===t.toLowerCase()}function l(e){var t=o({},e.attributes);t.children=e.children;var n=e.nodeName.defaultProps;if(void 0!==n)for(var r in n)void 0===t[r]&&(t[r]=n[r]);return t}function c(e,t){var n=t?document.createElementNS("http://www.w3.org/2000/svg",e):document.createElement(e);return n.__n=e,n}function u(e){var t=e.parentNode;t&&t.removeChild(e)}function h(e,t,n,o,r){if("className"===t&&(t="class"),"key"===t);else if("ref"===t)n&&n(null),o&&o(e);else if("class"!==t||r)if("style"===t){if(o&&"string"!=typeof o&&"string"!=typeof n||(e.style.cssText=o||""),o&&"object"==typeof o){if("string"!=typeof n)for(var i in n)i in o||(e.style[i]="");for(var i in o)e.style[i]="number"==typeof o[i]&&!1===T.test(i)?o[i]+"px":o[i]}}else if("dangerouslySetInnerHTML"===t)o&&(e.innerHTML=o.__html||"");else if("o"==t[0]&&"n"==t[1]){var s=t!==(t=t.replace(/Capture$/,""));t=t.toLowerCase().substring(2),o?n||e.addEventListener(t,p,s):e.removeEventListener(t,p,s),(e.__l||(e.__l={}))[t]=o}else if("list"!==t&&"type"!==t&&!r&&t in e)d(e,t,null==o?"":o),null!=o&&!1!==o||e.removeAttribute(t);else{var a=r&&t!==(t=t.replace(/^xlink\:?/,""));null==o||!1===o?a?e.removeAttributeNS("http://www.w3.org/1999/xlink",t.toLowerCase()):e.removeAttribute(t):"function"!=typeof o&&(a?e.setAttributeNS("http://www.w3.org/1999/xlink",t.toLowerCase(),o):e.setAttribute(t,o))}else e.className=o||""}function d(e,t,n){try{e[t]=n}catch(e){}}function p(e){return this.__l[e.type](I.event&&I.event(e)||e)}function f(){for(var e;e=P.pop();)I.afterMount&&I.afterMount(e),e.componentDidMount&&e.componentDidMount()}function v(e,t,n,o,r,i){R++||(U=null!=r&&void 0!==r.ownerSVGElement,D=null!=e&&!("__preactattr_"in e));var s=g(e,t,n,o,i);return r&&s.parentNode!==r&&r.appendChild(s),--R||(D=!1,i||f()),s}function g(e,t,n,o,r){var i=e,s=U;if(null!=t&&"boolean"!=typeof t||(t=""),"string"==typeof t||"number"==typeof t)return e&&void 0!==e.splitText&&e.parentNode&&(!e._component||r)?e.nodeValue!=t&&(e.nodeValue=t):(i=document.createTextNode(t),e&&(e.parentNode&&e.parentNode.replaceChild(i,e),y(e,!0))),i.__preactattr_=!0,i;var l=t.nodeName;if("function"==typeof l)return C(e,t,n,o);if(U="svg"===l||"foreignObject"!==l&&U,l=String(l),(!e||!a(e,l))&&(i=c(l,U),e)){for(;e.firstChild;)i.appendChild(e.firstChild);e.parentNode&&e.parentNode.replaceChild(i,e),y(e,!0)}var u=i.firstChild,h=i.__preactattr_,d=t.children;if(null==h){h=i.__preactattr_={};for(var p=i.attributes,f=p.length;f--;)h[p[f].name]=p[f].value}return!D&&d&&1===d.length&&"string"==typeof d[0]&&null!=u&&void 0!==u.splitText&&null==u.nextSibling?u.nodeValue!=d[0]&&(u.nodeValue=d[0]):(d&&d.length||null!=u)&&m(i,d,n,o,D||null!=h.dangerouslySetInnerHTML),k(i,t.attributes,h),U=s,i}function m(e,t,n,o,r){var i,a,l,c,h,d=e.childNodes,p=[],f={},v=0,m=0,_=d.length,k=0,b=t?t.length:0;if(0!==_)for(L=0;L<_;L++){var x=d[L],w=x.__preactattr_;null!=(S=b&&w?x._component?x._component.__k:w.key:null)?(v++,f[S]=x):(w||(void 0!==x.splitText?!r||x.nodeValue.trim():r))&&(p[k++]=x)}if(0!==b)for(L=0;L<b;L++){h=null;var S=(c=t[L]).key;if(null!=S)v&&void 0!==f[S]&&(h=f[S],f[S]=void 0,v--);else if(!h&&m<k)for(i=m;i<k;i++)if(void 0!==p[i]&&s(a=p[i],c,r)){h=a,p[i]=void 0,i===k-1&&k--,i===m&&m++;break}h=g(h,c,n,o),l=d[L],h&&h!==e&&h!==l&&(null==l?e.appendChild(h):h===l.nextSibling?u(l):e.insertBefore(h,l))}if(v)for(var L in f)void 0!==f[L]&&y(f[L],!1);for(;m<=k;)void 0!==(h=p[k--])&&y(h,!1)}function y(e,t){var n=e._component;n?M(n):(null!=e.__preactattr_&&e.__preactattr_.ref&&e.__preactattr_.ref(null),!1!==t&&null!=e.__preactattr_||u(e),_(e))}function _(e){for(e=e.lastChild;e;){var t=e.previousSibling;y(e,!0),e=t}}function k(e,t,n){var o;for(o in n)t&&null!=t[o]||null==n[o]||h(e,o,n[o],n[o]=void 0,U);for(o in t)"children"===o||"innerHTML"===o||o in n&&t[o]===("value"===o||"checked"===o?e[o]:n[o])||h(e,o,n[o],n[o]=t[o],U)}function b(e){var t=e.constructor.name;(V[t]||(V[t]=[])).push(e)}function x(e,t,n){var o,r=V[e.name];if(e.prototype&&e.prototype.render?(o=new e(t,n),N.call(o,t,n)):((o=new N(t,n)).constructor=e,o.render=w),r)for(var i=r.length;i--;)if(r[i].constructor===e){o.__b=r[i].__b,r.splice(i,1);break}return o}function w(e,t,n){return this.constructor(e,n)}function S(e,t,n,o,i){e.__x||(e.__x=!0,(e.__r=t.ref)&&delete t.ref,(e.__k=t.key)&&delete t.key,!e.base||i?e.componentWillMount&&e.componentWillMount():e.componentWillReceiveProps&&e.componentWillReceiveProps(t,o),o&&o!==e.context&&(e.__c||(e.__c=e.context),e.context=o),e.__p||(e.__p=e.props),e.props=t,e.__x=!1,0!==n&&(1!==n&&!1===I.syncComponentUpdates&&e.base?r(e):L(e,1,i)),e.__r&&e.__r(e))}function L(e,t,n,r){if(!e.__x){var i,s,a,c=e.props,u=e.state,h=e.context,d=e.__p||c,p=e.__s||u,g=e.__c||h,m=e.base,_=e.__b,k=m||_,b=e._component,w=!1;if(m&&(e.props=d,e.state=p,e.context=g,2!==t&&e.shouldComponentUpdate&&!1===e.shouldComponentUpdate(c,u,h)?w=!0:e.componentWillUpdate&&e.componentWillUpdate(c,u,h),e.props=c,e.state=u,e.context=h),e.__p=e.__s=e.__c=e.__b=null,e.__d=!1,!w){i=e.render(c,u,h),e.getChildContext&&(h=o(o({},h),e.getChildContext()));var C,N,A=i&&i.nodeName;if("function"==typeof A){var O=l(i);(s=b)&&s.constructor===A&&O.key==s.__k?S(s,O,1,h,!1):(C=s,e._component=s=x(A,O,h),s.__b=s.__b||_,s.__u=e,S(s,O,0,h,!1),L(s,1,n,!0)),N=s.base}else a=k,(C=b)&&(a=e._component=null),(k||1===t)&&(a&&(a._component=null),N=v(a,i,h,n||!m,k&&k.parentNode,!0));if(k&&N!==k&&s!==b){var E=k.parentNode;E&&N!==E&&(E.replaceChild(N,k),C||(k._component=null,y(k,!1)))}if(C&&M(C),e.base=N,N&&!r){for(var T=e,j=e;j=j.__u;)(T=j).base=N;N._component=T,N._componentConstructor=T.constructor}}if(!m||n?P.unshift(e):w||(e.componentDidUpdate&&e.componentDidUpdate(d,p,g),I.afterUpdate&&I.afterUpdate(e)),null!=e.__h)for(;e.__h.length;)e.__h.pop().call(e);R||r||f()}}function C(e,t,n,o){for(var r=e&&e._component,i=r,s=e,a=r&&e._componentConstructor===t.nodeName,c=a,u=l(t);r&&!c&&(r=r.__u);)c=r.constructor===t.nodeName;return r&&c&&(!o||r._component)?(S(r,u,3,n,o),e=r.base):(i&&!a&&(M(i),e=s=null),r=x(t.nodeName,u,n),e&&!r.__b&&(r.__b=e,s=null),S(r,u,1,n,o),e=r.base,s&&e!==s&&(s._component=null,y(s,!1))),e}function M(e){I.beforeUnmount&&I.beforeUnmount(e);var t=e.base;e.__x=!0,e.componentWillUnmount&&e.componentWillUnmount(),e.base=null;var n=e._component;n?M(n):t&&(t.__preactattr_&&t.__preactattr_.ref&&t.__preactattr_.ref(null),e.__b=t,u(t),b(e),_(t)),e.__r&&e.__r(null)}function N(e,t){this.__d=!0,this.context=t,this.props=e,this.state=this.state||{}}var I={},A=[],O=[],E="function"==typeof Promise?Promise.resolve().then.bind(Promise.resolve()):setTimeout,T=/acit|ex(?:s|g|n|p|$)|rph|ows|mnc|ntw|ine[ch]|zoo|^ord/i,j=[],P=[],R=0,U=!1,D=!1,V={};o(N.prototype,{setState:function(e,t){var n=this.state;this.__s||(this.__s=o({},n)),o(n,"function"==typeof e?e(n,this.props):e),t&&(this.__h=this.__h||[]).push(t),r(this)},forceUpdate:function(e){e&&(this.__h=this.__h||[]).push(e),L(this,2)},render:function(){}});var F={h:n,createElement:n,cloneElement:function(e,t){return n(e.nodeName,o(o({},e.attributes),t),arguments.length>2?[].slice.call(arguments,2):e.children)},Component:N,render:function(e,t,n){return v(n,e,{},!1,t,!1)},rerender:i,options:I};void 0!==t?t.exports=F:self.preact=F}()},{}]},{},[3]);
2+//# sourceMappingURL=haddock-bundle.min.js.map
build/x86_64-linux/ghc-8.6.5/laop-0.1.0.0/doc/html/laop-0.1.0.0-docs/hslogo-16.pngnew file

Binary file not shown.

build/x86_64-linux/ghc-8.6.5/laop-0.1.0.0/doc/html/laop-0.1.0.0-docs/laop.haddocknew file

Binary file not shown.

build/x86_64-linux/ghc-8.6.5/laop-0.1.0.0/doc/html/laop-0.1.0.0-docs/laop.txtnew file+429
@@ -0,0 +1,429 @@
1+-- Hoogle documentation, generated by Haddock
2+-- See Hoogle, http://www.haskell.org/hoogle/
3+
4+
5+-- | An inductive matrix definition library à la LAoP
6+--
7+-- Please see the README on GitHub at
8+-- <a>https://github.com/bolt12/laop#readme</a>
9+@package laop
10+@version 0.1.0.0
11+
12+
13+-- | <b>LAoP</b> is a library for algebraic (inductive) construction and
14+-- manipulation of matrices in Haskell. See <a>my Msc Thesis</a> for the
15+-- motivation behind the library, the underlying theory, and
16+-- implementation details.
17+--
18+-- This module provides the <a>Natural</a> data type. The semantic
19+-- associated with this data type is that it's meant to be a restricted
20+-- <a>Int</a> value.
21+module Utils
22+
23+-- | Wrapper around <a>Int</a>s that have a restrictive semantic
24+-- associated. A value of type <tt><a>Natural</a> n m</tt> can only be
25+-- instanciated with some <a>Int</a> <tt>i</tt> that's <tt>n &lt;= i
26+-- &lt;= m</tt>.
27+data Natural (start :: Nat) (end :: Nat)
28+
29+-- | Natural constructor function. Throws a runtime error if the <a>Int</a>
30+-- value is greater than the corresponding <tt>m</tt> or lower than
31+-- <tt>n</tt> in the <tt><a>Natural</a> n m</tt> type.
32+nat :: forall n m. (KnownNat n, KnownNat m) => Int -> Natural n m
33+
34+-- | Auxiliary function that promotes binary <a>Int</a> functions to
35+-- <a>Natural</a> binary functions.
36+coerceNat :: (Int -> Int -> Int) -> Natural a a' -> Natural b b' -> Natural c c'
37+
38+-- | Auxiliary function that promotes ternary (binary) <a>Int</a> functions
39+-- to <a>Natural</a> functions.
40+coerceNat2 :: ((Int, Int) -> Int -> Int) -> (Natural a a', Natural b b') -> Natural c c' -> Natural d d'
41+
42+-- | Auxiliary function that promotes ternary (binary) <a>Int</a> functions
43+-- to <a>Natural</a> functions.
44+coerceNat3 :: (Int -> Int -> a) -> Natural b b' -> Natural c c' -> a
45+
46+
47+-- | The LAoP discipline generalises relations and functions treating them
48+-- as Boolean matrices and in turn consider these as arrows.
49+--
50+-- <b>LAoP</b> is a library for algebraic (inductive) construction and
51+-- manipulation of matrices in Haskell. See <a>my Msc Thesis</a> for the
52+-- motivation behind the library, the underlying theory, and
53+-- implementation details.
54+--
55+-- This module offers a newtype wrapper around <a>Matrix</a> that uses
56+-- arbitrary types instead of canonical data types for the matrices
57+-- dimensions.
58+--
59+-- <b>NOTE</b>: If the types in the dimensions are custom they must need
60+-- to implement a <tt>Generic</tt> instance.
61+module Matrix.Type
62+newtype Matrix e (cols :: Type) (rows :: Type)
63+M :: Matrix e (Normalize cols) (Normalize rows) -> Matrix e
64+
65+-- | Zero type alias
66+type Zero = Void
67+
68+-- | One type alias
69+type One = ()
70+
71+-- | Empty matrix constructor
72+empty :: Matrix e Zero Zero
73+
74+-- | Unit matrix constructor
75+one :: e -> Matrix e One One
76+
77+-- | Matrix <tt>Junc</tt> constructor
78+junc :: Normalize (Either a b) ~ Either (Normalize a) (Normalize b) => Matrix e a rows -> Matrix e b rows -> Matrix e (Either a b) rows
79+
80+-- | Matrix <tt>Split</tt> constructor
81+split :: Normalize (Either a b) ~ Either (Normalize a) (Normalize b) => Matrix e cols a -> Matrix e cols b -> Matrix e cols (Either a b)
82+
83+-- | Type family that computes of a given type dimension from a given
84+-- natural
85+--
86+-- Thanks to Li-Yao Xia this type family is super fast.
87+type family FromNat (n :: Nat) :: Type
88+
89+-- | Type family that computes the cardinality of a given type dimension.
90+--
91+-- It can also count the cardinality of custom types that implement the
92+-- <a>Generic</a> instance.
93+type family Count (d :: Type) :: Nat
94+
95+-- | Type family that normalizes the representation of a given data
96+-- structure
97+type family Normalize (d :: Type) :: Type
98+
99+-- | Type class for defining the <tt>fromList</tt> conversion function.
100+--
101+-- Given that it is not possible to branch on types at the term level
102+-- type classes are needed bery much like an inductive definition but on
103+-- types.
104+class FromLists e cols rows
105+
106+-- | Build a matrix out of a list of list of elements. Throws a runtime
107+-- error if the dimensions do not match.
108+fromLists :: FromLists e (Normalize cols) (Normalize rows) => [[e]] -> Matrix e cols rows
109+
110+-- | Converts a matrix to a list of lists of elements.
111+toLists :: Matrix e cols rows -> [[e]]
112+
113+-- | Converts a matrix to a list of elements.
114+toList :: Matrix e cols rows -> [e]
115+
116+-- | Matrix builder function. Constructs a matrix provided with a
117+-- construction function.
118+matrixBuilder :: (FromLists e (Normalize cols) (Normalize rows), KnownNat (Count (Normalize cols)), KnownNat (Count (Normalize rows))) => ((Int, Int) -> e) -> Matrix e cols rows
119+
120+-- | Constructs a row vector matrix
121+row :: FromLists e (Normalize cols) () => [e] -> Matrix e cols One
122+
123+-- | Constructs a column vector matrix
124+col :: FromLists e () (Normalize rows) => [e] -> Matrix e One rows
125+
126+-- | The zero matrix. A matrix wholly filled with zeros.
127+zeros :: (Num e, FromLists e (Normalize cols) (Normalize rows), KnownNat (Count (Normalize cols)), KnownNat (Count (Normalize rows))) => Matrix e cols rows
128+
129+-- | The ones matrix. A matrix wholly filled with ones.
130+--
131+-- Also known as T (Top) matrix.
132+ones :: (Num e, FromLists e (Normalize cols) (Normalize rows), KnownNat (Count (Normalize cols)), KnownNat (Count (Normalize rows))) => Matrix e cols rows
133+
134+-- | The T (Top) row vector matrix.
135+bang :: forall e cols. (Num e, Enum e, FromLists e (Normalize cols) (), KnownNat (Count (Normalize cols))) => Matrix e cols One
136+
137+-- | The constant matrix constructor. A matrix wholly filled with a given
138+-- value.
139+constant :: (Num e, FromLists e (Normalize cols) (Normalize rows), KnownNat (Count (Normalize cols)), KnownNat (Count (Normalize rows))) => e -> Matrix e cols rows
140+
141+-- | Functor instance equivalent function
142+fmapM :: (Bounded a, Bounded b, Enum a, Enum b, Eq b, Num e, Ord e, KnownNat (Count (Normalize a)), KnownNat (Count (Normalize b)), FromLists e (Normalize b) (Normalize a)) => (a -> b) -> Matrix e c a -> Matrix e c b
143+
144+-- | Applicative instance equivalent <tt>unit</tt> function,
145+unitM :: Num e => Matrix e () ()
146+
147+-- | Applicative instance equivalent <tt>unit</tt> function,
148+multM :: (KnownNat (Count (Normalize a)), KnownNat (Count (Normalize b)), KnownNat (Count (Normalize (a, b))), Num e, FromLists e (Normalize (a, b)) (Normalize a), FromLists e (Normalize (a, b)) (Normalize b), Normalize (a, b) ~ Normalize (Normalize a, Normalize b)) => Matrix e c a -> Matrix e c b -> Matrix e c (a, b)
149+
150+-- | Selective functors <tt>select</tt> operator equivalent inspired by the
151+-- ArrowMonad solution presented in the paper.
152+selectM :: (Num e, FromLists e (Normalize b) (Normalize b), KnownNat (Count (Normalize b)), Normalize (Either a b) ~ Either (Normalize a) (Normalize b)) => Matrix e cols (Either a b) -> Matrix e a b -> Matrix e cols b
153+
154+-- | Monad instance equivalent <a>return</a> function,
155+returnM :: forall e a. (Num e, Enum e, Enum a, FromLists e () (Normalize a), KnownNat (Count a)) => a -> Matrix e One a
156+
157+-- | Monad instance equivalent '(&gt;&gt;=)' function,
158+bindM :: Num e => Matrix e a b -> Matrix e b c -> Matrix e a c
159+
160+-- | Obtain the number of columns.
161+--
162+-- NOTE: The <a>KnownNat</a> constaint is needed in order to obtain the
163+-- dimensions in constant time.
164+--
165+-- TODO: A <a>columns</a> function that does not need the <a>KnownNat</a>
166+-- constraint in exchange for performance.
167+columns :: KnownNat (Count (Normalize cols)) => Matrix e cols rows -> Int
168+
169+-- | Obtain the number of rows.
170+--
171+-- NOTE: The <a>KnownNat</a> constaint is needed in order to obtain the
172+-- dimensions in constant time.
173+--
174+-- TODO: A <a>rows</a> function that does not need the <a>KnownNat</a>
175+-- constraint in exchange for performance.
176+rows :: KnownNat (Count (Normalize rows)) => Matrix e cols rows -> Int
177+
178+-- | Matrix transposition.
179+tr :: Matrix e cols rows -> Matrix e rows cols
180+
181+-- | McCarthy's Conditional expresses probabilistic choice.
182+cond :: (Normalize (Normalize a) ~ Normalize a, KnownNat (Count (Normalize a)), FromLists e () (Normalize a), FromLists e (Normalize a) (), FromLists e (Normalize a) (Normalize a), Bounded a, Enum a, Num e, Ord e) => (a -> Bool) -> Matrix e a b -> Matrix e a b -> Matrix e a b
183+
184+-- | Matrix "abiding" followin the 'Junc'-'Split' abide law.
185+--
186+-- Law:
187+--
188+-- <pre>
189+-- <tt>Junc</tt> (<tt>Split</tt> a c) (<tt>Split</tt> b d) == <tt>Split</tt> (<tt>Junc</tt> a b) (<tt>Junc</tt> c d)
190+-- </pre>
191+abideJS :: Matrix e cols rows -> Matrix e cols rows
192+
193+-- | Matrix "abiding" followin the 'Split'-'Junc' abide law.
194+--
195+-- Law:
196+--
197+-- <pre>
198+-- <tt>Split</tt> (<tt>Junc</tt> a b) (<tt>Junc</tt> c d) == <tt>Junc</tt> (<tt>Split</tt> a c) (<tt>Split</tt> b d)
199+-- </pre>
200+abideSJ :: Matrix e cols rows -> Matrix e cols rows
201+
202+-- | Matrix <tt>Split</tt> constructor
203+(===) :: Normalize (Either a b) ~ Either (Normalize a) (Normalize b) => Matrix e cols a -> Matrix e cols b -> Matrix e cols (Either a b)
204+infixl 2 ===
205+
206+-- | Biproduct first component projection
207+p1 :: (Num e, KnownNat (Count (Normalize n)), KnownNat (Count (Normalize m)), FromLists e (Normalize n) (Normalize m), FromLists e (Normalize m) (Normalize m), Normalize (Either m n) ~ Either (Normalize m) (Normalize n)) => Matrix e (Either m n) m
208+
209+-- | Biproduct second component projection
210+p2 :: (Num e, KnownNat (Count (Normalize n)), KnownNat (Count (Normalize m)), FromLists e (Normalize m) (Normalize n), FromLists e (Normalize n) (Normalize n), Normalize (Either m n) ~ Either (Normalize m) (Normalize n)) => Matrix e (Either m n) n
211+
212+-- | Matrix <tt>Junc</tt> constructor
213+(|||) :: Normalize (Either a b) ~ Either (Normalize a) (Normalize b) => Matrix e a rows -> Matrix e b rows -> Matrix e (Either a b) rows
214+infixl 3 |||
215+
216+-- | Biproduct first component injection
217+i1 :: (Num e, KnownNat (Count (Normalize n)), KnownNat (Count (Normalize m)), FromLists e (Normalize n) (Normalize m), FromLists e (Normalize m) (Normalize m), Normalize (Either m n) ~ Either (Normalize m) (Normalize n)) => Matrix e m (Either m n)
218+
219+-- | Biproduct second component injection
220+i2 :: (Num e, KnownNat (Count (Normalize n)), KnownNat (Count (Normalize m)), FromLists e (Normalize m) (Normalize n), FromLists e (Normalize n) (Normalize n), Normalize (Either m n) ~ Either (Normalize m) (Normalize n)) => Matrix e n (Either m n)
221+
222+-- | Matrix coproduct functor also known as matrix direct sum.
223+(-|-) :: (Num e, KnownNat (Count (Normalize j)), KnownNat (Count (Normalize k)), FromLists e (Normalize k) (Normalize k), FromLists e (Normalize j) (Normalize k), FromLists e (Normalize k) (Normalize j), FromLists e (Normalize j) (Normalize j), Normalize (Either n m) ~ Either (Normalize n) (Normalize m), Normalize (Either k j) ~ Either (Normalize k) (Normalize j)) => Matrix e n k -> Matrix e m j -> Matrix e (Either n m) (Either k j)
224+infixl 5 -|-
225+
226+-- | Matrix product functor also known as kronecker product
227+(><) :: forall e m p n q. (Num e, KnownNat (Count (Normalize m)), KnownNat (Count (Normalize n)), KnownNat (Count (Normalize p)), KnownNat (Count (Normalize q)), KnownNat (Count (Normalize (m, n))), KnownNat (Count (Normalize (p, q))), FromLists e (Normalize (m, n)) (Normalize m), FromLists e (Normalize (m, n)) (Normalize n), FromLists e (Normalize (p, q)) (Normalize p), FromLists e (Normalize (p, q)) (Normalize q), Normalize (m, n) ~ Normalize (Normalize m, Normalize n), Normalize (p, q) ~ Normalize (Normalize p, Normalize q)) => Matrix e m p -> Matrix e n q -> Matrix e (m, n) (p, q)
228+infixl 4 ><
229+
230+-- | Khatri Rao product first component projection matrix.
231+kp1 :: forall e m k. (Num e, KnownNat (Count (Normalize m)), KnownNat (Count (Normalize k)), KnownNat (Count (Normalize (m, k))), FromLists e (Normalize (m, k)) (Normalize m), Normalize (m, k) ~ Normalize (Normalize m, Normalize k)) => Matrix e (m, k) m
232+
233+-- | Khatri Rao product second component projection matrix.
234+kp2 :: forall e m k. (Num e, KnownNat (Count (Normalize k)), KnownNat (Count (Normalize m)), KnownNat (Count (Normalize (m, k))), FromLists e (Normalize (m, k)) (Normalize k), Normalize (m, k) ~ Normalize (Normalize m, Normalize k)) => Matrix e (m, k) k
235+
236+-- | Khatri Rao Matrix product also known as matrix pairing.
237+--
238+-- NOTE: That this is not a true categorical product, see for instance:
239+--
240+-- <pre>
241+-- | kp1 <a>comp</a> khatri a b == a
242+-- khatri a b ==&gt; |
243+-- | kp2 <a>comp</a> khatri a b == b
244+-- </pre>
245+--
246+-- <b>Emphasis</b> on the implication symbol.
247+khatri :: forall e cols a b. (Num e, KnownNat (Count (Normalize a)), KnownNat (Count (Normalize b)), KnownNat (Count (Normalize (a, b))), FromLists e (Normalize (a, b)) (Normalize a), FromLists e (Normalize (a, b)) (Normalize b), Normalize (a, b) ~ Normalize (Normalize a, Normalize b)) => Matrix e cols a -> Matrix e cols b -> Matrix e cols (a, b)
248+
249+-- | Identity matrix
250+identity :: (Num e, FromLists e (Normalize a) (Normalize a), KnownNat (Count (Normalize a))) => Matrix e a a
251+
252+-- | Matrix composition. Equivalent to matrix-matrix multiplication.
253+--
254+-- This definition takes advantage of divide-and-conquer and fusion laws
255+-- from LAoP.
256+comp :: Num e => Matrix e cr rows -> Matrix e cols cr -> Matrix e cols rows
257+
258+-- | Lifts functions to matrices with arbitrary dimensions.
259+--
260+-- NOTE: Be careful to not ask for a matrix bigger than the cardinality
261+-- of types <tt>a</tt> or <tt>b</tt> allows.
262+fromF :: (Bounded a, Bounded b, Enum a, Enum b, Eq b, Num e, Ord e, KnownNat (Count (Normalize cols)), KnownNat (Count (Normalize rows)), FromLists e (Normalize rows) (Normalize cols)) => (a -> b) -> Matrix e cols rows
263+
264+-- | Lifts functions to matrices with dimensions matching <tt>a</tt> and
265+-- <tt>b</tt> cardinality's.
266+fromF' :: (Bounded a, Bounded b, Enum a, Enum b, Eq b, Num e, Ord e, KnownNat (Count (Normalize a)), KnownNat (Count (Normalize b)), FromLists e (Normalize b) (Normalize a)) => (a -> b) -> Matrix e a b
267+
268+-- | Matrix pretty printer
269+pretty :: (KnownNat (Count (Normalize cols)), Show e) => Matrix e cols rows -> String
270+
271+-- | Matrix pretty printer
272+prettyPrint :: (KnownNat (Count (Normalize cols)), Show e) => Matrix e cols rows -> IO ()
273+instance Control.DeepSeq.NFData e => Control.DeepSeq.NFData (Matrix.Type.Matrix e cols rows)
274+instance GHC.Classes.Ord e => GHC.Classes.Ord (Matrix.Type.Matrix e cols rows)
275+instance GHC.Classes.Eq e => GHC.Classes.Eq (Matrix.Type.Matrix e cols rows)
276+instance GHC.Num.Num e => GHC.Num.Num (Matrix.Type.Matrix e cols rows)
277+instance GHC.Show.Show e => GHC.Show.Show (Matrix.Type.Matrix e cols rows)
278+instance GHC.Num.Num e => Control.Category.Category (Matrix.Type.Matrix e)
279+
280+
281+-- | The LAoP discipline generalises relations and functions treating them
282+-- as Boolean matrices and in turn consider these as arrows.
283+--
284+-- <b>LAoP</b> is a library for algebraic (inductive) construction and
285+-- manipulation of matrices in Haskell. See <a>my Msc Thesis</a> for the
286+-- motivation behind the library, the underlying theory, and
287+-- implementation details.
288+--
289+-- This module offers a newtype wrapper around <a>Matrix</a> that uses
290+-- type level naturals instead of standard data types for the matrices
291+-- dimensions.
292+module Matrix.Nat
293+newtype Matrix e (cols :: Nat) (rows :: Nat)
294+M :: Matrix e (FromNat cols) (FromNat rows) -> Matrix e
295+empty :: Matrix e 0 0
296+one :: e -> Matrix e 1 1
297+junc :: FromNat cols3 ~ Either (FromNat cols1) (FromNat cols2) => Matrix e cols1 rows -> Matrix e cols2 rows -> Matrix e cols3 rows
298+split :: FromNat rows3 ~ Either (FromNat rows1) (FromNat rows2) => Matrix e cols rows1 -> Matrix e cols rows2 -> Matrix e cols rows3
299+
300+-- | Type family that computes of a given type dimension from a given
301+-- natural
302+--
303+-- Thanks to Li-Yao Xia this type family is super fast.
304+type family FromNat (n :: Nat) :: Type
305+
306+-- | Type family that computes the cardinality of a given type dimension.
307+--
308+-- It can also count the cardinality of custom types that implement the
309+-- <a>Generic</a> instance.
310+type family Count (d :: Type) :: Nat
311+
312+-- | Type family that normalizes the representation of a given data
313+-- structure
314+type family Normalize (d :: Type) :: Type
315+
316+-- | Type class for defining the <tt>fromList</tt> conversion function.
317+--
318+-- Given that it is not possible to branch on types at the term level
319+-- type classes are needed bery much like an inductive definition but on
320+-- types.
321+class FromLists e cols rows
322+fromLists :: FromLists e (FromNat cols) (FromNat rows) => [[e]] -> Matrix e cols rows
323+toLists :: Matrix e cols rows -> [[e]]
324+toList :: Matrix e cols rows -> [e]
325+matrixBuilder :: (FromLists e (FromNat cols) (FromNat rows), KnownNat (Count (FromNat cols)), KnownNat (Count (FromNat rows))) => ((Int, Int) -> e) -> Matrix e cols rows
326+row :: FromLists e (FromNat cols) () => [e] -> Matrix e cols 1
327+col :: FromLists e () (FromNat rows) => [e] -> Matrix e 1 rows
328+zeros :: (Num e, FromLists e (FromNat cols) (FromNat rows), KnownNat (Count (FromNat cols)), KnownNat (Count (FromNat rows))) => Matrix e cols rows
329+ones :: (Num e, FromLists e (FromNat cols) (FromNat rows), KnownNat (Count (FromNat cols)), KnownNat (Count (FromNat rows))) => Matrix e cols rows
330+bang :: forall e cols. (Num e, Enum e, FromLists e (FromNat cols) (), KnownNat (Count (FromNat cols))) => Matrix e cols 1
331+constant :: (Num e, FromLists e (FromNat cols) (FromNat rows), KnownNat (Count (FromNat cols)), KnownNat (Count (FromNat rows))) => e -> Matrix e cols rows
332+columns :: KnownNat (Count (FromNat cols)) => Matrix e cols rows -> Int
333+rows :: KnownNat (Count (FromNat rows)) => Matrix e cols rows -> Int
334+tr :: Matrix e cols rows -> Matrix e rows cols
335+select :: (Num e, FromLists e (FromNat rows1) (FromNat rows1), KnownNat (Count (FromNat rows1)), FromNat rows2 ~ FromNat rows1, FromNat cols1 ~ FromNat cols2, FromNat rows3 ~ Either (FromNat cols3) (FromNat rows1)) => Matrix e cols1 rows3 -> Matrix e cols3 rows1 -> Matrix e cols2 rows2
336+cond :: (FromNat (Count (FromNat cols)) ~ FromNat cols, KnownNat (Count (FromNat cols)), FromLists e () (FromNat cols), FromLists e (FromNat cols) (), FromLists e (FromNat cols) (FromNat cols), Bounded a, Enum a, Num e, Ord e) => (a -> Bool) -> Matrix e cols rows -> Matrix e cols rows -> Matrix e cols rows
337+abideJS :: Matrix e cols rows -> Matrix e cols rows
338+abideSJ :: Matrix e cols rows -> Matrix e cols rows
339+(===) :: FromNat rows3 ~ Either (FromNat rows1) (FromNat rows2) => Matrix e cols rows1 -> Matrix e cols rows2 -> Matrix e cols rows3
340+infixl 2 ===
341+p1 :: (Num e, KnownNat (Count (FromNat n)), KnownNat (Count (FromNat m)), FromLists e (FromNat n) (FromNat m), FromLists e (FromNat m) (FromNat m), FromNat (m + n) ~ Either (FromNat m) (FromNat n)) => Matrix e (m + n) m
342+p2 :: (Num e, KnownNat (Count (FromNat n)), KnownNat (Count (FromNat m)), FromLists e (FromNat m) (FromNat n), FromLists e (FromNat n) (FromNat n), FromNat (m + n) ~ Either (FromNat m) (FromNat n)) => Matrix e (m + n) n
343+(|||) :: FromNat cols3 ~ Either (FromNat cols1) (FromNat cols2) => Matrix e cols1 rows -> Matrix e cols2 rows -> Matrix e cols3 rows
344+infixl 3 |||
345+i1 :: (Num e, KnownNat (Count (FromNat n)), KnownNat (Count (FromNat rows)), FromLists e (FromNat n) (FromNat rows), FromLists e (FromNat rows) (FromNat rows), FromNat (rows + n) ~ Either (FromNat rows) (FromNat n)) => Matrix e rows (rows + n)
346+i2 :: (Num e, KnownNat (Count (FromNat rows)), KnownNat (Count (FromNat m)), FromLists e (FromNat m) (FromNat rows), FromLists e (FromNat rows) (FromNat rows), FromNat (m + rows) ~ Either (FromNat m) (FromNat rows)) => Matrix e rows (m + rows)
347+(-|-) :: (Num e, KnownNat (Count (FromNat j)), KnownNat (Count (FromNat k)), FromLists e (FromNat k) (FromNat k), FromLists e (FromNat j) (FromNat k), FromLists e (FromNat k) (FromNat j), FromLists e (FromNat j) (FromNat j), FromNat (n + m) ~ Either (FromNat n) (FromNat m), FromNat (k + j) ~ Either (FromNat k) (FromNat j)) => Matrix e n k -> Matrix e m j -> Matrix e (n + m) (k + j)
348+infixl 5 -|-
349+(><) :: forall e m p n q. (Num e, KnownNat (Count (FromNat m)), KnownNat (Count (FromNat n)), KnownNat (Count (FromNat p)), KnownNat (Count (FromNat q)), KnownNat (Count (FromNat (m * n))), KnownNat (Count (FromNat (p * q))), FromLists e (FromNat (m * n)) (FromNat m), FromLists e (FromNat (m * n)) (FromNat n), FromLists e (FromNat (p * q)) (FromNat p), FromLists e (FromNat (p * q)) (FromNat q), FromNat (m * n) ~ FromNat (Count (FromNat m) * Count (FromNat n)), FromNat (p * q) ~ FromNat (Count (FromNat p) * Count (FromNat q))) => Matrix e m p -> Matrix e n q -> Matrix e (m * n) (p * q)
350+infixl 4 ><
351+kp1 :: forall e m k. (Num e, KnownNat (Count (FromNat m)), KnownNat (Count (FromNat k)), KnownNat (Count (FromNat (m * k))), FromLists e (FromNat (m * k)) (FromNat m), FromNat (m * k) ~ FromNat (Count (FromNat m) * Count (FromNat k))) => Matrix e (m * k) m
352+kp2 :: forall e m k. (Num e, KnownNat (Count (FromNat k)), FromLists e (FromNat (m * k)) (FromNat k), KnownNat (Count (FromNat m)), KnownNat (Count (FromNat (m * k))), FromNat (m * k) ~ FromNat (Count (FromNat m) * Count (FromNat k))) => Matrix e (m * k) k
353+khatri :: forall e cols a b. (Num e, KnownNat (Count (FromNat a)), KnownNat (Count (FromNat b)), KnownNat (Count (FromNat (a * b))), FromLists e (FromNat (a * b)) (FromNat a), FromLists e (FromNat (a * b)) (FromNat b), FromNat (a * b) ~ FromNat (Count (FromNat a) * Count (FromNat b))) => Matrix e cols a -> Matrix e cols b -> Matrix e cols (a * b)
354+identity :: (Num e, FromLists e (FromNat cols) (FromNat cols), KnownNat (Count (FromNat cols))) => Matrix e cols cols
355+comp :: Num e => Matrix e cr rows -> Matrix e cols cr -> Matrix e cols rows
356+fromF :: (Bounded a, Bounded b, Enum a, Enum b, Eq b, Num e, Ord e, KnownNat (Count (FromNat cols)), KnownNat (Count (FromNat rows)), FromLists e (FromNat rows) (FromNat cols)) => (a -> b) -> Matrix e cols rows
357+fromF' :: (Bounded a, Bounded b, Enum a, Enum b, Eq b, Num e, Ord e, KnownNat (Count (Normalize a)), KnownNat (Count (Normalize b)), FromLists e (Normalize b) (Normalize a)) => (a -> b) -> Matrix e (Count a) (Count b)
358+pretty :: (KnownNat (Count (FromNat cols)), Show e) => Matrix e cols rows -> String
359+prettyPrint :: (KnownNat (Count (FromNat cols)), Show e) => Matrix e cols rows -> IO ()
360+instance Control.DeepSeq.NFData e => Control.DeepSeq.NFData (Matrix.Nat.Matrix e cols rows)
361+instance GHC.Classes.Ord e => GHC.Classes.Ord (Matrix.Nat.Matrix e cols rows)
362+instance GHC.Classes.Eq e => GHC.Classes.Eq (Matrix.Nat.Matrix e cols rows)
363+instance GHC.Num.Num e => GHC.Num.Num (Matrix.Nat.Matrix e cols rows)
364+instance GHC.Show.Show e => GHC.Show.Show (Matrix.Nat.Matrix e cols rows)
365+instance GHC.Num.Num e => Control.Category.Category (Matrix.Nat.Matrix e)
366+
367+
368+-- | <b>LAoP</b> is a library for algebraic (inductive) construction and
369+-- manipulation of matrices in Haskell. See <a>my Msc Thesis</a> for the
370+-- motivation behind the library, the underlying theory, and
371+-- implementation details.
372+--
373+-- This module exports a type synonym <a>Dist</a> that represents a
374+-- stochastic distribution matrix and several distribution construction
375+-- functions.
376+module Dist
377+
378+-- | Type synonym for column vector matrices. This represents a probability
379+-- distribution.
380+newtype Dist a
381+D :: Matrix Prob () a -> Dist a
382+
383+-- | Type synonym for probability value
384+type Prob = Double
385+
386+-- | Functor instance
387+fmapD :: (Bounded a, Bounded b, Enum a, Enum b, Eq b, KnownNat (Count (Normalize a)), KnownNat (Count (Normalize b)), FromLists Prob (Normalize b) (Normalize a)) => (a -> b) -> Dist a -> Dist b
388+
389+-- | Applicative/Monoidal instance <tt>unit</tt> function
390+unitD :: Dist ()
391+
392+-- | Applicative/Monoidal instance <tt>mult</tt> function
393+multD :: (KnownNat (Count (Normalize a)), KnownNat (Count (Normalize b)), KnownNat (Count (Normalize (a, b))), FromLists Prob (Normalize (a, b)) (Normalize a), FromLists Prob (Normalize (a, b)) (Normalize b), Normalize (a, b) ~ Normalize (Normalize a, Normalize b)) => Dist a -> Dist b -> Dist (a, b)
394+
395+-- | Selective instance function
396+selectD :: (Normalize (Either a b) ~ Either (Normalize a) (Normalize b), FromLists Prob (Normalize b) (Normalize b), KnownNat (Count (Normalize b))) => Dist (Either a b) -> Matrix Prob a b -> Dist b
397+
398+-- | Monad instance <a>return</a> function
399+returnD :: forall a. (Enum a, FromLists Prob () (Normalize a), KnownNat (Count a)) => a -> Dist a
400+
401+-- | Monad instance '(&gt;&gt;=)' function
402+bindD :: Dist a -> Matrix Prob a b -> Dist b
403+
404+-- | Constructs a Bernoulli distribution
405+choose :: FromLists Prob () (Normalize a) => Prob -> Dist a
406+
407+-- | Creates a distribution given a shape function
408+shape :: FromLists Prob () (Normalize a) => (Prob -> Prob) -> [a] -> Dist a
409+
410+-- | Constructs a Linear distribution
411+linear :: FromLists Prob () (Normalize a) => [a] -> Dist a
412+
413+-- | Constructs an Uniform distribution
414+uniform :: FromLists Prob () (Normalize a) => [a] -> Dist a
415+
416+-- | Constructs an Negative Exponential distribution
417+negExp :: FromLists Prob () (Normalize a) => [a] -> Dist a
418+
419+-- | Constructs an Normal distribution
420+normal :: FromLists Prob () (Normalize a) => [a] -> Dist a
421+
422+-- | Transforms a <a>Dist</a> into a list of pairs.
423+toValues :: forall a. (Enum a, KnownNat (Count a), FromLists Prob () (Normalize a)) => Dist a -> [(a, Prob)]
424+
425+-- | Pretty a distribution
426+prettyDist :: forall a. (Show a, Enum a, KnownNat (Count a), FromLists Prob () (Normalize a)) => Dist a -> String
427+
428+-- | Pretty Print a distribution
429+prettyPrintDist :: forall a. (Show a, Enum a, KnownNat (Count a), FromLists Prob () (Normalize a)) => Dist a -> IO ()
build/x86_64-linux/ghc-8.6.5/laop-0.1.0.0/doc/html/laop-0.1.0.0-docs/meta.jsonnew file+1
@@ -0,0 +1 @@
1+{"haddock_version":"2.22.0","quickjump_version":1}
build/x86_64-linux/ghc-8.6.5/laop-0.1.0.0/doc/html/laop-0.1.0.0-docs/minus.gifnew file

Binary file not shown.

build/x86_64-linux/ghc-8.6.5/laop-0.1.0.0/doc/html/laop-0.1.0.0-docs/ocean.cssnew file+647
@@ -0,0 +1,647 @@
1+/* @group Fundamentals */
2+
3+* { margin: 0; padding: 0 }
4+
5+/* Is this portable? */
6+html {
7+ background-color: white;
8+ width: 100%;
9+ height: 100%;
10+}
11+
12+body {
13+ background: white;
14+ color: black;
15+ text-align: left;
16+ min-height: 100%;
17+ position: relative;
18+}
19+
20+p {
21+ margin: 0.8em 0;
22+}
23+
24+ul, ol {
25+ margin: 0.8em 0 0.8em 2em;
26+}
27+
28+dl {
29+ margin: 0.8em 0;
30+}
31+
32+dt {
33+ font-weight: bold;
34+}
35+dd {
36+ margin-left: 2em;
37+}
38+
39+a { text-decoration: none; }
40+a[href]:link { color: rgb(196,69,29); }
41+a[href]:visited { color: rgb(171,105,84); }
42+a[href]:hover { text-decoration:underline; }
43+
44+a[href].def:link, a[href].def:visited { color: black; }
45+a[href].def:hover { color: rgb(78, 98, 114); }
46+
47+/* @end */
48+
49+/* @group Show and hide with JS */
50+
51+body.js-enabled .hide-when-js-enabled {
52+ display: none;
53+}
54+
55+/* @end */
56+
57+/* @group Fonts & Sizes */
58+
59+/* Basic technique & IE workarounds from YUI 3
60+ For reasons, see:
61+ http://yui.yahooapis.com/3.1.1/build/cssfonts/fonts.css
62+ */
63+
64+body {
65+ font:13px/1.4 sans-serif;
66+ *font-size:small; /* for IE */
67+ *font:x-small; /* for IE in quirks mode */
68+}
69+
70+h1 { font-size: 146.5%; /* 19pt */ }
71+h2 { font-size: 131%; /* 17pt */ }
72+h3 { font-size: 116%; /* 15pt */ }
73+h4 { font-size: 100%; /* 13pt */ }
74+h5 { font-size: 100%; /* 13pt */ }
75+
76+select, input, button, textarea {
77+ font:99% sans-serif;
78+}
79+
80+table {
81+ font-size:inherit;
82+ font:100%;
83+}
84+
85+pre, code, kbd, samp, tt, .src {
86+ font-family:monospace;
87+ *font-size:108%;
88+ line-height: 124%;
89+}
90+
91+.links, .link {
92+ font-size: 85%; /* 11pt */
93+}
94+
95+#module-header .caption {
96+ font-size: 182%; /* 24pt */
97+}
98+
99+#module-header .caption sup {
100+ font-size: 70%;
101+ font-weight: normal;
102+}
103+
104+.info {
105+ font-size: 85%; /* 11pt */
106+}
107+
108+#table-of-contents, #synopsis {
109+ /* font-size: 85%; /* 11pt */
110+}
111+
112+
113+/* @end */
114+
115+/* @group Common */
116+
117+.caption, h1, h2, h3, h4, h5, h6, summary {
118+ font-weight: bold;
119+ color: rgb(78,98,114);
120+ margin: 0.8em 0 0.4em;
121+}
122+
123+* + h1, * + h2, * + h3, * + h4, * + h5, * + h6 {
124+ margin-top: 2em;
125+}
126+
127+h1 + h2, h2 + h3, h3 + h4, h4 + h5, h5 + h6 {
128+ margin-top: inherit;
129+}
130+
131+ul.links {
132+ list-style: none;
133+ text-align: left;
134+ float: right;
135+ display: inline-table;
136+ margin: 0 0 0 1em;
137+}
138+
139+ul.links li {
140+ display: inline;
141+ border-left: 1px solid #d5d5d5;
142+ white-space: nowrap;
143+ padding: 0;
144+}
145+
146+ul.links li a {
147+ padding: 0.2em 0.5em;
148+}
149+
150+.hide { display: none; }
151+.show { display: inherit; }
152+.clear { clear: both; }
153+
154+.collapser {
155+ background-image: url(minus.gif);
156+ background-repeat: no-repeat;
157+}
158+.expander {
159+ background-image: url(plus.gif);
160+ background-repeat: no-repeat;
161+}
162+.collapser, .expander {
163+ padding-left: 14px;
164+ margin-left: -14px;
165+ cursor: pointer;
166+}
167+p.caption.collapser,
168+p.caption.expander {
169+ background-position: 0 0.4em;
170+}
171+
172+.instance.collapser, .instance.expander {
173+ margin-left: 0px;
174+ background-position: left center;
175+ min-width: 9px;
176+ min-height: 9px;
177+}
178+
179+summary {
180+ cursor: pointer;
181+ outline: none;
182+ list-style-image: url(plus.gif);
183+ list-style-position: outside;
184+}
185+
186+details[open] > summary {
187+ list-style-image: url(minus.gif);
188+}
189+
190+pre {
191+ padding: 0.25em;
192+ margin: 0.8em 0;
193+ background: rgb(229,237,244);
194+ overflow: auto;
195+ border-bottom: 0.25em solid white;
196+ /* white border adds some space below the box to compensate
197+ for visual extra space that paragraphs have between baseline
198+ and the bounding box */
199+}
200+
201+.src {
202+ background: #f0f0f0;
203+ padding: 0.2em 0.5em;
204+}
205+
206+.keyword { font-weight: normal; }
207+.def { font-weight: bold; }
208+
209+@media print {
210+ #footer { display: none; }
211+}
212+
213+/* @end */
214+
215+/* @group Page Structure */
216+
217+#content {
218+ margin: 0 auto;
219+ padding: 0 2em 6em;
220+}
221+
222+#package-header {
223+ background: rgb(41,56,69);
224+ border-top: 5px solid rgb(78,98,114);
225+ color: #ddd;
226+ padding: 0.2em;
227+ position: relative;
228+ text-align: left;
229+}
230+
231+#package-header .caption {
232+ background: url(hslogo-16.png) no-repeat 0em;
233+ color: white;
234+ margin: 0 2em;
235+ font-weight: normal;
236+ font-style: normal;
237+ padding-left: 2em;
238+}
239+
240+#package-header a:link, #package-header a:visited { color: white; }
241+#package-header a:hover { background: rgb(78,98,114); }
242+
243+#module-header .caption {
244+ color: rgb(78,98,114);
245+ font-weight: bold;
246+ border-bottom: 1px solid #ddd;
247+}
248+
249+table.info {
250+ float: right;
251+ padding: 0.5em 1em;
252+ border: 1px solid #ddd;
253+ color: rgb(78,98,114);
254+ background-color: #fff;
255+ max-width: 40%;
256+ border-spacing: 0;
257+ position: relative;
258+ top: -0.5em;
259+ margin: 0 0 0 2em;
260+}
261+
262+.info th {
263+ padding: 0 1em 0 0;
264+}
265+
266+div#style-menu-holder {
267+ position: relative;
268+ z-index: 2;
269+ display: inline;
270+}
271+
272+#style-menu {
273+ position: absolute;
274+ z-index: 1;
275+ overflow: visible;
276+ background: #374c5e;
277+ margin: 0;
278+ text-align: center;
279+ right: 0;
280+ padding: 0;
281+ top: 1.25em;
282+}
283+
284+#style-menu li {
285+ display: list-item;
286+ border-style: none;
287+ margin: 0;
288+ padding: 0;
289+ color: #000;
290+ list-style-type: none;
291+}
292+
293+#style-menu li + li {
294+ border-top: 1px solid #919191;
295+}
296+
297+#style-menu a {
298+ width: 6em;
299+ padding: 3px;
300+ display: block;
301+}
302+
303+#footer {
304+ background: #ddd;
305+ border-top: 1px solid #aaa;
306+ padding: 0.5em 0;
307+ color: #666;
308+ text-align: center;
309+ position: absolute;
310+ bottom: 0;
311+ width: 100%;
312+ height: 3em;
313+}
314+
315+/* @end */
316+
317+/* @group Front Matter */
318+
319+#table-of-contents {
320+ float: right;
321+ clear: right;
322+ background: #faf9dc;
323+ border: 1px solid #d8d7ad;
324+ padding: 0.5em 1em;
325+ max-width: 20em;
326+ margin: 0.5em 0 1em 1em;
327+}
328+
329+#table-of-contents .caption {
330+ text-align: center;
331+ margin: 0;
332+}
333+
334+#table-of-contents ul {
335+ list-style: none;
336+ margin: 0;
337+}
338+
339+#table-of-contents ul ul {
340+ margin-left: 2em;
341+}
342+
343+#description .caption {
344+ display: none;
345+}
346+
347+#synopsis {
348+ display: block;
349+ position: fixed;
350+ right: 0;
351+ height: 80%;
352+ top: 10%;
353+ padding: 0;
354+ max-width: 75%;
355+ /* Ensure that synopsis covers everything (including MathJAX markup) */
356+ z-index: 1;
357+}
358+
359+#synopsis summary {
360+ display: block;
361+ float: left;
362+ width: 29px;
363+ color: rgba(255,255,255,0);
364+ height: 110px;
365+ margin: 0;
366+ font-size: 1px;
367+ padding: 0;
368+ background: url(synopsis.png) no-repeat 0px -8px;
369+}
370+
371+#synopsis details[open] > summary {
372+ background: url(synopsis.png) no-repeat -64px -8px;
373+}
374+
375+#synopsis ul {
376+ height: 100%;
377+ overflow: auto;
378+ padding: 0.5em;
379+ margin: 0;
380+}
381+
382+#synopsis ul ul {
383+ overflow: hidden;
384+}
385+
386+#synopsis ul,
387+#synopsis ul li.src {
388+ background-color: #faf9dc;
389+ white-space: nowrap;
390+ list-style: none;
391+ margin-left: 0;
392+}
393+
394+/* @end */
395+
396+/* @group Main Content */
397+
398+#interface div.top { margin: 2em 0; }
399+#interface h1 + div.top,
400+#interface h2 + div.top,
401+#interface h3 + div.top,
402+#interface h4 + div.top,
403+#interface h5 + div.top {
404+ margin-top: 1em;
405+}
406+#interface .src .selflink,
407+#interface .src .link {
408+ float: right;
409+ color: #919191;
410+ background: #f0f0f0;
411+ padding: 0 0.5em 0.2em;
412+ margin: 0 -0.5em 0 0;
413+ -moz-user-select: none;
414+}
415+#interface .src .selflink {
416+ border-left: 1px solid #919191;
417+ margin: 0 -0.5em 0 0.5em;
418+}
419+
420+#interface span.fixity {
421+ color: #919191;
422+ border-left: 1px solid #919191;
423+ padding: 0.2em 0.5em 0.2em 0.5em;
424+ margin: 0 -1em 0 1em;
425+}
426+
427+#interface span.rightedge {
428+ border-left: 1px solid #919191;
429+ padding: 0.2em 0 0.2em 0;
430+ margin: 0 0 0 1em;
431+}
432+
433+#interface table { border-spacing: 2px; }
434+#interface td {
435+ vertical-align: top;
436+ padding-left: 0.5em;
437+}
438+
439+#interface td.doc p {
440+ margin: 0;
441+}
442+#interface td.doc p + p {
443+ margin-top: 0.8em;
444+}
445+
446+.doc table {
447+ border-collapse: collapse;
448+ border-spacing: 0px;
449+}
450+
451+.doc th,
452+.doc td {
453+ padding: 5px;
454+ border: 1px solid #ddd;
455+}
456+
457+.doc th {
458+ background-color: #f0f0f0;
459+}
460+
461+.clearfix:after {
462+ clear: both;
463+ content: " ";
464+ display: block;
465+ height: 0;
466+ visibility: hidden;
467+}
468+
469+.subs ul {
470+ list-style: none;
471+ display: table;
472+ margin: 0;
473+}
474+
475+.subs ul li {
476+ display: table-row;
477+}
478+
479+.subs ul li dfn {
480+ display: table-cell;
481+ font-style: normal;
482+ font-weight: bold;
483+ margin: 1px 0;
484+ white-space: nowrap;
485+}
486+
487+.subs ul li > .doc {
488+ display: table-cell;
489+ padding-left: 0.5em;
490+ margin-bottom: 0.5em;
491+}
492+
493+.subs ul li > .doc p {
494+ margin: 0;
495+}
496+
497+/* Render short-style data instances */
498+.inst ul {
499+ height: 100%;
500+ padding: 0.5em;
501+ margin: 0;
502+}
503+
504+.inst, .inst li {
505+ list-style: none;
506+ margin-left: 1em;
507+}
508+
509+/* Workaround for bug in Firefox (issue #384) */
510+.inst-left {
511+ float: left;
512+}
513+
514+.top p.src {
515+ border-top: 1px solid #ccc;
516+}
517+
518+.subs, .doc {
519+ /* use this selector for one level of indent */
520+ padding-left: 2em;
521+}
522+
523+.warning {
524+ color: red;
525+}
526+
527+.arguments {
528+ margin-top: -0.4em;
529+}
530+.arguments .caption {
531+ display: none;
532+}
533+
534+.fields { padding-left: 1em; }
535+
536+.fields .caption { display: none; }
537+
538+.fields p { margin: 0 0; }
539+
540+/* this seems bulky to me
541+.methods, .constructors {
542+ background: #f8f8f8;
543+ border: 1px solid #eee;
544+}
545+*/
546+
547+/* @end */
548+
549+/* @group Auxillary Pages */
550+
551+
552+.extension-list {
553+ list-style-type: none;
554+ margin-left: 0;
555+}
556+
557+#mini {
558+ margin: 0 auto;
559+ padding: 0 1em 1em;
560+}
561+
562+#mini > * {
563+ font-size: 93%; /* 12pt */
564+}
565+
566+#mini #module-list .caption,
567+#mini #module-header .caption {
568+ font-size: 125%; /* 15pt */
569+}
570+
571+#mini #interface h1,
572+#mini #interface h2,
573+#mini #interface h3,
574+#mini #interface h4 {
575+ font-size: 109%; /* 13pt */
576+ margin: 1em 0 0;
577+}
578+
579+#mini #interface .top,
580+#mini #interface .src {
581+ margin: 0;
582+}
583+
584+#mini #module-list ul {
585+ list-style: none;
586+ margin: 0;
587+}
588+
589+#alphabet ul {
590+ list-style: none;
591+ padding: 0;
592+ margin: 0.5em 0 0;
593+ text-align: center;
594+}
595+
596+#alphabet li {
597+ display: inline;
598+ margin: 0 0.25em;
599+}
600+
601+#alphabet a {
602+ font-weight: bold;
603+}
604+
605+#index .caption,
606+#module-list .caption { font-size: 131%; /* 17pt */ }
607+
608+#index table {
609+ margin-left: 2em;
610+}
611+
612+#index .src {
613+ font-weight: bold;
614+}
615+#index .alt {
616+ font-size: 77%; /* 10pt */
617+ font-style: italic;
618+ padding-left: 2em;
619+}
620+
621+#index td + td {
622+ padding-left: 1em;
623+}
624+
625+#module-list ul {
626+ list-style: none;
627+ margin: 0 0 0 2em;
628+}
629+
630+#module-list li {
631+ clear: right;
632+}
633+
634+#module-list span.collapser,
635+#module-list span.expander {
636+ background-position: 0 0.3em;
637+}
638+
639+#module-list .package {
640+ float: right;
641+}
642+
643+:target {
644+ background-color: #ffff00;
645+}
646+
647+/* @end */
build/x86_64-linux/ghc-8.6.5/laop-0.1.0.0/doc/html/laop-0.1.0.0-docs/plus.gifnew file

Binary file not shown.

build/x86_64-linux/ghc-8.6.5/laop-0.1.0.0/doc/html/laop-0.1.0.0-docs/quick-jump.cssnew file+164
@@ -0,0 +1,164 @@
1+/* @group Search box layout */
2+
3+#search {
4+ position: fixed;
5+ top: 3.2em;
6+ bottom: 0;
7+ left: calc(50% - 22em);
8+ width: 44em;
9+ z-index: 1000;
10+ pointer-events: none;
11+ overflow-y: auto;
12+}
13+
14+#search.hidden {
15+ display: none;
16+}
17+
18+#search-form, #search-results {
19+ box-shadow: 2px 2px 6px rgb(199, 204, 208);
20+ pointer-events: all;
21+}
22+
23+#search-form input {
24+ font-size: 1.25em; line-height: 2.3em; height: 2.4em;
25+ display: block;
26+ box-sizing: border-box;
27+ width: 100%;
28+ margin: 0;
29+ padding: 0 0.75em;
30+ border: 0.05em solid rgb(151, 179, 202);
31+}
32+
33+#search input:focus {
34+ outline: none;
35+}
36+
37+#search p.error {
38+ color: rgb(107, 24, 24);
39+ font-weight: bold;
40+}
41+
42+#search-results {
43+ box-sizing: border-box;
44+ border: 0.05em solid #b2d5fb;
45+ background: #e8f3ff;
46+}
47+
48+#search-form input + #search-results {
49+ border-top: none;
50+ top: 3em;
51+ max-height: calc(100% - 3em);
52+}
53+
54+/* @end */
55+
56+/* @group search results */
57+
58+#search-results > ul {
59+ margin: 0;
60+ list-style: none;
61+}
62+
63+#search-results > ul > li,
64+#search-results > p,
65+#search-results > table {
66+ padding: 0.5em 1em;
67+ margin: 0;
68+}
69+
70+#search-results > ul > li {
71+ border-bottom: 1px solid #b2d5fb;
72+}
73+
74+#search-results > ul > li > ul {
75+ list-style: none;
76+}
77+
78+.search-module h4 {
79+ margin: 0;
80+}
81+
82+.search-module > ul {
83+ margin: 0.5em 0 0.5em 2em;
84+}
85+
86+.search-module > ul > li > a[href] {
87+ display: block;
88+ color: inherit;
89+ padding: 0.25em 0.5em;
90+}
91+
92+.search-module > ul > li > a[href].active-link {
93+ background: #faf9dc;
94+}
95+
96+.search-module a[href]:hover {
97+ text-decoration: none;
98+}
99+
100+.search-result a a {
101+ pointer-events: none;
102+}
103+
104+.search-result ul.subs {
105+ display: inline-block;
106+ margin: 0; padding: 0;
107+}
108+
109+.search-result ul.subs li {
110+ display: none;
111+}
112+
113+.search-result ul.subs::after {
114+ display: inline-block;
115+ content: "...";
116+ color: rgb(78,98,114);
117+ margin: 0 0.25em;
118+}
119+
120+.more-results {
121+ color: rgb(99, 141, 173);
122+ position: relative;
123+}
124+
125+.more-results::before {
126+ content: "+";
127+ display: inline-block;
128+ color: #b2d5fb;
129+ font-weight: bold;
130+ font-size: 1.25em; line-height: inherit;
131+ position: absolute;
132+ left: -1em;
133+}
134+
135+/* @end */
136+
137+/* @group Keyboard shortcuts table */
138+
139+.keyboard-shortcuts {
140+ line-height: 1.6em;
141+}
142+
143+.keyboard-shortcuts th {
144+ color: rgb(78,98,114);
145+}
146+
147+.keyboard-shortcuts td:first-child,
148+.keyboard-shortcuts th:first-child {
149+ text-align: right;
150+ padding-right: 0.6em;
151+}
152+
153+.key {
154+ display: inline-block;
155+ font-size: 0.9em;
156+ min-width: 0.8em; line-height: 1.2em;
157+ text-align: center;
158+ background: #b2d5fb;
159+ border: 1px solid #74a3d6;
160+ padding: 0 0.2em;
161+ margin: 0 0.1em;
162+}
163+
164+/* @end */
build/x86_64-linux/ghc-8.6.5/laop-0.1.0.0/doc/html/laop-0.1.0.0-docs/quick-jump.min.jsnew file+2
@@ -0,0 +1,2 @@
1+!function e(t,n,o){function r(s,a){if(!n[s]){if(!t[s]){var l="function"==typeof require&&require;if(!a&&l)return l(s,!0);if(i)return i(s,!0);var c=new Error("Cannot find module '"+s+"'");throw c.code="MODULE_NOT_FOUND",c}var u=n[s]={exports:{}};t[s][0].call(u.exports,function(e){var n=t[s][1][e];return r(n||e)},u,u.exports,e,t,n,o)}return n[s].exports}for(var i="function"==typeof require&&require,s=0;s<o.length;s++)r(o[s]);return r}({1:[function(e,t,n){"use strict";function o(e,t,n){var o=new XMLHttpRequest;o.onreadystatechange=function(){if(o.readyState===XMLHttpRequest.DONE)if(200===o.status){if(t)try{t(JSON.parse(o.responseText))}catch(e){n(o)}}else n&&n(o)},o.open("GET",e,!0),o.send()}function r(e){var t=document.querySelector("#page-menu"),n=document.createElement("li");t.insertBefore(n,t.firstChild),p.render(d(v,{onClick:e,title:"Quick Jump"}),t,n)}function i(e,t){return t.length<=e?t:t.slice(0,e)}function s(){return d("table",{class:"keyboard-shortcuts"},d("tr",null,d("th",null,"Key"),d("th",null,"Shortcut")),d("tr",null,d("td",null,d("span",{class:"key"},"s")),d("td",null,"Open this search box")),d("tr",null,d("td",null,d("span",{class:"key"},"esc")),d("td",null,"Close this search box")),d("tr",null,d("td",null,d("span",{class:"key"},"↓"),",",d("span",{class:"key"},"ctrl")," + ",d("span",{class:"key"},"j")),d("td",null,"Move down in search results")),d("tr",null,d("td",null,d("span",{class:"key"},"↑"),",",d("span",{class:"key"},"ctrl")," + ",d("span",{class:"key"},"k")),d("td",null,"Move up in search results")),d("tr",null,d("td",null,d("span",{class:"key"},"↵")),d("td",null,"Go to active search result")))}function a(){return d("p",null,"You can find any exported type, constructor, class, function or pattern defined in this package by (approximate) name.")}function l(e){var t=[d("p",null,"Your search for '",e.searchString,"' produced the following list of results: ",d("code",null,"[]"),"."),d("p",null,d("code",null,"Nothing")," matches your query for '",e.searchString,"'."),d("p",null,d("code",null,"Left \"no matches for '",e.searchString,"'\" :: Either String (NonEmpty SearchResult)"))];return t[(e.searchString||"a").charCodeAt(0)%t.length]}function c(e,t){p.render(d(_,{baseUrl:e||".",showHideTrigger:t||r}),document.body)}var u=this&&this.__extends||function(){var e=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(e,t){e.__proto__=t}||function(e,t){for(var n in t)t.hasOwnProperty(n)&&(e[n]=t[n])};return function(t,n){function o(){this.constructor=t}e(t,n),t.prototype=null===n?Object.create(n):(o.prototype=n.prototype,new o)}}();Object.defineProperty(n,"__esModule",{value:!0});var h=e("fuse.js"),p=e("preact"),d=p.h,f=p.Component,v=function(e){function t(){return null!==e&&e.apply(this,arguments)||this}return u(t,e),t.prototype.render=function(e){return d("li",null,d("a",{href:"#",onClick:function(t){t.preventDefault(),e.onClick()}},e.title))},t}(f),_=function(e){function t(){var t=null!==e&&e.apply(this,arguments)||this;return t.linkIndex=0,t.focusPlease=!1,t.navigatedByKeyboard=!1,t}return u(t,e),t.prototype.componentWillMount=function(){var e=this;this.setState({searchString:"",isVisible:!1,expanded:{},activeLinkIndex:-1,moduleResults:[]}),o(this.props.baseUrl+"/doc-index.json",function(t){e.setState({fuse:new h(t,{threshold:.25,caseSensitive:!0,includeScore:!0,tokenize:!0,keys:[{name:"name",weight:.7},{name:"module",weight:.3}]}),moduleResults:[]})},function(t){console&&console.error("could not load 'doc-index.json' for searching",t),e.setState({failedLoading:!0})}),document.addEventListener("mousedown",this.hide.bind(this)),document.addEventListener("keydown",function(t){e.state.isVisible&&("Escape"===t.key?e.hide():"ArrowUp"===t.key||"k"===t.key&&t.ctrlKey?(t.preventDefault(),e.navigateLinks(-1)):"ArrowDown"===t.key||"j"===t.key&&t.ctrlKey?(t.preventDefault(),e.navigateLinks(1)):"Enter"===t.key&&e.state.activeLinkIndex>=0&&e.followActiveLink()),"s"===t.key&&"input"!==t.target.tagName.toLowerCase()&&(t.preventDefault(),e.show())})},t.prototype.hide=function(){this.setState({isVisible:!1,searchString:""})},t.prototype.show=function(){this.state.isVisible||(this.focusPlease=!0,this.setState({isVisible:!0,activeLinkIndex:-1}))},t.prototype.toggleVisibility=function(){this.state.isVisible?this.hide():this.show()},t.prototype.navigateLinks=function(e){var t=Math.max(-1,Math.min(this.linkIndex-1,this.state.activeLinkIndex+e));this.navigatedByKeyboard=!0,this.setState({activeLinkIndex:t})},t.prototype.followActiveLink=function(){this.activeLinkAction&&this.activeLinkAction()},t.prototype.updateResults=function(){var e=this.input&&this.input.value||"",t={};this.state.fuse.search(e).forEach(function(e){var n=e.item.module;(t[n]||(t[n]=[])).push(e)});var n=[];for(var o in t)!function(e){var o=t[e],r=0;o.forEach(function(e){r+=1/e.score}),n.push({module:e,totalScore:1/r,items:o})}(o);n.sort(function(e,t){return e.totalScore-t.totalScore}),this.setState({searchString:e,isVisible:!0,moduleResults:n})},t.prototype.componentDidUpdate=function(){if(this.searchResults&&this.activeLink&&this.navigatedByKeyboard){var e=this.activeLink.getClientRects()[0],t=this.searchResults.getClientRects()[0].top;e.bottom>window.innerHeight?this.searchResults.scrollTop+=e.bottom-window.innerHeight+80:e.top<t&&(this.searchResults.scrollTop-=t-e.top+80)}this.focusPlease&&this.input&&this.input.focus(),this.navigatedByKeyboard=!1,this.focusPlease=!1},t.prototype.componentDidMount=function(){this.props.showHideTrigger(this.toggleVisibility.bind(this))},t.prototype.render=function(e,t){var n=this;if(t.failedLoading){var o="file:"==window.location.protocol;return d("div",{id:"search",class:t.isVisible?"":"hidden"},d("div",{id:"search-results"},d("p",{class:"error"},"Failed to load file 'doc-index.json' containing definitions in this package."),o?d("p",{class:"error"},"To use quick jump, load this page with HTTP (from a local static file web server) instead of using the ",d("code",null,"file://")," protocol. (For security reasons, it is not possible to fetch auxiliary files using JS in a HTML page opened with ",d("code",null,"file://"),".)"):[]))}this.linkIndex=0;var r=function(e){e.stopPropagation()},c=i(10,t.moduleResults).map(function(e){return n.renderResultsInModule(e)});return d("div",{id:"search",class:t.isVisible?"":"hidden"},d("div",{id:"search-form",onMouseDown:r},d("input",{placeholder:"Search in package by name",ref:function(e){n.input=e},onFocus:this.show.bind(this),onClick:this.show.bind(this),onInput:this.updateResults.bind(this)})),d("div",{id:"search-results",ref:function(e){n.searchResults=e},onMouseDown:r,onMouseOver:function(e){for(var t=e.target;t&&"function"==typeof t.getAttribute;){var o=t.getAttribute("data-link-index");if("string"==typeof o){var r=parseInt(o,10);n.setState({activeLinkIndex:r});break}t=t.parentNode}}},""===t.searchString?[d(a,null),d(s,null)]:0==c.length?d(l,{searchString:t.searchString}):d("ul",null,c)))},t.prototype.renderResultsInModule=function(e){var t=this,n=e.items,o=e.module,r=this.state.expanded[o]||n.length<=10,s=r?n:i(8,n),a=function(e){return d("li",{class:"search-result"},t.navigationLink(t.props.baseUrl+"/"+e.link,{},d(g,{html:e.display_html})))};return d("li",{class:"search-module"},d("h4",null,o),d("ul",null,s.map(function(e){return a(e.item)}),r?[]:d("li",{class:"more-results"},this.actionLink(function(){var e=Object.assign({},t.state.expanded);e[o]=!0,t.setState({expanded:e})},{},"show "+(n.length-s.length)+" more results from this module"))))},t.prototype.navigationLink=function(e,t){for(var n=this,o=[],r=2;r<arguments.length;r++)o[r-2]=arguments[r];var i=Object.assign({href:e,onClick:this.hide.bind(this)},t);return this.menuLink.apply(this,[i,function(){window.location.href=e,n.hide()}].concat(o))},t.prototype.actionLink=function(e,t){for(var n=[],o=2;o<arguments.length;o++)n[o-2]=arguments[o];var r=Object.assign({href:"#",onClick:function(t){t.preventDefault(),e()}},t);return this.menuLink.apply(this,[r,e].concat(n))},t.prototype.menuLink=function(e,t){for(var n=this,o=[],r=2;r<arguments.length;r++)o[r-2]=arguments[r];var i=this.linkIndex;i===this.state.activeLinkIndex&&(e.class=(e.class?e.class+" ":"")+"active-link",e.ref=function(e){e&&(n.activeLink=e)},this.activeLinkAction=t);var s=Object.assign({"data-link-index":i},e);return this.linkIndex+=1,d.apply(void 0,["a",s].concat(o))},t}(f),g=function(e){function t(){return null!==e&&e.apply(this,arguments)||this}return u(t,e),t.prototype.shouldComponentUpdate=function(e){return this.props.html!==e.html},t.prototype.render=function(e){return d("div",{dangerouslySetInnerHTML:{__html:e.html}})},t}(f);n.init=c,window.quickNav={init:c}},{"fuse.js":2,preact:3}],2:[function(e,t,n){!function(e,o){"object"==typeof n&&"object"==typeof t?t.exports=o():"function"==typeof define&&define.amd?define("Fuse",[],o):"object"==typeof n?n.Fuse=o():e.Fuse=o()}(this,function(){return function(e){function t(o){if(n[o])return n[o].exports;var r=n[o]={i:o,l:!1,exports:{}};return e[o].call(r.exports,r,r.exports,t),r.l=!0,r.exports}var n={};return t.m=e,t.c=n,t.i=function(e){return e},t.d=function(e,n,o){t.o(e,n)||Object.defineProperty(e,n,{configurable:!1,enumerable:!0,get:o})},t.n=function(e){var n=e&&e.__esModule?function(){return e.default}:function(){return e};return t.d(n,"a",n),n},t.o=function(e,t){return Object.prototype.hasOwnProperty.call(e,t)},t.p="",t(t.s=8)}([function(e,t,n){"use strict";e.exports=function(e){return"[object Array]"===Object.prototype.toString.call(e)}},function(e,t,n){"use strict";function o(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}var r=function(){function e(e,t){for(var n=0;n<t.length;n++){var o=t[n];o.enumerable=o.enumerable||!1,o.configurable=!0,"value"in o&&(o.writable=!0),Object.defineProperty(e,o.key,o)}}return function(t,n,o){return n&&e(t.prototype,n),o&&e(t,o),t}}(),i=n(5),s=n(7),a=n(4),l=function(){function e(t,n){var r=n.location,i=void 0===r?0:r,s=n.distance,l=void 0===s?100:s,c=n.threshold,u=void 0===c?.6:c,h=n.maxPatternLength,p=void 0===h?32:h,d=n.isCaseSensitive,f=void 0!==d&&d,v=n.tokenSeparator,_=void 0===v?/ +/g:v,g=n.findAllMatches,m=void 0!==g&&g,y=n.minMatchCharLength,k=void 0===y?1:y;o(this,e),this.options={location:i,distance:l,threshold:u,maxPatternLength:p,isCaseSensitive:f,tokenSeparator:_,findAllMatches:m,minMatchCharLength:k},this.pattern=this.options.isCaseSensitive?t:t.toLowerCase(),this.pattern.length<=p&&(this.patternAlphabet=a(this.pattern))}return r(e,[{key:"search",value:function(e){if(this.options.isCaseSensitive||(e=e.toLowerCase()),this.pattern===e)return{isMatch:!0,score:0,matchedIndices:[[0,e.length-1]]};var t=this.options,n=t.maxPatternLength,o=t.tokenSeparator;if(this.pattern.length>n)return i(e,this.pattern,o);var r=this.options,a=r.location,l=r.distance,c=r.threshold,u=r.findAllMatches,h=r.minMatchCharLength;return s(e,this.pattern,this.patternAlphabet,{location:a,distance:l,threshold:c,findAllMatches:u,minMatchCharLength:h})}}]),e}();e.exports=l},function(e,t,n){"use strict";var o=n(0),r=function e(t,n,r){if(n){var i=n.indexOf("."),s=n,a=null;-1!==i&&(s=n.slice(0,i),a=n.slice(i+1));var l=t[s];if(null!==l&&void 0!==l)if(a||"string"!=typeof l&&"number"!=typeof l)if(o(l))for(var c=0,u=l.length;c<u;c+=1)e(l[c],a,r);else a&&e(l,a,r);else r.push(l.toString())}else r.push(t);return r};e.exports=function(e,t){return r(e,t,[])}},function(e,t,n){"use strict";e.exports=function(){for(var e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:[],t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:1,n=[],o=-1,r=-1,i=0,s=e.length;i<s;i+=1){var a=e[i];a&&-1===o?o=i:a||-1===o||((r=i-1)-o+1>=t&&n.push([o,r]),o=-1)}return e[i-1]&&i-o>=t&&n.push([o,i-1]),n}},function(e,t,n){"use strict";e.exports=function(e){for(var t={},n=e.length,o=0;o<n;o+=1)t[e.charAt(o)]=0;for(var r=0;r<n;r+=1)t[e.charAt(r)]|=1<<n-r-1;return t}},function(e,t,n){"use strict";var o=/[\-\[\]\/\{\}\(\)\*\+\?\.\\\^\$\|]/g;e.exports=function(e,t){var n=arguments.length>2&&void 0!==arguments[2]?arguments[2]:/ +/g,r=new RegExp(t.replace(o,"\\$&").replace(n,"|")),i=e.match(r),s=!!i,a=[];if(s)for(var l=0,c=i.length;l<c;l+=1){var u=i[l];a.push([e.indexOf(u),u.length-1])}return{score:s?.5:1,isMatch:s,matchedIndices:a}}},function(e,t,n){"use strict";e.exports=function(e,t){var n=t.errors,o=void 0===n?0:n,r=t.currentLocation,i=void 0===r?0:r,s=t.expectedLocation,a=void 0===s?0:s,l=t.distance,c=void 0===l?100:l,u=o/e.length,h=Math.abs(a-i);return c?u+h/c:h?1:u}},function(e,t,n){"use strict";var o=n(6),r=n(3);e.exports=function(e,t,n,i){for(var s=i.location,a=void 0===s?0:s,l=i.distance,c=void 0===l?100:l,u=i.threshold,h=void 0===u?.6:u,p=i.findAllMatches,d=void 0!==p&&p,f=i.minMatchCharLength,v=void 0===f?1:f,_=a,g=e.length,m=h,y=e.indexOf(t,_),k=t.length,b=[],x=0;x<g;x+=1)b[x]=0;if(-1!==y){var w=o(t,{errors:0,currentLocation:y,expectedLocation:_,distance:c});if(m=Math.min(w,m),-1!==(y=e.lastIndexOf(t,_+k))){var S=o(t,{errors:0,currentLocation:y,expectedLocation:_,distance:c});m=Math.min(S,m)}}y=-1;for(var L=[],C=1,M=k+g,N=1<<k-1,I=0;I<k;I+=1){for(var A=0,T=M;A<T;)o(t,{errors:I,currentLocation:_+T,expectedLocation:_,distance:c})<=m?A=T:M=T,T=Math.floor((M-A)/2+A);M=T;var O=Math.max(1,_-T+1),j=d?g:Math.min(_+T,g)+k,P=Array(j+2);P[j+1]=(1<<I)-1;for(var E=j;E>=O;E-=1){var R=E-1,U=n[e.charAt(R)];if(U&&(b[R]=1),P[E]=(P[E+1]<<1|1)&U,0!==I&&(P[E]|=(L[E+1]|L[E])<<1|1|L[E+1]),P[E]&N&&(C=o(t,{errors:I,currentLocation:R,expectedLocation:_,distance:c}))<=m){if(m=C,(y=R)<=_)break;O=Math.max(1,2*_-y)}}if(o(t,{errors:I+1,currentLocation:_,expectedLocation:_,distance:c})>m)break;L=P}return{isMatch:y>=0,score:0===C?.001:C,matchedIndices:r(b,v)}}},function(e,t,n){"use strict";function o(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}var r=function(){function e(e,t){for(var n=0;n<t.length;n++){var o=t[n];o.enumerable=o.enumerable||!1,o.configurable=!0,"value"in o&&(o.writable=!0),Object.defineProperty(e,o.key,o)}}return function(t,n,o){return n&&e(t.prototype,n),o&&e(t,o),t}}(),i=n(1),s=n(2),a=n(0),l=function(){function e(t,n){var r=n.location,i=void 0===r?0:r,a=n.distance,l=void 0===a?100:a,c=n.threshold,u=void 0===c?.6:c,h=n.maxPatternLength,p=void 0===h?32:h,d=n.caseSensitive,f=void 0!==d&&d,v=n.tokenSeparator,_=void 0===v?/ +/g:v,g=n.findAllMatches,m=void 0!==g&&g,y=n.minMatchCharLength,k=void 0===y?1:y,b=n.id,x=void 0===b?null:b,w=n.keys,S=void 0===w?[]:w,L=n.shouldSort,C=void 0===L||L,M=n.getFn,N=void 0===M?s:M,I=n.sortFn,A=void 0===I?function(e,t){return e.score-t.score}:I,T=n.tokenize,O=void 0!==T&&T,j=n.matchAllTokens,P=void 0!==j&&j,E=n.includeMatches,R=void 0!==E&&E,U=n.includeScore,D=void 0!==U&&U,V=n.verbose,F=void 0!==V&&V;o(this,e),this.options={location:i,distance:l,threshold:u,maxPatternLength:p,isCaseSensitive:f,tokenSeparator:_,findAllMatches:m,minMatchCharLength:k,id:x,keys:S,includeMatches:R,includeScore:D,shouldSort:C,getFn:N,sortFn:A,verbose:F,tokenize:O,matchAllTokens:P},this.setCollection(t)}return r(e,[{key:"setCollection",value:function(e){return this.list=e,e}},{key:"search",value:function(e){this._log('---------\nSearch pattern: "'+e+'"');var t=this._prepareSearchers(e),n=t.tokenSearchers,o=t.fullSearcher,r=this._search(n,o),i=r.weights,s=r.results;return this._computeScore(i,s),this.options.shouldSort&&this._sort(s),this._format(s)}},{key:"_prepareSearchers",value:function(){var e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:"",t=[];if(this.options.tokenize)for(var n=e.split(this.options.tokenSeparator),o=0,r=n.length;o<r;o+=1)t.push(new i(n[o],this.options));return{tokenSearchers:t,fullSearcher:new i(e,this.options)}}},{key:"_search",value:function(){var e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:[],t=arguments[1],n=this.list,o={},r=[];if("string"==typeof n[0]){for(var i=0,s=n.length;i<s;i+=1)this._analyze({key:"",value:n[i],record:i,index:i},{resultMap:o,results:r,tokenSearchers:e,fullSearcher:t});return{weights:null,results:r}}for(var a={},l=0,c=n.length;l<c;l+=1)for(var u=n[l],h=0,p=this.options.keys.length;h<p;h+=1){var d=this.options.keys[h];if("string"!=typeof d){if(a[d.name]={weight:1-d.weight||1},d.weight<=0||d.weight>1)throw new Error("Key weight has to be > 0 and <= 1");d=d.name}else a[d]={weight:1};this._analyze({key:d,value:this.options.getFn(u,d),record:u,index:l},{resultMap:o,results:r,tokenSearchers:e,fullSearcher:t})}return{weights:a,results:r}}},{key:"_analyze",value:function(e,t){var n=e.key,o=e.arrayIndex,r=void 0===o?-1:o,i=e.value,s=e.record,l=e.index,c=t.tokenSearchers,u=void 0===c?[]:c,h=t.fullSearcher,p=void 0===h?[]:h,d=t.resultMap,f=void 0===d?{}:d,v=t.results,_=void 0===v?[]:v;if(void 0!==i&&null!==i){var g=!1,m=-1,y=0;if("string"==typeof i){this._log("\nKey: "+(""===n?"-":n));var k=p.search(i);if(this._log('Full text: "'+i+'", score: '+k.score),this.options.tokenize){for(var b=i.split(this.options.tokenSeparator),x=[],w=0;w<u.length;w+=1){var S=u[w];this._log('\nPattern: "'+S.pattern+'"');for(var L=!1,C=0;C<b.length;C+=1){var M=b[C],N=S.search(M),I={};N.isMatch?(I[M]=N.score,g=!0,L=!0,x.push(N.score)):(I[M]=1,this.options.matchAllTokens||x.push(1)),this._log('Token: "'+M+'", score: '+I[M])}L&&(y+=1)}m=x[0];for(var A=x.length,T=1;T<A;T+=1)m+=x[T];m/=A,this._log("Token score average:",m)}var O=k.score;m>-1&&(O=(O+m)/2),this._log("Score average:",O);var j=!this.options.tokenize||!this.options.matchAllTokens||y>=u.length;if(this._log("\nCheck Matches: "+j),(g||k.isMatch)&&j){var P=f[l];P?P.output.push({key:n,arrayIndex:r,value:i,score:O,matchedIndices:k.matchedIndices}):(f[l]={item:s,output:[{key:n,arrayIndex:r,value:i,score:O,matchedIndices:k.matchedIndices}]},_.push(f[l]))}}else if(a(i))for(var E=0,R=i.length;E<R;E+=1)this._analyze({key:n,arrayIndex:E,value:i[E],record:s,index:l},{resultMap:f,results:_,tokenSearchers:u,fullSearcher:p})}}},{key:"_computeScore",value:function(e,t){this._log("\n\nComputing score:\n");for(var n=0,o=t.length;n<o;n+=1){for(var r=t[n].output,i=r.length,s=0,a=1,l=0;l<i;l+=1){var c=r[l].score,u=e?e[r[l].key].weight:1,h=c*u;1!==u?a=Math.min(a,h):(r[l].nScore=h,s+=h)}t[n].score=1===a?s/i:a,this._log(t[n])}}},{key:"_sort",value:function(e){this._log("\n\nSorting...."),e.sort(this.options.sortFn)}},{key:"_format",value:function(e){var t=[];this._log("\n\nOutput:\n\n",JSON.stringify(e));var n=[];this.options.includeMatches&&n.push(function(e,t){var n=e.output;t.matches=[];for(var o=0,r=n.length;o<r;o+=1){var i=n[o];if(0!==i.matchedIndices.length){var s={indices:i.matchedIndices,value:i.value};i.key&&(s.key=i.key),i.hasOwnProperty("arrayIndex")&&i.arrayIndex>-1&&(s.arrayIndex=i.arrayIndex),t.matches.push(s)}}}),this.options.includeScore&&n.push(function(e,t){t.score=e.score});for(var o=0,r=e.length;o<r;o+=1){var i=e[o];if(this.options.id&&(i.item=this.options.getFn(i.item,this.options.id)[0]),n.length){for(var s={item:i.item},a=0,l=n.length;a<l;a+=1)n[a](i,s);t.push(s)}else t.push(i.item)}return t}},{key:"_log",value:function(){if(this.options.verbose){var e;(e=console).log.apply(e,arguments)}}}]),e}();e.exports=l}])})},{}],3:[function(e,t,n){!function(){"use strict";function e(){}function n(t,n){var o,r,i,s,a=T;for(s=arguments.length;s-- >2;)A.push(arguments[s]);for(n&&null!=n.children&&(A.length||A.push(n.children),delete n.children);A.length;)if((r=A.pop())&&void 0!==r.pop)for(s=r.length;s--;)A.push(r[s]);else"boolean"==typeof r&&(r=null),(i="function"!=typeof t)&&(null==r?r="":"number"==typeof r?r=String(r):"string"!=typeof r&&(i=!1)),i&&o?a[a.length-1]+=r:a===T?a=[r]:a.push(r),o=i;var l=new e;return l.nodeName=t,l.children=a,l.attributes=null==n?void 0:n,l.key=null==n?void 0:n.key,void 0!==I.vnode&&I.vnode(l),l}function o(e,t){for(var n in t)e[n]=t[n];return e}function r(e){!e.__d&&(e.__d=!0)&&1==P.push(e)&&(I.debounceRendering||O)(i)}function i(){var e,t=P;for(P=[];e=t.pop();)e.__d&&L(e)}function s(e,t,n){return"string"==typeof t||"number"==typeof t?void 0!==e.splitText:"string"==typeof t.nodeName?!e._componentConstructor&&a(e,t.nodeName):n||e._componentConstructor===t.nodeName}function a(e,t){return e.__n===t||e.nodeName.toLowerCase()===t.toLowerCase()}function l(e){var t=o({},e.attributes);t.children=e.children;var n=e.nodeName.defaultProps;if(void 0!==n)for(var r in n)void 0===t[r]&&(t[r]=n[r]);return t}function c(e,t){var n=t?document.createElementNS("http://www.w3.org/2000/svg",e):document.createElement(e);return n.__n=e,n}function u(e){var t=e.parentNode;t&&t.removeChild(e)}function h(e,t,n,o,r){if("className"===t&&(t="class"),"key"===t);else if("ref"===t)n&&n(null),o&&o(e);else if("class"!==t||r)if("style"===t){if(o&&"string"!=typeof o&&"string"!=typeof n||(e.style.cssText=o||""),o&&"object"==typeof o){if("string"!=typeof n)for(var i in n)i in o||(e.style[i]="");for(var i in o)e.style[i]="number"==typeof o[i]&&!1===j.test(i)?o[i]+"px":o[i]}}else if("dangerouslySetInnerHTML"===t)o&&(e.innerHTML=o.__html||"");else if("o"==t[0]&&"n"==t[1]){var s=t!==(t=t.replace(/Capture$/,""));t=t.toLowerCase().substring(2),o?n||e.addEventListener(t,d,s):e.removeEventListener(t,d,s),(e.__l||(e.__l={}))[t]=o}else if("list"!==t&&"type"!==t&&!r&&t in e)p(e,t,null==o?"":o),null!=o&&!1!==o||e.removeAttribute(t);else{var a=r&&t!==(t=t.replace(/^xlink\:?/,""));null==o||!1===o?a?e.removeAttributeNS("http://www.w3.org/1999/xlink",t.toLowerCase()):e.removeAttribute(t):"function"!=typeof o&&(a?e.setAttributeNS("http://www.w3.org/1999/xlink",t.toLowerCase(),o):e.setAttribute(t,o))}else e.className=o||""}function p(e,t,n){try{e[t]=n}catch(e){}}function d(e){return this.__l[e.type](I.event&&I.event(e)||e)}function f(){for(var e;e=E.pop();)I.afterMount&&I.afterMount(e),e.componentDidMount&&e.componentDidMount()}function v(e,t,n,o,r,i){R++||(U=null!=r&&void 0!==r.ownerSVGElement,D=null!=e&&!("__preactattr_"in e));var s=_(e,t,n,o,i);return r&&s.parentNode!==r&&r.appendChild(s),--R||(D=!1,i||f()),s}function _(e,t,n,o,r){var i=e,s=U;if(null!=t&&"boolean"!=typeof t||(t=""),"string"==typeof t||"number"==typeof t)return e&&void 0!==e.splitText&&e.parentNode&&(!e._component||r)?e.nodeValue!=t&&(e.nodeValue=t):(i=document.createTextNode(t),e&&(e.parentNode&&e.parentNode.replaceChild(i,e),m(e,!0))),i.__preactattr_=!0,i;var l=t.nodeName;if("function"==typeof l)return C(e,t,n,o);if(U="svg"===l||"foreignObject"!==l&&U,l=String(l),(!e||!a(e,l))&&(i=c(l,U),e)){for(;e.firstChild;)i.appendChild(e.firstChild);e.parentNode&&e.parentNode.replaceChild(i,e),m(e,!0)}var u=i.firstChild,h=i.__preactattr_,p=t.children;if(null==h){h=i.__preactattr_={};for(var d=i.attributes,f=d.length;f--;)h[d[f].name]=d[f].value}return!D&&p&&1===p.length&&"string"==typeof p[0]&&null!=u&&void 0!==u.splitText&&null==u.nextSibling?u.nodeValue!=p[0]&&(u.nodeValue=p[0]):(p&&p.length||null!=u)&&g(i,p,n,o,D||null!=h.dangerouslySetInnerHTML),k(i,t.attributes,h),U=s,i}function g(e,t,n,o,r){var i,a,l,c,h,p=e.childNodes,d=[],f={},v=0,g=0,y=p.length,k=0,b=t?t.length:0;if(0!==y)for(L=0;L<y;L++){var x=p[L],w=x.__preactattr_;null!=(S=b&&w?x._component?x._component.__k:w.key:null)?(v++,f[S]=x):(w||(void 0!==x.splitText?!r||x.nodeValue.trim():r))&&(d[k++]=x)}if(0!==b)for(L=0;L<b;L++){h=null;var S=(c=t[L]).key;if(null!=S)v&&void 0!==f[S]&&(h=f[S],f[S]=void 0,v--);else if(!h&&g<k)for(i=g;i<k;i++)if(void 0!==d[i]&&s(a=d[i],c,r)){h=a,d[i]=void 0,i===k-1&&k--,i===g&&g++;break}h=_(h,c,n,o),l=p[L],h&&h!==e&&h!==l&&(null==l?e.appendChild(h):h===l.nextSibling?u(l):e.insertBefore(h,l))}if(v)for(var L in f)void 0!==f[L]&&m(f[L],!1);for(;g<=k;)void 0!==(h=d[k--])&&m(h,!1)}function m(e,t){var n=e._component;n?M(n):(null!=e.__preactattr_&&e.__preactattr_.ref&&e.__preactattr_.ref(null),!1!==t&&null!=e.__preactattr_||u(e),y(e))}function y(e){for(e=e.lastChild;e;){var t=e.previousSibling;m(e,!0),e=t}}function k(e,t,n){var o;for(o in n)t&&null!=t[o]||null==n[o]||h(e,o,n[o],n[o]=void 0,U);for(o in t)"children"===o||"innerHTML"===o||o in n&&t[o]===("value"===o||"checked"===o?e[o]:n[o])||h(e,o,n[o],n[o]=t[o],U)}function b(e){var t=e.constructor.name;(V[t]||(V[t]=[])).push(e)}function x(e,t,n){var o,r=V[e.name];if(e.prototype&&e.prototype.render?(o=new e(t,n),N.call(o,t,n)):((o=new N(t,n)).constructor=e,o.render=w),r)for(var i=r.length;i--;)if(r[i].constructor===e){o.__b=r[i].__b,r.splice(i,1);break}return o}function w(e,t,n){return this.constructor(e,n)}function S(e,t,n,o,i){e.__x||(e.__x=!0,(e.__r=t.ref)&&delete t.ref,(e.__k=t.key)&&delete t.key,!e.base||i?e.componentWillMount&&e.componentWillMount():e.componentWillReceiveProps&&e.componentWillReceiveProps(t,o),o&&o!==e.context&&(e.__c||(e.__c=e.context),e.context=o),e.__p||(e.__p=e.props),e.props=t,e.__x=!1,0!==n&&(1!==n&&!1===I.syncComponentUpdates&&e.base?r(e):L(e,1,i)),e.__r&&e.__r(e))}function L(e,t,n,r){if(!e.__x){var i,s,a,c=e.props,u=e.state,h=e.context,p=e.__p||c,d=e.__s||u,_=e.__c||h,g=e.base,y=e.__b,k=g||y,b=e._component,w=!1;if(g&&(e.props=p,e.state=d,e.context=_,2!==t&&e.shouldComponentUpdate&&!1===e.shouldComponentUpdate(c,u,h)?w=!0:e.componentWillUpdate&&e.componentWillUpdate(c,u,h),e.props=c,e.state=u,e.context=h),e.__p=e.__s=e.__c=e.__b=null,e.__d=!1,!w){i=e.render(c,u,h),e.getChildContext&&(h=o(o({},h),e.getChildContext()));var C,N,A=i&&i.nodeName;if("function"==typeof A){var T=l(i);(s=b)&&s.constructor===A&&T.key==s.__k?S(s,T,1,h,!1):(C=s,e._component=s=x(A,T,h),s.__b=s.__b||y,s.__u=e,S(s,T,0,h,!1),L(s,1,n,!0)),N=s.base}else a=k,(C=b)&&(a=e._component=null),(k||1===t)&&(a&&(a._component=null),N=v(a,i,h,n||!g,k&&k.parentNode,!0));if(k&&N!==k&&s!==b){var O=k.parentNode;O&&N!==O&&(O.replaceChild(N,k),C||(k._component=null,m(k,!1)))}if(C&&M(C),e.base=N,N&&!r){for(var j=e,P=e;P=P.__u;)(j=P).base=N;N._component=j,N._componentConstructor=j.constructor}}if(!g||n?E.unshift(e):w||(e.componentDidUpdate&&e.componentDidUpdate(p,d,_),I.afterUpdate&&I.afterUpdate(e)),null!=e.__h)for(;e.__h.length;)e.__h.pop().call(e);R||r||f()}}function C(e,t,n,o){for(var r=e&&e._component,i=r,s=e,a=r&&e._componentConstructor===t.nodeName,c=a,u=l(t);r&&!c&&(r=r.__u);)c=r.constructor===t.nodeName;return r&&c&&(!o||r._component)?(S(r,u,3,n,o),e=r.base):(i&&!a&&(M(i),e=s=null),r=x(t.nodeName,u,n),e&&!r.__b&&(r.__b=e,s=null),S(r,u,1,n,o),e=r.base,s&&e!==s&&(s._component=null,m(s,!1))),e}function M(e){I.beforeUnmount&&I.beforeUnmount(e);var t=e.base;e.__x=!0,e.componentWillUnmount&&e.componentWillUnmount(),e.base=null;var n=e._component;n?M(n):t&&(t.__preactattr_&&t.__preactattr_.ref&&t.__preactattr_.ref(null),e.__b=t,u(t),b(e),y(t)),e.__r&&e.__r(null)}function N(e,t){this.__d=!0,this.context=t,this.props=e,this.state=this.state||{}}var I={},A=[],T=[],O="function"==typeof Promise?Promise.resolve().then.bind(Promise.resolve()):setTimeout,j=/acit|ex(?:s|g|n|p|$)|rph|ows|mnc|ntw|ine[ch]|zoo|^ord/i,P=[],E=[],R=0,U=!1,D=!1,V={};o(N.prototype,{setState:function(e,t){var n=this.state;this.__s||(this.__s=o({},n)),o(n,"function"==typeof e?e(n,this.props):e),t&&(this.__h=this.__h||[]).push(t),r(this)},forceUpdate:function(e){e&&(this.__h=this.__h||[]).push(e),L(this,2)},render:function(){}});var F={h:n,createElement:n,cloneElement:function(e,t){return n(e.nodeName,o(o({},e.attributes),t),arguments.length>2?[].slice.call(arguments,2):e.children)},Component:N,render:function(e,t,n){return v(n,e,{},!1,t,!1)},rerender:i,options:I};void 0!==t?t.exports=F:self.preact=F}()},{}]},{},[1]);
2+//# sourceMappingURL=quick-jump.min.js.map
build/x86_64-linux/ghc-8.6.5/laop-0.1.0.0/doc/html/laop-0.1.0.0-docs/src/Dist.Internal.htmlnew file+174
@@ -0,0 +1,174 @@
1+<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"><html xmlns="http://www.w3.org/1999/xhtml"><head><link rel="stylesheet" type="text/css" href="style.css" /><script type="text/javascript" src="highlight.js"></script></head><body><pre><span class="hs-pragma">{-# LANGUAGE GADTs #-}</span><span>
2+</span><a name="line-2"></a><span class="hs-pragma">{-# LANGUAGE AllowAmbiguousTypes #-}</span><span>
3+</span><a name="line-3"></a><span class="hs-pragma">{-# LANGUAGE TypeApplications #-}</span><span>
4+</span><a name="line-4"></a><span class="hs-pragma">{-# LANGUAGE KindSignatures #-}</span><span>
5+</span><a name="line-5"></a><span class="hs-pragma">{-# LANGUAGE ScopedTypeVariables #-}</span><span>
6+</span><a name="line-6"></a><span class="hs-pragma">{-# LANGUAGE FlexibleContexts #-}</span><span>
7+</span><a name="line-7"></a><span class="hs-pragma">{-# LANGUAGE DataKinds #-}</span><span>
8+</span><a name="line-8"></a><span class="hs-pragma">{-# LANGUAGE RankNTypes #-}</span><span>
9+</span><a name="line-9"></a><span>
10+</span><a name="line-10"></a><span class="hs-keyword">module</span><span> </span><span class="hs-identifier">Dist.Internal</span><span>
11+</span><a name="line-11"></a><span> </span><span class="hs-special">(</span><span>
12+</span><a name="line-12"></a><span> </span><a href="Dist.Internal.html#Dist"><span class="hs-identifier hs-type">Dist</span></a><span class="hs-special">(</span><span class="hs-glyph">..</span><span class="hs-special">)</span><span class="hs-special">,</span><span>
13+</span><a name="line-13"></a><span> </span><a href="Dist.Internal.html#Prob"><span class="hs-identifier hs-type">Prob</span></a><span class="hs-special">,</span><span>
14+</span><a name="line-14"></a><span>
15+</span><a name="line-15"></a><span> </span><a href="Dist.Internal.html#fmapD"><span class="hs-identifier hs-var">fmapD</span></a><span class="hs-special">,</span><span>
16+</span><a name="line-16"></a><span> </span><a href="Dist.Internal.html#unitD"><span class="hs-identifier hs-var">unitD</span></a><span class="hs-special">,</span><span>
17+</span><a name="line-17"></a><span> </span><a href="Dist.Internal.html#multD"><span class="hs-identifier hs-var">multD</span></a><span class="hs-special">,</span><span>
18+</span><a name="line-18"></a><span> </span><a href="Dist.Internal.html#selectD"><span class="hs-identifier hs-var">selectD</span></a><span class="hs-special">,</span><span>
19+</span><a name="line-19"></a><span> </span><a href="Dist.Internal.html#returnD"><span class="hs-identifier hs-var">returnD</span></a><span class="hs-special">,</span><span>
20+</span><a name="line-20"></a><span> </span><a href="Dist.Internal.html#bindD"><span class="hs-identifier hs-var">bindD</span></a><span class="hs-special">,</span><span>
21+</span><a name="line-21"></a><span> </span><span class="hs-special">(</span><a href="Dist.Internal.html#%3F%3F"><span class="hs-operator hs-var">??</span></a><span class="hs-special">)</span><span class="hs-special">,</span><span>
22+</span><a name="line-22"></a><span>
23+</span><a name="line-23"></a><span> </span><a href="Dist.Internal.html#choose"><span class="hs-identifier hs-var">choose</span></a><span class="hs-special">,</span><span>
24+</span><a name="line-24"></a><span> </span><a href="Dist.Internal.html#shape"><span class="hs-identifier hs-var">shape</span></a><span class="hs-special">,</span><span>
25+</span><a name="line-25"></a><span> </span><a href="Dist.Internal.html#linear"><span class="hs-identifier hs-var">linear</span></a><span class="hs-special">,</span><span>
26+</span><a name="line-26"></a><span> </span><a href="Dist.Internal.html#uniform"><span class="hs-identifier hs-var">uniform</span></a><span class="hs-special">,</span><span>
27+</span><a name="line-27"></a><span> </span><a href="Dist.Internal.html#negExp"><span class="hs-identifier hs-var">negExp</span></a><span class="hs-special">,</span><span>
28+</span><a name="line-28"></a><span> </span><a href="Dist.Internal.html#normal"><span class="hs-identifier hs-var">normal</span></a><span class="hs-special">,</span><span>
29+</span><a name="line-29"></a><span> </span><a href="Dist.Internal.html#toValues"><span class="hs-identifier hs-var">toValues</span></a><span class="hs-special">,</span><span>
30+</span><a name="line-30"></a><span> </span><a href="Dist.Internal.html#prettyDist"><span class="hs-identifier hs-var">prettyDist</span></a><span class="hs-special">,</span><span>
31+</span><a name="line-31"></a><span> </span><a href="Dist.Internal.html#prettyPrintDist"><span class="hs-identifier hs-var">prettyPrintDist</span></a><span>
32+</span><a name="line-32"></a><span> </span><span class="hs-special">)</span><span>
33+</span><a name="line-33"></a><span> </span><span class="hs-keyword">where</span><span>
34+</span><a name="line-34"></a><span>
35+</span><a name="line-35"></a><span class="hs-keyword">import</span><span> </span><a href="Matrix.Type.html"><span class="hs-identifier">Matrix.Type</span></a><span>
36+</span><a name="line-36"></a><span class="hs-keyword">import</span><span> </span><a href="Utils.html"><span class="hs-identifier">Utils</span></a><span>
37+</span><a name="line-37"></a><span class="hs-keyword">import</span><span> </span><span class="hs-identifier">GHC.TypeLits</span><span>
38+</span><a name="line-38"></a><span class="hs-keyword">import</span><span> </span><span class="hs-identifier">Data.Proxy</span><span>
39+</span><a name="line-39"></a><span class="hs-keyword">import</span><span> </span><span class="hs-identifier">Data.List</span><span> </span><span class="hs-special">(</span><span class="hs-identifier hs-var">sortBy</span><span class="hs-special">)</span><span>
40+</span><a name="line-40"></a><span>
41+</span><a name="line-41"></a><span class="hs-comment">-- | Type synonym for probability value</span><span>
42+</span><a name="line-42"></a><span class="hs-keyword">type</span><span> </span><a name="Prob"><a href="Dist.Internal.html#Prob"><span class="hs-identifier">Prob</span></a></a><span> </span><span class="hs-glyph">=</span><span> </span><span class="hs-identifier hs-type">Double</span><span>
43+</span><a name="line-43"></a><span>
44+</span><a name="line-44"></a><span class="hs-comment">-- | Type synonym for column vector matrices. This represents a probability</span><span>
45+</span><a name="line-45"></a><span class="hs-comment">-- distribution.</span><span>
46+</span><a name="line-46"></a><span class="hs-keyword">newtype</span><span> </span><a name="Dist"><a href="Dist.Internal.html#Dist"><span class="hs-identifier">Dist</span></a></a><span> </span><a name="local-6989586621679068539"><a href="#local-6989586621679068539"><span class="hs-identifier">a</span></a></a><span> </span><span class="hs-glyph">=</span><span> </span><a name="D"><a href="Dist.Internal.html#D"><span class="hs-identifier">D</span></a></a><span> </span><span class="hs-special">(</span><a href="Matrix.Type.html#Matrix"><span class="hs-identifier hs-type">Matrix</span></a><span> </span><a href="Dist.Internal.html#Prob"><span class="hs-identifier hs-type">Prob</span></a><span> </span><span class="hs-special">(</span><span class="hs-special">)</span><span> </span><a href="#local-6989586621679068539"><span class="hs-identifier hs-type">a</span></a><span class="hs-special">)</span><span>
47+</span><a name="line-47"></a><span>
48+</span><a name="line-48"></a><span class="hs-comment">-- | Functor instance</span><span>
49+</span><a name="line-49"></a><span class="hs-identifier">fmapD</span><span> </span><span class="hs-glyph">::</span><span>
50+</span><a name="line-50"></a><span> </span><span class="hs-special">(</span><span> </span><span class="hs-identifier hs-type">Bounded</span><span> </span><a href="#local-6989586621679068558"><span class="hs-identifier hs-type">a</span></a><span class="hs-special">,</span><span>
51+</span><a name="line-51"></a><span> </span><span class="hs-identifier hs-type">Bounded</span><span> </span><a href="#local-6989586621679068559"><span class="hs-identifier hs-type">b</span></a><span class="hs-special">,</span><span>
52+</span><a name="line-52"></a><span> </span><span class="hs-identifier hs-type">Enum</span><span> </span><a href="#local-6989586621679068558"><span class="hs-identifier hs-type">a</span></a><span class="hs-special">,</span><span>
53+</span><a name="line-53"></a><span> </span><span class="hs-identifier hs-type">Enum</span><span> </span><a href="#local-6989586621679068559"><span class="hs-identifier hs-type">b</span></a><span class="hs-special">,</span><span>
54+</span><a name="line-54"></a><span> </span><span class="hs-identifier hs-type">Eq</span><span> </span><a href="#local-6989586621679068559"><span class="hs-identifier hs-type">b</span></a><span class="hs-special">,</span><span>
55+</span><a name="line-55"></a><span> </span><span class="hs-identifier hs-type">KnownNat</span><span> </span><span class="hs-special">(</span><a href="Matrix.Internal.html#Count"><span class="hs-identifier hs-type">Count</span></a><span> </span><span class="hs-special">(</span><a href="Matrix.Internal.html#Normalize"><span class="hs-identifier hs-type">Normalize</span></a><span> </span><a href="#local-6989586621679068558"><span class="hs-identifier hs-type">a</span></a><span class="hs-special">)</span><span class="hs-special">)</span><span class="hs-special">,</span><span>
56+</span><a name="line-56"></a><span> </span><span class="hs-identifier hs-type">KnownNat</span><span> </span><span class="hs-special">(</span><a href="Matrix.Internal.html#Count"><span class="hs-identifier hs-type">Count</span></a><span> </span><span class="hs-special">(</span><a href="Matrix.Internal.html#Normalize"><span class="hs-identifier hs-type">Normalize</span></a><span> </span><a href="#local-6989586621679068559"><span class="hs-identifier hs-type">b</span></a><span class="hs-special">)</span><span class="hs-special">)</span><span class="hs-special">,</span><span>
57+</span><a name="line-57"></a><span> </span><a href="Matrix.Internal.html#FromLists"><span class="hs-identifier hs-type">FromLists</span></a><span> </span><a href="Dist.Internal.html#Prob"><span class="hs-identifier hs-type">Prob</span></a><span> </span><span class="hs-special">(</span><a href="Matrix.Internal.html#Normalize"><span class="hs-identifier hs-type">Normalize</span></a><span> </span><a href="#local-6989586621679068559"><span class="hs-identifier hs-type">b</span></a><span class="hs-special">)</span><span> </span><span class="hs-special">(</span><a href="Matrix.Internal.html#Normalize"><span class="hs-identifier hs-type">Normalize</span></a><span> </span><a href="#local-6989586621679068558"><span class="hs-identifier hs-type">a</span></a><span class="hs-special">)</span><span>
58+</span><a name="line-58"></a><span> </span><span class="hs-special">)</span><span>
59+</span><a name="line-59"></a><span> </span><span class="hs-glyph">=&gt;</span><span>
60+</span><a name="line-60"></a><span> </span><span class="hs-special">(</span><a href="#local-6989586621679068558"><span class="hs-identifier hs-type">a</span></a><span> </span><span class="hs-glyph">-&gt;</span><span> </span><a href="#local-6989586621679068559"><span class="hs-identifier hs-type">b</span></a><span class="hs-special">)</span><span> </span><span class="hs-glyph">-&gt;</span><span> </span><a href="Dist.Internal.html#Dist"><span class="hs-identifier hs-type">Dist</span></a><span> </span><a href="#local-6989586621679068558"><span class="hs-identifier hs-type">a</span></a><span> </span><span class="hs-glyph">-&gt;</span><span> </span><a href="Dist.Internal.html#Dist"><span class="hs-identifier hs-type">Dist</span></a><span> </span><a href="#local-6989586621679068559"><span class="hs-identifier hs-type">b</span></a><span>
61+</span><a name="line-61"></a><a name="fmapD"><a href="Dist.Internal.html#fmapD"><span class="hs-identifier">fmapD</span></a></a><span> </span><a name="local-6989586621679068560"><a href="#local-6989586621679068560"><span class="hs-identifier">f</span></a></a><span> </span><span class="hs-special">(</span><a href="Dist.Internal.html#D"><span class="hs-identifier hs-var">D</span></a><span> </span><a name="local-6989586621679068561"><a href="#local-6989586621679068561"><span class="hs-identifier">m</span></a></a><span class="hs-special">)</span><span> </span><span class="hs-glyph">=</span><span> </span><a href="Dist.Internal.html#D"><span class="hs-identifier hs-var">D</span></a><span> </span><span class="hs-special">(</span><a href="Matrix.Type.html#fromF%27"><span class="hs-identifier hs-var">fromF'</span></a><span> </span><a href="#local-6989586621679068560"><span class="hs-identifier hs-var">f</span></a><span> </span><span class="hs-special">`</span><a href="Matrix.Type.html#comp"><span class="hs-identifier hs-var">comp</span></a><span class="hs-special">`</span><span> </span><a href="#local-6989586621679068561"><span class="hs-identifier hs-var">m</span></a><span class="hs-special">)</span><span>
62+</span><a name="line-62"></a><span>
63+</span><a name="line-63"></a><span class="hs-comment">-- | Applicative/Monoidal instance 'unit' function</span><span>
64+</span><a name="line-64"></a><span class="hs-identifier">unitD</span><span> </span><span class="hs-glyph">::</span><span> </span><a href="Dist.Internal.html#Dist"><span class="hs-identifier hs-type">Dist</span></a><span> </span><span class="hs-special">(</span><span class="hs-special">)</span><span>
65+</span><a name="line-65"></a><a name="unitD"><a href="Dist.Internal.html#unitD"><span class="hs-identifier">unitD</span></a></a><span> </span><span class="hs-glyph">=</span><span> </span><a href="Dist.Internal.html#D"><span class="hs-identifier hs-var">D</span></a><span> </span><span class="hs-special">(</span><a href="Matrix.Type.html#one"><span class="hs-identifier hs-var">one</span></a><span> </span><span class="hs-number">1</span><span class="hs-special">)</span><span>
66+</span><a name="line-66"></a><span>
67+</span><a name="line-67"></a><span class="hs-comment">-- | Applicative/Monoidal instance 'mult' function</span><span>
68+</span><a name="line-68"></a><span class="hs-identifier">multD</span><span> </span><span class="hs-glyph">::</span><span>
69+</span><a name="line-69"></a><span> </span><span class="hs-special">(</span><span> </span><span class="hs-identifier hs-type">KnownNat</span><span> </span><span class="hs-special">(</span><a href="Matrix.Internal.html#Count"><span class="hs-identifier hs-type">Count</span></a><span> </span><span class="hs-special">(</span><a href="Matrix.Internal.html#Normalize"><span class="hs-identifier hs-type">Normalize</span></a><span> </span><a href="#local-6989586621679068556"><span class="hs-identifier hs-type">a</span></a><span class="hs-special">)</span><span class="hs-special">)</span><span class="hs-special">,</span><span>
70+</span><a name="line-70"></a><span> </span><span class="hs-identifier hs-type">KnownNat</span><span> </span><span class="hs-special">(</span><a href="Matrix.Internal.html#Count"><span class="hs-identifier hs-type">Count</span></a><span> </span><span class="hs-special">(</span><a href="Matrix.Internal.html#Normalize"><span class="hs-identifier hs-type">Normalize</span></a><span> </span><a href="#local-6989586621679068557"><span class="hs-identifier hs-type">b</span></a><span class="hs-special">)</span><span class="hs-special">)</span><span class="hs-special">,</span><span>
71+</span><a name="line-71"></a><span> </span><span class="hs-identifier hs-type">KnownNat</span><span> </span><span class="hs-special">(</span><a href="Matrix.Internal.html#Count"><span class="hs-identifier hs-type">Count</span></a><span> </span><span class="hs-special">(</span><a href="Matrix.Internal.html#Normalize"><span class="hs-identifier hs-type">Normalize</span></a><span> </span><span class="hs-special">(</span><a href="#local-6989586621679068556"><span class="hs-identifier hs-type">a</span></a><span class="hs-special">,</span><span> </span><a href="#local-6989586621679068557"><span class="hs-identifier hs-type">b</span></a><span class="hs-special">)</span><span class="hs-special">)</span><span class="hs-special">)</span><span class="hs-special">,</span><span>
72+</span><a name="line-72"></a><span> </span><a href="Matrix.Internal.html#FromLists"><span class="hs-identifier hs-type">FromLists</span></a><span> </span><a href="Dist.Internal.html#Prob"><span class="hs-identifier hs-type">Prob</span></a><span> </span><span class="hs-special">(</span><a href="Matrix.Internal.html#Normalize"><span class="hs-identifier hs-type">Normalize</span></a><span> </span><span class="hs-special">(</span><a href="#local-6989586621679068556"><span class="hs-identifier hs-type">a</span></a><span class="hs-special">,</span><span> </span><a href="#local-6989586621679068557"><span class="hs-identifier hs-type">b</span></a><span class="hs-special">)</span><span class="hs-special">)</span><span> </span><span class="hs-special">(</span><a href="Matrix.Internal.html#Normalize"><span class="hs-identifier hs-type">Normalize</span></a><span> </span><a href="#local-6989586621679068556"><span class="hs-identifier hs-type">a</span></a><span class="hs-special">)</span><span class="hs-special">,</span><span>
73+</span><a name="line-73"></a><span> </span><a href="Matrix.Internal.html#FromLists"><span class="hs-identifier hs-type">FromLists</span></a><span> </span><a href="Dist.Internal.html#Prob"><span class="hs-identifier hs-type">Prob</span></a><span> </span><span class="hs-special">(</span><a href="Matrix.Internal.html#Normalize"><span class="hs-identifier hs-type">Normalize</span></a><span> </span><span class="hs-special">(</span><a href="#local-6989586621679068556"><span class="hs-identifier hs-type">a</span></a><span class="hs-special">,</span><span> </span><a href="#local-6989586621679068557"><span class="hs-identifier hs-type">b</span></a><span class="hs-special">)</span><span class="hs-special">)</span><span> </span><span class="hs-special">(</span><a href="Matrix.Internal.html#Normalize"><span class="hs-identifier hs-type">Normalize</span></a><span> </span><a href="#local-6989586621679068557"><span class="hs-identifier hs-type">b</span></a><span class="hs-special">)</span><span class="hs-special">,</span><span>
74+</span><a name="line-74"></a><span> </span><span class="hs-identifier hs-type">Normalize</span><span> </span><span class="hs-special">(</span><a href="#local-6989586621679068556"><span class="hs-identifier hs-type">a</span></a><span class="hs-special">,</span><span> </span><a href="#local-6989586621679068557"><span class="hs-identifier hs-type">b</span></a><span class="hs-special">)</span><span> </span><span class="hs-glyph">~</span><span> </span><a href="Matrix.Internal.html#Normalize"><span class="hs-identifier hs-type">Normalize</span></a><span> </span><span class="hs-special">(</span><a href="Matrix.Internal.html#Normalize"><span class="hs-identifier hs-type">Normalize</span></a><span> </span><a href="#local-6989586621679068556"><span class="hs-identifier hs-type">a</span></a><span class="hs-special">,</span><span> </span><a href="Matrix.Internal.html#Normalize"><span class="hs-identifier hs-type">Normalize</span></a><span> </span><a href="#local-6989586621679068557"><span class="hs-identifier hs-type">b</span></a><span class="hs-special">)</span><span>
75+</span><a name="line-75"></a><span> </span><span class="hs-special">)</span><span> </span><span class="hs-glyph">=&gt;</span><span> </span><a href="Dist.Internal.html#Dist"><span class="hs-identifier hs-type">Dist</span></a><span> </span><a href="#local-6989586621679068556"><span class="hs-identifier hs-type">a</span></a><span> </span><span class="hs-glyph">-&gt;</span><span> </span><a href="Dist.Internal.html#Dist"><span class="hs-identifier hs-type">Dist</span></a><span> </span><a href="#local-6989586621679068557"><span class="hs-identifier hs-type">b</span></a><span> </span><span class="hs-glyph">-&gt;</span><span> </span><a href="Dist.Internal.html#Dist"><span class="hs-identifier hs-type">Dist</span></a><span> </span><span class="hs-special">(</span><a href="#local-6989586621679068556"><span class="hs-identifier hs-type">a</span></a><span class="hs-special">,</span><span> </span><a href="#local-6989586621679068557"><span class="hs-identifier hs-type">b</span></a><span class="hs-special">)</span><span>
76+</span><a name="line-76"></a><a name="multD"><a href="Dist.Internal.html#multD"><span class="hs-identifier">multD</span></a></a><span> </span><span class="hs-special">(</span><a href="Dist.Internal.html#D"><span class="hs-identifier hs-var">D</span></a><span> </span><a name="local-6989586621679068562"><a href="#local-6989586621679068562"><span class="hs-identifier">a</span></a></a><span class="hs-special">)</span><span> </span><span class="hs-special">(</span><a href="Dist.Internal.html#D"><span class="hs-identifier hs-var">D</span></a><span> </span><a name="local-6989586621679068563"><a href="#local-6989586621679068563"><span class="hs-identifier">b</span></a></a><span class="hs-special">)</span><span> </span><span class="hs-glyph">=</span><span> </span><a href="Dist.Internal.html#D"><span class="hs-identifier hs-var">D</span></a><span> </span><span class="hs-special">(</span><a href="Matrix.Type.html#khatri"><span class="hs-identifier hs-var">khatri</span></a><span> </span><a href="#local-6989586621679068562"><span class="hs-identifier hs-var">a</span></a><span> </span><a href="#local-6989586621679068563"><span class="hs-identifier hs-var">b</span></a><span class="hs-special">)</span><span>
77+</span><a name="line-77"></a><span>
78+</span><a name="line-78"></a><span class="hs-comment">-- | Selective instance function</span><span>
79+</span><a name="line-79"></a><span class="hs-identifier">selectD</span><span> </span><span class="hs-glyph">::</span><span>
80+</span><a name="line-80"></a><span> </span><span class="hs-special">(</span><span> </span><span class="hs-identifier hs-type">Normalize</span><span> </span><span class="hs-special">(</span><span class="hs-identifier hs-type">Either</span><span> </span><a href="#local-6989586621679068554"><span class="hs-identifier hs-type">a</span></a><span> </span><a href="#local-6989586621679068555"><span class="hs-identifier hs-type">b</span></a><span class="hs-special">)</span><span> </span><span class="hs-glyph">~</span><span> </span><span class="hs-identifier hs-type">Either</span><span> </span><span class="hs-special">(</span><a href="Matrix.Internal.html#Normalize"><span class="hs-identifier hs-type">Normalize</span></a><span> </span><a href="#local-6989586621679068554"><span class="hs-identifier hs-type">a</span></a><span class="hs-special">)</span><span> </span><span class="hs-special">(</span><a href="Matrix.Internal.html#Normalize"><span class="hs-identifier hs-type">Normalize</span></a><span> </span><a href="#local-6989586621679068555"><span class="hs-identifier hs-type">b</span></a><span class="hs-special">)</span><span class="hs-special">,</span><span>
81+</span><a name="line-81"></a><span> </span><a href="Matrix.Internal.html#FromLists"><span class="hs-identifier hs-type">FromLists</span></a><span> </span><a href="Dist.Internal.html#Prob"><span class="hs-identifier hs-type">Prob</span></a><span> </span><span class="hs-special">(</span><a href="Matrix.Internal.html#Normalize"><span class="hs-identifier hs-type">Normalize</span></a><span> </span><a href="#local-6989586621679068555"><span class="hs-identifier hs-type">b</span></a><span class="hs-special">)</span><span> </span><span class="hs-special">(</span><a href="Matrix.Internal.html#Normalize"><span class="hs-identifier hs-type">Normalize</span></a><span> </span><a href="#local-6989586621679068555"><span class="hs-identifier hs-type">b</span></a><span class="hs-special">)</span><span class="hs-special">,</span><span>
82+</span><a name="line-82"></a><span> </span><span class="hs-identifier hs-type">KnownNat</span><span> </span><span class="hs-special">(</span><a href="Matrix.Internal.html#Count"><span class="hs-identifier hs-type">Count</span></a><span> </span><span class="hs-special">(</span><a href="Matrix.Internal.html#Normalize"><span class="hs-identifier hs-type">Normalize</span></a><span> </span><a href="#local-6989586621679068555"><span class="hs-identifier hs-type">b</span></a><span class="hs-special">)</span><span class="hs-special">)</span><span>
83+</span><a name="line-83"></a><span> </span><span class="hs-special">)</span><span> </span><span class="hs-glyph">=&gt;</span><span> </span><a href="Dist.Internal.html#Dist"><span class="hs-identifier hs-type">Dist</span></a><span> </span><span class="hs-special">(</span><span class="hs-identifier hs-type">Either</span><span> </span><a href="#local-6989586621679068554"><span class="hs-identifier hs-type">a</span></a><span> </span><a href="#local-6989586621679068555"><span class="hs-identifier hs-type">b</span></a><span class="hs-special">)</span><span> </span><span class="hs-glyph">-&gt;</span><span> </span><a href="Matrix.Type.html#Matrix"><span class="hs-identifier hs-type">Matrix</span></a><span> </span><a href="Dist.Internal.html#Prob"><span class="hs-identifier hs-type">Prob</span></a><span> </span><a href="#local-6989586621679068554"><span class="hs-identifier hs-type">a</span></a><span> </span><a href="#local-6989586621679068555"><span class="hs-identifier hs-type">b</span></a><span> </span><span class="hs-glyph">-&gt;</span><span> </span><a href="Dist.Internal.html#Dist"><span class="hs-identifier hs-type">Dist</span></a><span> </span><a href="#local-6989586621679068555"><span class="hs-identifier hs-type">b</span></a><span>
84+</span><a name="line-84"></a><a name="selectD"><a href="Dist.Internal.html#selectD"><span class="hs-identifier">selectD</span></a></a><span> </span><span class="hs-special">(</span><a href="Dist.Internal.html#D"><span class="hs-identifier hs-var">D</span></a><span> </span><a name="local-6989586621679068564"><a href="#local-6989586621679068564"><span class="hs-identifier">d</span></a></a><span class="hs-special">)</span><span> </span><a name="local-6989586621679068565"><a href="#local-6989586621679068565"><span class="hs-identifier">m</span></a></a><span> </span><span class="hs-glyph">=</span><span> </span><a href="Dist.Internal.html#D"><span class="hs-identifier hs-var">D</span></a><span> </span><span class="hs-special">(</span><a href="Matrix.Type.html#junc"><span class="hs-identifier hs-var">junc</span></a><span> </span><a href="#local-6989586621679068565"><span class="hs-identifier hs-var">m</span></a><span> </span><a href="Matrix.Type.html#identity"><span class="hs-identifier hs-var">identity</span></a><span> </span><span class="hs-special">`</span><a href="Matrix.Type.html#comp"><span class="hs-identifier hs-var">comp</span></a><span class="hs-special">`</span><span> </span><a href="#local-6989586621679068564"><span class="hs-identifier hs-var">d</span></a><span class="hs-special">)</span><span>
85+</span><a name="line-85"></a><span>
86+</span><a name="line-86"></a><span>
87+</span><a name="line-87"></a><span class="hs-comment">-- | Monad instance 'return' function</span><span>
88+</span><a name="line-88"></a><span class="hs-identifier">returnD</span><span> </span><span class="hs-glyph">::</span><span> </span><span class="hs-keyword">forall</span><span> </span><a name="local-6989586621679068553"><a href="#local-6989586621679068553"><span class="hs-identifier">a</span></a></a><span> </span><span class="hs-operator">.</span><span> </span><span class="hs-special">(</span><span class="hs-identifier hs-type">Enum</span><span> </span><a href="#local-6989586621679068553"><span class="hs-identifier hs-type">a</span></a><span class="hs-special">,</span><span> </span><a href="Matrix.Internal.html#FromLists"><span class="hs-identifier hs-type">FromLists</span></a><span> </span><a href="Dist.Internal.html#Prob"><span class="hs-identifier hs-type">Prob</span></a><span> </span><span class="hs-special">(</span><span class="hs-special">)</span><span> </span><span class="hs-special">(</span><a href="Matrix.Internal.html#Normalize"><span class="hs-identifier hs-type">Normalize</span></a><span> </span><a href="#local-6989586621679068553"><span class="hs-identifier hs-type">a</span></a><span class="hs-special">)</span><span class="hs-special">,</span><span> </span><span class="hs-identifier hs-type">KnownNat</span><span> </span><span class="hs-special">(</span><a href="Matrix.Internal.html#Count"><span class="hs-identifier hs-type">Count</span></a><span> </span><a href="#local-6989586621679068553"><span class="hs-identifier hs-type">a</span></a><span class="hs-special">)</span><span class="hs-special">)</span><span> </span><span class="hs-glyph">=&gt;</span><span> </span><a href="#local-6989586621679068553"><span class="hs-identifier hs-type">a</span></a><span> </span><span class="hs-glyph">-&gt;</span><span> </span><a href="Dist.Internal.html#Dist"><span class="hs-identifier hs-type">Dist</span></a><span> </span><a href="#local-6989586621679068553"><span class="hs-identifier hs-type">a</span></a><span>
89+</span><a name="line-89"></a><a name="returnD"><a href="Dist.Internal.html#returnD"><span class="hs-identifier">returnD</span></a></a><span> </span><a name="local-6989586621679068566"><a href="#local-6989586621679068566"><span class="hs-identifier">a</span></a></a><span> </span><span class="hs-glyph">=</span><span> </span><a href="Dist.Internal.html#D"><span class="hs-identifier hs-var">D</span></a><span> </span><span class="hs-special">(</span><a href="Matrix.Type.html#col"><span class="hs-identifier hs-var">col</span></a><span> </span><a href="#local-6989586621679068569"><span class="hs-identifier hs-var">l</span></a><span class="hs-special">)</span><span>
90+</span><a name="line-90"></a><span> </span><span class="hs-keyword">where</span><span>
91+</span><a name="line-91"></a><span> </span><a name="local-6989586621679068567"><a href="#local-6989586621679068567"><span class="hs-identifier">i</span></a></a><span> </span><span class="hs-glyph">=</span><span> </span><span class="hs-identifier hs-var">fromInteger</span><span> </span><span class="hs-operator hs-var">$</span><span> </span><span class="hs-identifier hs-var">natVal</span><span> </span><span class="hs-special">(</span><span class="hs-identifier hs-var">Proxy</span><span> </span><span class="hs-glyph">::</span><span> </span><span class="hs-identifier hs-type">Proxy</span><span> </span><span class="hs-special">(</span><a href="Matrix.Internal.html#Count"><span class="hs-identifier hs-type">Count</span></a><span> </span><a href="#local-6989586621679068553"><span class="hs-identifier hs-type">a</span></a><span class="hs-special">)</span><span class="hs-special">)</span><span>
92+</span><a name="line-92"></a><span> </span><a name="local-6989586621679068568"><a href="#local-6989586621679068568"><span class="hs-identifier">x</span></a></a><span> </span><span class="hs-glyph">=</span><span> </span><span class="hs-identifier hs-var">fromEnum</span><span> </span><a href="#local-6989586621679068566"><span class="hs-identifier hs-var">a</span></a><span>
93+</span><a name="line-93"></a><span> </span><a name="local-6989586621679068569"><a href="#local-6989586621679068569"><span class="hs-identifier">l</span></a></a><span> </span><span class="hs-glyph">=</span><span> </span><span class="hs-identifier hs-var">take</span><span> </span><a href="#local-6989586621679068568"><span class="hs-identifier hs-var">x</span></a><span> </span><span class="hs-special">[</span><span class="hs-number">0</span><span class="hs-special">,</span><span class="hs-number">0</span><span class="hs-glyph">..</span><span class="hs-special">]</span><span> </span><span class="hs-operator hs-var">++</span><span> </span><span class="hs-special">[</span><span class="hs-number">1</span><span class="hs-special">]</span><span> </span><span class="hs-operator hs-var">++</span><span> </span><span class="hs-identifier hs-var">take</span><span> </span><span class="hs-special">(</span><a href="#local-6989586621679068567"><span class="hs-identifier hs-var">i</span></a><span> </span><span class="hs-glyph">-</span><span> </span><a href="#local-6989586621679068568"><span class="hs-identifier hs-var">x</span></a><span> </span><span class="hs-glyph">-</span><span> </span><span class="hs-number">1</span><span class="hs-special">)</span><span> </span><span class="hs-special">[</span><span class="hs-number">0</span><span class="hs-special">,</span><span class="hs-number">0</span><span class="hs-glyph">..</span><span class="hs-special">]</span><span>
94+</span><a name="line-94"></a><span>
95+</span><a name="line-95"></a><span class="hs-comment">-- | Monad instance '(&gt;&gt;=)' function</span><span>
96+</span><a name="line-96"></a><span class="hs-identifier">bindD</span><span> </span><span class="hs-glyph">::</span><span> </span><a href="Dist.Internal.html#Dist"><span class="hs-identifier hs-type">Dist</span></a><span> </span><a href="#local-6989586621679068551"><span class="hs-identifier hs-type">a</span></a><span> </span><span class="hs-glyph">-&gt;</span><span> </span><a href="Matrix.Type.html#Matrix"><span class="hs-identifier hs-type">Matrix</span></a><span> </span><a href="Dist.Internal.html#Prob"><span class="hs-identifier hs-type">Prob</span></a><span> </span><a href="#local-6989586621679068551"><span class="hs-identifier hs-type">a</span></a><span> </span><a href="#local-6989586621679068552"><span class="hs-identifier hs-type">b</span></a><span> </span><span class="hs-glyph">-&gt;</span><span> </span><a href="Dist.Internal.html#Dist"><span class="hs-identifier hs-type">Dist</span></a><span> </span><a href="#local-6989586621679068552"><span class="hs-identifier hs-type">b</span></a><span>
97+</span><a name="line-97"></a><a name="bindD"><a href="Dist.Internal.html#bindD"><span class="hs-identifier">bindD</span></a></a><span> </span><span class="hs-special">(</span><a href="Dist.Internal.html#D"><span class="hs-identifier hs-var">D</span></a><span> </span><a name="local-6989586621679068570"><a href="#local-6989586621679068570"><span class="hs-identifier">d</span></a></a><span class="hs-special">)</span><span> </span><a name="local-6989586621679068571"><a href="#local-6989586621679068571"><span class="hs-identifier">m</span></a></a><span> </span><span class="hs-glyph">=</span><span> </span><a href="Dist.Internal.html#D"><span class="hs-identifier hs-var">D</span></a><span> </span><span class="hs-special">(</span><a href="#local-6989586621679068571"><span class="hs-identifier hs-var">m</span></a><span> </span><span class="hs-special">`</span><a href="Matrix.Type.html#comp"><span class="hs-identifier hs-var">comp</span></a><span class="hs-special">`</span><span> </span><a href="#local-6989586621679068570"><span class="hs-identifier hs-var">d</span></a><span class="hs-special">)</span><span>
98+</span><a name="line-98"></a><span>
99+</span><a name="line-99"></a><span class="hs-comment">-- | Extract probabilities given an Event.</span><span>
100+</span><a name="line-100"></a><span class="hs-special">(</span><span class="hs-operator">??</span><span class="hs-special">)</span><span> </span><span class="hs-glyph">::</span><span>
101+</span><a name="line-101"></a><span> </span><span class="hs-special">(</span><span> </span><span class="hs-identifier hs-type">Enum</span><span> </span><a href="#local-6989586621679068550"><span class="hs-identifier hs-type">a</span></a><span class="hs-special">,</span><span>
102+</span><a name="line-102"></a><span> </span><span class="hs-identifier hs-type">KnownNat</span><span> </span><span class="hs-special">(</span><a href="Matrix.Internal.html#Count"><span class="hs-identifier hs-type">Count</span></a><span> </span><a href="#local-6989586621679068550"><span class="hs-identifier hs-type">a</span></a><span class="hs-special">)</span><span class="hs-special">,</span><span>
103+</span><a name="line-103"></a><span> </span><a href="Matrix.Internal.html#FromLists"><span class="hs-identifier hs-type">FromLists</span></a><span> </span><a href="Dist.Internal.html#Prob"><span class="hs-identifier hs-type">Prob</span></a><span> </span><span class="hs-special">(</span><span class="hs-special">)</span><span> </span><span class="hs-special">(</span><a href="Matrix.Internal.html#Normalize"><span class="hs-identifier hs-type">Normalize</span></a><span> </span><a href="#local-6989586621679068550"><span class="hs-identifier hs-type">a</span></a><span class="hs-special">)</span><span>
104+</span><a name="line-104"></a><span> </span><span class="hs-special">)</span><span> </span><span class="hs-glyph">=&gt;</span><span> </span><span class="hs-special">(</span><a href="#local-6989586621679068550"><span class="hs-identifier hs-type">a</span></a><span> </span><span class="hs-glyph">-&gt;</span><span> </span><span class="hs-identifier hs-type">Bool</span><span class="hs-special">)</span><span> </span><span class="hs-glyph">-&gt;</span><span> </span><a href="Dist.Internal.html#Dist"><span class="hs-identifier hs-type">Dist</span></a><span> </span><a href="#local-6989586621679068550"><span class="hs-identifier hs-type">a</span></a><span> </span><span class="hs-glyph">-&gt;</span><span> </span><a href="Dist.Internal.html#Prob"><span class="hs-identifier hs-type">Prob</span></a><span>
105+</span><a name="line-105"></a><span class="hs-special">(</span><a name="%3F%3F"><a href="Dist.Internal.html#%3F%3F"><span class="hs-operator">??</span></a></a><span class="hs-special">)</span><span> </span><a name="local-6989586621679068572"><a href="#local-6989586621679068572"><span class="hs-identifier">p</span></a></a><span> </span><a name="local-6989586621679068573"><a href="#local-6989586621679068573"><span class="hs-identifier">d</span></a></a><span> </span><span class="hs-glyph">=</span><span>
106+</span><a name="line-106"></a><span> </span><span class="hs-keyword">let</span><span> </span><a name="local-6989586621679068574"><a href="#local-6989586621679068574"><span class="hs-identifier">l</span></a></a><span> </span><span class="hs-glyph">=</span><span> </span><a href="Dist.Internal.html#toValues"><span class="hs-identifier hs-var">toValues</span></a><span> </span><a href="#local-6989586621679068573"><span class="hs-identifier hs-var">d</span></a><span>
107+</span><a name="line-107"></a><span> </span><a name="local-6989586621679068575"><a href="#local-6989586621679068575"><span class="hs-identifier">x</span></a></a><span> </span><span class="hs-glyph">=</span><span> </span><span class="hs-identifier hs-var">filter</span><span> </span><span class="hs-special">(</span><a href="#local-6989586621679068572"><span class="hs-identifier hs-var">p</span></a><span> </span><span class="hs-operator hs-var">.</span><span> </span><span class="hs-identifier hs-var">fst</span><span class="hs-special">)</span><span> </span><a href="#local-6989586621679068574"><span class="hs-identifier hs-var">l</span></a><span>
108+</span><a name="line-108"></a><span> </span><span class="hs-keyword">in</span><span> </span><span class="hs-identifier hs-var">sum</span><span> </span><span class="hs-operator hs-var">.</span><span> </span><span class="hs-identifier hs-var">map</span><span> </span><span class="hs-identifier hs-var">snd</span><span> </span><span class="hs-operator hs-var">$</span><span> </span><a href="#local-6989586621679068575"><span class="hs-identifier hs-var">x</span></a><span>
109+</span><a name="line-109"></a><span>
110+</span><a name="line-110"></a><span class="hs-comment">-- Distribution Construction</span><span>
111+</span><a name="line-111"></a><span>
112+</span><a name="line-112"></a><span class="hs-comment">-- | Constructs a Bernoulli distribution</span><span>
113+</span><a name="line-113"></a><span class="hs-identifier">choose</span><span> </span><span class="hs-glyph">::</span><span> </span><span class="hs-special">(</span><a href="Matrix.Internal.html#FromLists"><span class="hs-identifier hs-type">FromLists</span></a><span> </span><a href="Dist.Internal.html#Prob"><span class="hs-identifier hs-type">Prob</span></a><span> </span><span class="hs-special">(</span><span class="hs-special">)</span><span> </span><span class="hs-special">(</span><a href="Matrix.Internal.html#Normalize"><span class="hs-identifier hs-type">Normalize</span></a><span> </span><a href="#local-6989586621679068549"><span class="hs-identifier hs-type">a</span></a><span class="hs-special">)</span><span class="hs-special">)</span><span> </span><span class="hs-glyph">=&gt;</span><span> </span><a href="Dist.Internal.html#Prob"><span class="hs-identifier hs-type">Prob</span></a><span> </span><span class="hs-glyph">-&gt;</span><span> </span><a href="Dist.Internal.html#Dist"><span class="hs-identifier hs-type">Dist</span></a><span> </span><a href="#local-6989586621679068549"><span class="hs-identifier hs-type">a</span></a><span>
114+</span><a name="line-114"></a><a name="choose"><a href="Dist.Internal.html#choose"><span class="hs-identifier">choose</span></a></a><span> </span><a name="local-6989586621679068576"><a href="#local-6989586621679068576"><span class="hs-identifier">prob</span></a></a><span> </span><span class="hs-glyph">=</span><span> </span><a href="Dist.Internal.html#D"><span class="hs-identifier hs-var">D</span></a><span> </span><span class="hs-special">(</span><a href="Matrix.Type.html#col"><span class="hs-identifier hs-var">col</span></a><span> </span><span class="hs-special">[</span><a href="#local-6989586621679068576"><span class="hs-identifier hs-var">prob</span></a><span class="hs-special">,</span><span> </span><span class="hs-number">1</span><span> </span><span class="hs-glyph">-</span><span> </span><a href="#local-6989586621679068576"><span class="hs-identifier hs-var">prob</span></a><span class="hs-special">]</span><span class="hs-special">)</span><span>
115+</span><a name="line-115"></a><span>
116+</span><a name="line-116"></a><span class="hs-comment">-- | Creates a distribution given a shape function</span><span>
117+</span><a name="line-117"></a><span class="hs-identifier">shape</span><span> </span><span class="hs-glyph">::</span><span> </span><span class="hs-special">(</span><a href="Matrix.Internal.html#FromLists"><span class="hs-identifier hs-type">FromLists</span></a><span> </span><a href="Dist.Internal.html#Prob"><span class="hs-identifier hs-type">Prob</span></a><span> </span><span class="hs-special">(</span><span class="hs-special">)</span><span> </span><span class="hs-special">(</span><a href="Matrix.Internal.html#Normalize"><span class="hs-identifier hs-type">Normalize</span></a><span> </span><a href="#local-6989586621679068548"><span class="hs-identifier hs-type">a</span></a><span class="hs-special">)</span><span class="hs-special">)</span><span> </span><span class="hs-glyph">=&gt;</span><span> </span><span class="hs-special">(</span><a href="Dist.Internal.html#Prob"><span class="hs-identifier hs-type">Prob</span></a><span> </span><span class="hs-glyph">-&gt;</span><span> </span><a href="Dist.Internal.html#Prob"><span class="hs-identifier hs-type">Prob</span></a><span class="hs-special">)</span><span> </span><span class="hs-glyph">-&gt;</span><span> </span><span class="hs-special">[</span><a href="#local-6989586621679068548"><span class="hs-identifier hs-type">a</span></a><span class="hs-special">]</span><span> </span><span class="hs-glyph">-&gt;</span><span> </span><a href="Dist.Internal.html#Dist"><span class="hs-identifier hs-type">Dist</span></a><span> </span><a href="#local-6989586621679068548"><span class="hs-identifier hs-type">a</span></a><span>
118+</span><a name="line-118"></a><a name="shape"><a href="Dist.Internal.html#shape"><span class="hs-identifier">shape</span></a></a><span> </span><span class="hs-identifier">_</span><span> </span><span class="hs-special">[</span><span class="hs-special">]</span><span> </span><span class="hs-glyph">=</span><span> </span><span class="hs-identifier hs-var">error</span><span> </span><span class="hs-string">&quot;Probability.shape: empty list&quot;</span><span>
119+</span><a name="line-119"></a><span class="hs-identifier">shape</span><span> </span><a name="local-6989586621679068577"><a href="#local-6989586621679068577"><span class="hs-identifier">f</span></a></a><span> </span><a name="local-6989586621679068578"><a href="#local-6989586621679068578"><span class="hs-identifier">xs</span></a></a><span> </span><span class="hs-glyph">=</span><span>
120+</span><a name="line-120"></a><span> </span><span class="hs-keyword">let</span><span> </span><a name="local-6989586621679068579"><a href="#local-6989586621679068579"><span class="hs-identifier">incr</span></a></a><span> </span><span class="hs-glyph">=</span><span> </span><span class="hs-number">1</span><span> </span><span class="hs-operator hs-var">/</span><span> </span><span class="hs-identifier hs-var">fromIntegral</span><span> </span><span class="hs-special">(</span><span class="hs-identifier hs-var">length</span><span> </span><a href="#local-6989586621679068578"><span class="hs-identifier hs-var">xs</span></a><span> </span><span class="hs-glyph">-</span><span> </span><span class="hs-number">1</span><span class="hs-special">)</span><span>
121+</span><a name="line-121"></a><span> </span><a name="local-6989586621679068580"><a href="#local-6989586621679068580"><span class="hs-identifier">ps</span></a></a><span> </span><span class="hs-glyph">=</span><span> </span><span class="hs-identifier hs-var">map</span><span> </span><a href="#local-6989586621679068577"><span class="hs-identifier hs-var">f</span></a><span> </span><span class="hs-special">(</span><span class="hs-identifier hs-var">iterate</span><span> </span><span class="hs-special">(</span><span class="hs-operator hs-var">+</span><a href="#local-6989586621679068579"><span class="hs-identifier hs-var">incr</span></a><span class="hs-special">)</span><span> </span><span class="hs-number">0</span><span class="hs-special">)</span><span>
122+</span><a name="line-122"></a><span> </span><span class="hs-keyword">in</span><span> </span><a href="Dist.Internal.html#fromFreqs"><span class="hs-identifier hs-var">fromFreqs</span></a><span> </span><span class="hs-special">(</span><span class="hs-identifier hs-var">zip</span><span> </span><a href="#local-6989586621679068578"><span class="hs-identifier hs-var">xs</span></a><span> </span><a href="#local-6989586621679068580"><span class="hs-identifier hs-var">ps</span></a><span class="hs-special">)</span><span>
123+</span><a name="line-123"></a><span>
124+</span><a name="line-124"></a><span class="hs-comment">-- | Constructs a Linear distribution</span><span>
125+</span><a name="line-125"></a><span class="hs-identifier">linear</span><span> </span><span class="hs-glyph">::</span><span> </span><span class="hs-special">(</span><a href="Matrix.Internal.html#FromLists"><span class="hs-identifier hs-type">FromLists</span></a><span> </span><a href="Dist.Internal.html#Prob"><span class="hs-identifier hs-type">Prob</span></a><span> </span><span class="hs-special">(</span><span class="hs-special">)</span><span> </span><span class="hs-special">(</span><a href="Matrix.Internal.html#Normalize"><span class="hs-identifier hs-type">Normalize</span></a><span> </span><a href="#local-6989586621679068547"><span class="hs-identifier hs-type">a</span></a><span class="hs-special">)</span><span class="hs-special">)</span><span> </span><span class="hs-glyph">=&gt;</span><span> </span><span class="hs-special">[</span><a href="#local-6989586621679068547"><span class="hs-identifier hs-type">a</span></a><span class="hs-special">]</span><span> </span><span class="hs-glyph">-&gt;</span><span> </span><a href="Dist.Internal.html#Dist"><span class="hs-identifier hs-type">Dist</span></a><span> </span><a href="#local-6989586621679068547"><span class="hs-identifier hs-type">a</span></a><span>
126+</span><a name="line-126"></a><a name="linear"><a href="Dist.Internal.html#linear"><span class="hs-identifier">linear</span></a></a><span> </span><span class="hs-glyph">=</span><span> </span><a href="Dist.Internal.html#shape"><span class="hs-identifier hs-var">shape</span></a><span> </span><span class="hs-identifier hs-var">id</span><span>
127+</span><a name="line-127"></a><span>
128+</span><a name="line-128"></a><span class="hs-comment">-- | Constructs an Uniform distribution</span><span>
129+</span><a name="line-129"></a><span class="hs-identifier">uniform</span><span> </span><span class="hs-glyph">::</span><span> </span><span class="hs-special">(</span><a href="Matrix.Internal.html#FromLists"><span class="hs-identifier hs-type">FromLists</span></a><span> </span><a href="Dist.Internal.html#Prob"><span class="hs-identifier hs-type">Prob</span></a><span> </span><span class="hs-special">(</span><span class="hs-special">)</span><span> </span><span class="hs-special">(</span><a href="Matrix.Internal.html#Normalize"><span class="hs-identifier hs-type">Normalize</span></a><span> </span><a href="#local-6989586621679068546"><span class="hs-identifier hs-type">a</span></a><span class="hs-special">)</span><span class="hs-special">)</span><span> </span><span class="hs-glyph">=&gt;</span><span> </span><span class="hs-special">[</span><a href="#local-6989586621679068546"><span class="hs-identifier hs-type">a</span></a><span class="hs-special">]</span><span> </span><span class="hs-glyph">-&gt;</span><span> </span><a href="Dist.Internal.html#Dist"><span class="hs-identifier hs-type">Dist</span></a><span> </span><a href="#local-6989586621679068546"><span class="hs-identifier hs-type">a</span></a><span>
130+</span><a name="line-130"></a><a name="uniform"><a href="Dist.Internal.html#uniform"><span class="hs-identifier">uniform</span></a></a><span> </span><span class="hs-glyph">=</span><span> </span><a href="Dist.Internal.html#shape"><span class="hs-identifier hs-var">shape</span></a><span> </span><span class="hs-special">(</span><span class="hs-identifier hs-var">const</span><span> </span><span class="hs-number">1</span><span class="hs-special">)</span><span>
131+</span><a name="line-131"></a><span>
132+</span><a name="line-132"></a><span class="hs-comment">-- | Constructs an Negative Exponential distribution</span><span>
133+</span><a name="line-133"></a><span class="hs-identifier">negExp</span><span> </span><span class="hs-glyph">::</span><span> </span><span class="hs-special">(</span><a href="Matrix.Internal.html#FromLists"><span class="hs-identifier hs-type">FromLists</span></a><span> </span><a href="Dist.Internal.html#Prob"><span class="hs-identifier hs-type">Prob</span></a><span> </span><span class="hs-special">(</span><span class="hs-special">)</span><span> </span><span class="hs-special">(</span><a href="Matrix.Internal.html#Normalize"><span class="hs-identifier hs-type">Normalize</span></a><span> </span><a href="#local-6989586621679068545"><span class="hs-identifier hs-type">a</span></a><span class="hs-special">)</span><span class="hs-special">)</span><span> </span><span class="hs-glyph">=&gt;</span><span> </span><span class="hs-special">[</span><a href="#local-6989586621679068545"><span class="hs-identifier hs-type">a</span></a><span class="hs-special">]</span><span> </span><span class="hs-glyph">-&gt;</span><span> </span><a href="Dist.Internal.html#Dist"><span class="hs-identifier hs-type">Dist</span></a><span> </span><a href="#local-6989586621679068545"><span class="hs-identifier hs-type">a</span></a><span>
134+</span><a name="line-134"></a><a name="negExp"><a href="Dist.Internal.html#negExp"><span class="hs-identifier">negExp</span></a></a><span> </span><span class="hs-glyph">=</span><span> </span><a href="Dist.Internal.html#shape"><span class="hs-identifier hs-var">shape</span></a><span> </span><span class="hs-special">(</span><span class="hs-glyph">\</span><a name="local-6989586621679068581"><a href="#local-6989586621679068581"><span class="hs-identifier">x</span></a></a><span> </span><span class="hs-glyph">-&gt;</span><span> </span><span class="hs-identifier hs-var">exp</span><span> </span><span class="hs-special">(</span><span class="hs-glyph">-</span><a href="#local-6989586621679068581"><span class="hs-identifier hs-var">x</span></a><span class="hs-special">)</span><span class="hs-special">)</span><span>
135+</span><a name="line-135"></a><span>
136+</span><a name="line-136"></a><span class="hs-comment">-- | Constructs an Normal distribution</span><span>
137+</span><a name="line-137"></a><span class="hs-identifier">normal</span><span> </span><span class="hs-glyph">::</span><span> </span><span class="hs-special">(</span><a href="Matrix.Internal.html#FromLists"><span class="hs-identifier hs-type">FromLists</span></a><span> </span><a href="Dist.Internal.html#Prob"><span class="hs-identifier hs-type">Prob</span></a><span> </span><span class="hs-special">(</span><span class="hs-special">)</span><span> </span><span class="hs-special">(</span><a href="Matrix.Internal.html#Normalize"><span class="hs-identifier hs-type">Normalize</span></a><span> </span><a href="#local-6989586621679068544"><span class="hs-identifier hs-type">a</span></a><span class="hs-special">)</span><span class="hs-special">)</span><span> </span><span class="hs-glyph">=&gt;</span><span> </span><span class="hs-special">[</span><a href="#local-6989586621679068544"><span class="hs-identifier hs-type">a</span></a><span class="hs-special">]</span><span> </span><span class="hs-glyph">-&gt;</span><span> </span><a href="Dist.Internal.html#Dist"><span class="hs-identifier hs-type">Dist</span></a><span> </span><a href="#local-6989586621679068544"><span class="hs-identifier hs-type">a</span></a><span>
138+</span><a name="line-138"></a><a name="normal"><a href="Dist.Internal.html#normal"><span class="hs-identifier">normal</span></a></a><span> </span><span class="hs-glyph">=</span><span> </span><a href="Dist.Internal.html#shape"><span class="hs-identifier hs-var">shape</span></a><span> </span><span class="hs-special">(</span><a href="Dist.Internal.html#normalCurve"><span class="hs-identifier hs-var">normalCurve</span></a><span> </span><span class="hs-number">0.5</span><span> </span><span class="hs-number">0.5</span><span class="hs-special">)</span><span>
139+</span><a name="line-139"></a><span>
140+</span><a name="line-140"></a><span class="hs-comment">-- | Transforms a 'Dist' into a list of pairs.</span><span>
141+</span><a name="line-141"></a><span class="hs-identifier">toValues</span><span> </span><span class="hs-glyph">::</span><span> </span><span class="hs-keyword">forall</span><span> </span><a name="local-6989586621679068543"><a href="#local-6989586621679068543"><span class="hs-identifier">a</span></a></a><span> </span><span class="hs-operator">.</span><span> </span><span class="hs-special">(</span><span class="hs-identifier hs-type">Enum</span><span> </span><a href="#local-6989586621679068543"><span class="hs-identifier hs-type">a</span></a><span class="hs-special">,</span><span> </span><span class="hs-identifier hs-type">KnownNat</span><span> </span><span class="hs-special">(</span><a href="Matrix.Internal.html#Count"><span class="hs-identifier hs-type">Count</span></a><span> </span><a href="#local-6989586621679068543"><span class="hs-identifier hs-type">a</span></a><span class="hs-special">)</span><span class="hs-special">,</span><span> </span><a href="Matrix.Internal.html#FromLists"><span class="hs-identifier hs-type">FromLists</span></a><span> </span><a href="Dist.Internal.html#Prob"><span class="hs-identifier hs-type">Prob</span></a><span> </span><span class="hs-special">(</span><span class="hs-special">)</span><span> </span><span class="hs-special">(</span><a href="Matrix.Internal.html#Normalize"><span class="hs-identifier hs-type">Normalize</span></a><span> </span><a href="#local-6989586621679068543"><span class="hs-identifier hs-type">a</span></a><span class="hs-special">)</span><span class="hs-special">)</span><span> </span><span class="hs-glyph">=&gt;</span><span> </span><a href="Dist.Internal.html#Dist"><span class="hs-identifier hs-type">Dist</span></a><span> </span><a href="#local-6989586621679068543"><span class="hs-identifier hs-type">a</span></a><span> </span><span class="hs-glyph">-&gt;</span><span> </span><span class="hs-special">[</span><span class="hs-special">(</span><a href="#local-6989586621679068543"><span class="hs-identifier hs-type">a</span></a><span class="hs-special">,</span><span> </span><a href="Dist.Internal.html#Prob"><span class="hs-identifier hs-type">Prob</span></a><span class="hs-special">)</span><span class="hs-special">]</span><span>
142+</span><a name="line-142"></a><a name="toValues"><a href="Dist.Internal.html#toValues"><span class="hs-identifier">toValues</span></a></a><span> </span><span class="hs-special">(</span><a href="Dist.Internal.html#D"><span class="hs-identifier hs-var">D</span></a><span> </span><a name="local-6989586621679068582"><a href="#local-6989586621679068582"><span class="hs-identifier">d</span></a></a><span class="hs-special">)</span><span> </span><span class="hs-glyph">=</span><span>
143+</span><a name="line-143"></a><span> </span><span class="hs-keyword">let</span><span> </span><a name="local-6989586621679068583"><a href="#local-6989586621679068583"><span class="hs-identifier">rows</span></a></a><span> </span><span class="hs-glyph">=</span><span> </span><span class="hs-identifier hs-var">fromInteger</span><span> </span><span class="hs-special">(</span><span class="hs-identifier hs-var">natVal</span><span> </span><span class="hs-special">(</span><span class="hs-identifier hs-var">Proxy</span><span> </span><span class="hs-glyph">::</span><span> </span><span class="hs-identifier hs-type">Proxy</span><span> </span><span class="hs-special">(</span><a href="Matrix.Internal.html#Count"><span class="hs-identifier hs-type">Count</span></a><span> </span><a href="#local-6989586621679068543"><span class="hs-identifier hs-type">a</span></a><span class="hs-special">)</span><span class="hs-special">)</span><span class="hs-special">)</span><span>
144+</span><a name="line-144"></a><span> </span><a name="local-6989586621679068584"><a href="#local-6989586621679068584"><span class="hs-identifier">probs</span></a></a><span> </span><span class="hs-glyph">=</span><span> </span><a href="Matrix.Type.html#toList"><span class="hs-identifier hs-var">toList</span></a><span> </span><a href="#local-6989586621679068582"><span class="hs-identifier hs-var">d</span></a><span>
145+</span><a name="line-145"></a><span> </span><a name="local-6989586621679068585"><a href="#local-6989586621679068585"><span class="hs-identifier">res</span></a></a><span> </span><span class="hs-glyph">=</span><span> </span><span class="hs-identifier hs-var">zip</span><span> </span><span class="hs-special">(</span><span class="hs-identifier hs-var">map</span><span> </span><span class="hs-identifier hs-var">toEnum</span><span> </span><span class="hs-special">[</span><span class="hs-number">0</span><span class="hs-glyph">..</span><a href="#local-6989586621679068583"><span class="hs-identifier hs-var">rows</span></a><span class="hs-special">]</span><span class="hs-special">)</span><span> </span><a href="#local-6989586621679068584"><span class="hs-identifier hs-var">probs</span></a><span>
146+</span><a name="line-146"></a><span> </span><span class="hs-keyword">in</span><span> </span><a href="#local-6989586621679068585"><span class="hs-identifier hs-var">res</span></a><span>
147+</span><a name="line-147"></a><span>
148+</span><a name="line-148"></a><span class="hs-comment">-- | Pretty a distribution</span><span>
149+</span><a name="line-149"></a><span class="hs-identifier">prettyDist</span><span> </span><span class="hs-glyph">::</span><span> </span><span class="hs-keyword">forall</span><span> </span><a name="local-6989586621679068542"><a href="#local-6989586621679068542"><span class="hs-identifier">a</span></a></a><span class="hs-operator">.</span><span> </span><span class="hs-special">(</span><span class="hs-identifier hs-type">Show</span><span> </span><a href="#local-6989586621679068542"><span class="hs-identifier hs-type">a</span></a><span class="hs-special">,</span><span> </span><span class="hs-identifier hs-type">Enum</span><span> </span><a href="#local-6989586621679068542"><span class="hs-identifier hs-type">a</span></a><span class="hs-special">,</span><span> </span><span class="hs-identifier hs-type">KnownNat</span><span> </span><span class="hs-special">(</span><a href="Matrix.Internal.html#Count"><span class="hs-identifier hs-type">Count</span></a><span> </span><a href="#local-6989586621679068542"><span class="hs-identifier hs-type">a</span></a><span class="hs-special">)</span><span class="hs-special">,</span><span> </span><a href="Matrix.Internal.html#FromLists"><span class="hs-identifier hs-type">FromLists</span></a><span> </span><a href="Dist.Internal.html#Prob"><span class="hs-identifier hs-type">Prob</span></a><span> </span><span class="hs-special">(</span><span class="hs-special">)</span><span> </span><span class="hs-special">(</span><a href="Matrix.Internal.html#Normalize"><span class="hs-identifier hs-type">Normalize</span></a><span> </span><a href="#local-6989586621679068542"><span class="hs-identifier hs-type">a</span></a><span class="hs-special">)</span><span class="hs-special">)</span><span> </span><span class="hs-glyph">=&gt;</span><span> </span><a href="Dist.Internal.html#Dist"><span class="hs-identifier hs-type">Dist</span></a><span> </span><a href="#local-6989586621679068542"><span class="hs-identifier hs-type">a</span></a><span> </span><span class="hs-glyph">-&gt;</span><span> </span><span class="hs-identifier hs-type">String</span><span>
150+</span><a name="line-150"></a><a name="prettyDist"><a href="Dist.Internal.html#prettyDist"><span class="hs-identifier">prettyDist</span></a></a><span> </span><a name="local-6989586621679068586"><a href="#local-6989586621679068586"><span class="hs-identifier">d</span></a></a><span> </span><span class="hs-glyph">=</span><span>
151+</span><a name="line-151"></a><span> </span><span class="hs-keyword">let</span><span> </span><a name="local-6989586621679068592"><a href="#local-6989586621679068592"><span class="hs-identifier">values</span></a></a><span> </span><span class="hs-glyph">=</span><span> </span><span class="hs-identifier hs-var">sortBy</span><span> </span><span class="hs-special">(</span><span class="hs-glyph">\</span><span class="hs-special">(</span><a name="local-6989586621679068594"><a href="#local-6989586621679068594"><span class="hs-identifier">a</span></a></a><span class="hs-special">,</span><span> </span><a name="local-6989586621679068595"><a href="#local-6989586621679068595"><span class="hs-identifier">p1</span></a></a><span class="hs-special">)</span><span> </span><span class="hs-special">(</span><a name="local-6989586621679068596"><a href="#local-6989586621679068596"><span class="hs-identifier">b</span></a></a><span class="hs-special">,</span><span> </span><a name="local-6989586621679068597"><a href="#local-6989586621679068597"><span class="hs-identifier">p2</span></a></a><span class="hs-special">)</span><span> </span><span class="hs-glyph">-&gt;</span><span> </span><span class="hs-identifier hs-var">compare</span><span> </span><a href="#local-6989586621679068597"><span class="hs-identifier hs-var">p2</span></a><span> </span><a href="#local-6989586621679068595"><span class="hs-identifier hs-var">p1</span></a><span class="hs-special">)</span><span> </span><span class="hs-special">(</span><a href="Dist.Internal.html#toValues"><span class="hs-identifier hs-var">toValues</span></a><span> </span><span class="hs-glyph">@</span><a href="#local-6989586621679068542"><span class="hs-identifier hs-type">a</span></a><span> </span><a href="#local-6989586621679068586"><span class="hs-identifier hs-var">d</span></a><span class="hs-special">)</span><span>
152+</span><a name="line-152"></a><span> </span><a name="local-6989586621679068593"><a href="#local-6989586621679068593"><span class="hs-identifier">w</span></a></a><span> </span><span class="hs-glyph">=</span><span> </span><span class="hs-identifier hs-var">maximum</span><span> </span><span class="hs-special">(</span><span class="hs-identifier hs-var">map</span><span> </span><span class="hs-special">(</span><span class="hs-identifier hs-var">length</span><span> </span><span class="hs-operator hs-var">.</span><span> </span><span class="hs-identifier hs-var">show</span><span> </span><span class="hs-operator hs-var">.</span><span> </span><span class="hs-identifier hs-var">fst</span><span class="hs-special">)</span><span> </span><a href="#local-6989586621679068592"><span class="hs-identifier hs-var">values</span></a><span class="hs-special">)</span><span>
153+</span><a name="line-153"></a><span> </span><span class="hs-keyword">in</span><span> </span><span class="hs-identifier hs-var">concatMap</span><span>
154+</span><a name="line-154"></a><span> </span><span class="hs-special">(</span><span class="hs-glyph">\</span><span class="hs-special">(</span><a name="local-6989586621679068598"><a href="#local-6989586621679068598"><span class="hs-identifier">x</span></a></a><span class="hs-special">,</span><a name="local-6989586621679068599"><a href="#local-6989586621679068599"><span class="hs-identifier">p</span></a></a><span class="hs-special">)</span><span> </span><span class="hs-glyph">-&gt;</span><span> </span><a href="#local-6989586621679068588"><span class="hs-identifier hs-var">showR</span></a><span> </span><a href="#local-6989586621679068593"><span class="hs-identifier hs-var">w</span></a><span> </span><a href="#local-6989586621679068598"><span class="hs-identifier hs-var">x</span></a><span> </span><span class="hs-operator hs-var">++</span><span> </span><span class="hs-char">' '</span><span class="hs-glyph">:</span><span> </span><a href="#local-6989586621679068587"><span class="hs-identifier hs-var">showProb</span></a><span> </span><a href="#local-6989586621679068599"><span class="hs-identifier hs-var">p</span></a><span> </span><span class="hs-operator hs-var">++</span><span> </span><span class="hs-string">&quot;\n&quot;</span><span class="hs-special">)</span><span>
155+</span><a name="line-155"></a><span> </span><a href="#local-6989586621679068592"><span class="hs-identifier hs-var">values</span></a><span>
156+</span><a name="line-156"></a><span> </span><span class="hs-keyword">where</span><span>
157+</span><a name="line-157"></a><span> </span><a name="local-6989586621679068587"><a href="#local-6989586621679068587"><span class="hs-identifier">showProb</span></a></a><span> </span><a name="local-6989586621679068589"><a href="#local-6989586621679068589"><span class="hs-identifier">p</span></a></a><span> </span><span class="hs-glyph">=</span><span> </span><span class="hs-identifier hs-var">show</span><span> </span><span class="hs-special">(</span><a href="#local-6989586621679068589"><span class="hs-identifier hs-var">p</span></a><span> </span><span class="hs-operator hs-var">*</span><span> </span><span class="hs-number">100</span><span class="hs-special">)</span><span> </span><span class="hs-operator hs-var">++</span><span> </span><span class="hs-string">&quot;%&quot;</span><span>
158+</span><a name="line-158"></a><span> </span><a name="local-6989586621679068588"><a href="#local-6989586621679068588"><span class="hs-identifier">showR</span></a></a><span> </span><a name="local-6989586621679068590"><a href="#local-6989586621679068590"><span class="hs-identifier">n</span></a></a><span> </span><a name="local-6989586621679068591"><a href="#local-6989586621679068591"><span class="hs-identifier">x</span></a></a><span> </span><span class="hs-glyph">=</span><span> </span><span class="hs-identifier hs-var">show</span><span> </span><a href="#local-6989586621679068591"><span class="hs-identifier hs-var">x</span></a><span> </span><span class="hs-operator hs-var">++</span><span> </span><span class="hs-string">&quot; &quot;</span><span>
159+</span><a name="line-159"></a><span>
160+</span><a name="line-160"></a><span class="hs-comment">-- | Pretty Print a distribution</span><span>
161+</span><a name="line-161"></a><span class="hs-identifier">prettyPrintDist</span><span> </span><span class="hs-glyph">::</span><span> </span><span class="hs-keyword">forall</span><span> </span><a name="local-6989586621679068541"><a href="#local-6989586621679068541"><span class="hs-identifier">a</span></a></a><span> </span><span class="hs-operator">.</span><span> </span><span class="hs-special">(</span><span class="hs-identifier hs-type">Show</span><span> </span><a href="#local-6989586621679068541"><span class="hs-identifier hs-type">a</span></a><span class="hs-special">,</span><span> </span><span class="hs-identifier hs-type">Enum</span><span> </span><a href="#local-6989586621679068541"><span class="hs-identifier hs-type">a</span></a><span class="hs-special">,</span><span> </span><span class="hs-identifier hs-type">KnownNat</span><span> </span><span class="hs-special">(</span><a href="Matrix.Internal.html#Count"><span class="hs-identifier hs-type">Count</span></a><span> </span><a href="#local-6989586621679068541"><span class="hs-identifier hs-type">a</span></a><span class="hs-special">)</span><span class="hs-special">,</span><span> </span><a href="Matrix.Internal.html#FromLists"><span class="hs-identifier hs-type">FromLists</span></a><span> </span><a href="Dist.Internal.html#Prob"><span class="hs-identifier hs-type">Prob</span></a><span> </span><span class="hs-special">(</span><span class="hs-special">)</span><span> </span><span class="hs-special">(</span><a href="Matrix.Internal.html#Normalize"><span class="hs-identifier hs-type">Normalize</span></a><span> </span><a href="#local-6989586621679068541"><span class="hs-identifier hs-type">a</span></a><span class="hs-special">)</span><span class="hs-special">)</span><span> </span><span class="hs-glyph">=&gt;</span><span> </span><a href="Dist.Internal.html#Dist"><span class="hs-identifier hs-type">Dist</span></a><span> </span><a href="#local-6989586621679068541"><span class="hs-identifier hs-type">a</span></a><span> </span><span class="hs-glyph">-&gt;</span><span> </span><span class="hs-identifier hs-type">IO</span><span> </span><span class="hs-special">(</span><span class="hs-special">)</span><span>
162+</span><a name="line-162"></a><a name="prettyPrintDist"><a href="Dist.Internal.html#prettyPrintDist"><span class="hs-identifier">prettyPrintDist</span></a></a><span> </span><span class="hs-glyph">=</span><span> </span><span class="hs-identifier hs-var">putStrLn</span><span> </span><span class="hs-operator hs-var">.</span><span> </span><a href="Dist.Internal.html#prettyDist"><span class="hs-identifier hs-var">prettyDist</span></a><span> </span><span class="hs-glyph">@</span><a href="#local-6989586621679068541"><span class="hs-identifier hs-type">a</span></a><span>
163+</span><a name="line-163"></a><span>
164+</span><a name="line-164"></a><span class="hs-comment">-- Auxiliary functions</span><span>
165+</span><a name="line-165"></a><span>
166+</span><a name="line-166"></a><span class="hs-identifier">fromFreqs</span><span> </span><span class="hs-glyph">::</span><span> </span><span class="hs-special">(</span><a href="Matrix.Internal.html#FromLists"><span class="hs-identifier hs-type">FromLists</span></a><span> </span><a href="Dist.Internal.html#Prob"><span class="hs-identifier hs-type">Prob</span></a><span> </span><span class="hs-special">(</span><span class="hs-special">)</span><span> </span><span class="hs-special">(</span><a href="Matrix.Internal.html#Normalize"><span class="hs-identifier hs-type">Normalize</span></a><span> </span><a href="#local-6989586621679068540"><span class="hs-identifier hs-type">a</span></a><span class="hs-special">)</span><span class="hs-special">)</span><span> </span><span class="hs-glyph">=&gt;</span><span> </span><span class="hs-special">[</span><span class="hs-special">(</span><a href="#local-6989586621679068540"><span class="hs-identifier hs-type">a</span></a><span class="hs-special">,</span><a href="Dist.Internal.html#Prob"><span class="hs-identifier hs-type">Prob</span></a><span class="hs-special">)</span><span class="hs-special">]</span><span> </span><span class="hs-glyph">-&gt;</span><span> </span><a href="Dist.Internal.html#Dist"><span class="hs-identifier hs-type">Dist</span></a><span> </span><a href="#local-6989586621679068540"><span class="hs-identifier hs-type">a</span></a><span>
167+</span><a name="line-167"></a><a name="fromFreqs"><a href="Dist.Internal.html#fromFreqs"><span class="hs-identifier">fromFreqs</span></a></a><span> </span><a name="local-6989586621679068600"><a href="#local-6989586621679068600"><span class="hs-identifier">xs</span></a></a><span> </span><span class="hs-glyph">=</span><span> </span><a href="Dist.Internal.html#D"><span class="hs-identifier hs-var">D</span></a><span> </span><span class="hs-special">(</span><a href="Matrix.Type.html#col"><span class="hs-identifier hs-var">col</span></a><span> </span><span class="hs-special">(</span><span class="hs-identifier hs-var">map</span><span> </span><span class="hs-special">(</span><span class="hs-glyph">\</span><span class="hs-special">(</span><a name="local-6989586621679068602"><a href="#local-6989586621679068602"><span class="hs-identifier">x</span></a></a><span class="hs-special">,</span><a name="local-6989586621679068603"><a href="#local-6989586621679068603"><span class="hs-identifier">p</span></a></a><span class="hs-special">)</span><span> </span><span class="hs-glyph">-&gt;</span><span> </span><a href="#local-6989586621679068603"><span class="hs-identifier hs-var">p</span></a><span class="hs-operator hs-var">/</span><a href="#local-6989586621679068601"><span class="hs-identifier hs-var">q</span></a><span class="hs-special">)</span><span> </span><a href="#local-6989586621679068600"><span class="hs-identifier hs-var">xs</span></a><span class="hs-special">)</span><span class="hs-special">)</span><span>
168+</span><a name="line-168"></a><span> </span><span class="hs-keyword">where</span><span> </span><a name="local-6989586621679068601"><a href="#local-6989586621679068601"><span class="hs-identifier">q</span></a></a><span> </span><span class="hs-glyph">=</span><span> </span><span class="hs-identifier hs-var">sum</span><span> </span><span class="hs-operator hs-var">$</span><span> </span><span class="hs-identifier hs-var">map</span><span> </span><span class="hs-identifier hs-var">snd</span><span> </span><a href="#local-6989586621679068600"><span class="hs-identifier hs-var">xs</span></a><span>
169+</span><a name="line-169"></a><span>
170+</span><a name="line-170"></a><span class="hs-identifier">normalCurve</span><span> </span><span class="hs-glyph">::</span><span> </span><a href="Dist.Internal.html#Prob"><span class="hs-identifier hs-type">Prob</span></a><span> </span><span class="hs-glyph">-&gt;</span><span> </span><a href="Dist.Internal.html#Prob"><span class="hs-identifier hs-type">Prob</span></a><span> </span><span class="hs-glyph">-&gt;</span><span> </span><a href="Dist.Internal.html#Prob"><span class="hs-identifier hs-type">Prob</span></a><span> </span><span class="hs-glyph">-&gt;</span><span> </span><a href="Dist.Internal.html#Prob"><span class="hs-identifier hs-type">Prob</span></a><span>
171+</span><a name="line-171"></a><a name="normalCurve"><a href="Dist.Internal.html#normalCurve"><span class="hs-identifier">normalCurve</span></a></a><span> </span><a name="local-6989586621679068604"><a href="#local-6989586621679068604"><span class="hs-identifier">mean</span></a></a><span> </span><a name="local-6989586621679068605"><a href="#local-6989586621679068605"><span class="hs-identifier">dev</span></a></a><span> </span><a name="local-6989586621679068606"><a href="#local-6989586621679068606"><span class="hs-identifier">x</span></a></a><span> </span><span class="hs-glyph">=</span><span>
172+</span><a name="line-172"></a><span> </span><span class="hs-keyword">let</span><span> </span><a name="local-6989586621679068607"><a href="#local-6989586621679068607"><span class="hs-identifier">u</span></a></a><span> </span><span class="hs-glyph">=</span><span> </span><span class="hs-special">(</span><a href="#local-6989586621679068606"><span class="hs-identifier hs-var">x</span></a><span> </span><span class="hs-glyph">-</span><span> </span><a href="#local-6989586621679068604"><span class="hs-identifier hs-var">mean</span></a><span class="hs-special">)</span><span> </span><span class="hs-operator hs-var">/</span><span> </span><a href="#local-6989586621679068605"><span class="hs-identifier hs-var">dev</span></a><span>
173+</span><a name="line-173"></a><span> </span><span class="hs-keyword">in</span><span> </span><span class="hs-identifier hs-var">exp</span><span> </span><span class="hs-special">(</span><span class="hs-glyph">-</span><span class="hs-number">1</span><span class="hs-operator hs-var">/</span><span class="hs-number">2</span><span> </span><span class="hs-operator hs-var">*</span><span> </span><a href="#local-6989586621679068607"><span class="hs-identifier hs-var">u</span></a><span class="hs-operator hs-var">^</span><span class="hs-special">(</span><span class="hs-number">2</span><span class="hs-glyph">::</span><span class="hs-identifier hs-type">Int</span><span class="hs-special">)</span><span class="hs-special">)</span><span> </span><span class="hs-operator hs-var">/</span><span> </span><span class="hs-identifier hs-var">sqrt</span><span> </span><span class="hs-special">(</span><span class="hs-number">2</span><span> </span><span class="hs-operator hs-var">*</span><span> </span><span class="hs-identifier hs-var">pi</span><span class="hs-special">)</span><span>
174+</span><a name="line-174"></a></pre></body></html>
build/x86_64-linux/ghc-8.6.5/laop-0.1.0.0/doc/html/laop-0.1.0.0-docs/src/Dist.htmlnew file+70
@@ -0,0 +1,70 @@
1+<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"><html xmlns="http://www.w3.org/1999/xhtml"><head><link rel="stylesheet" type="text/css" href="style.css" /><script type="text/javascript" src="highlight.js"></script></head><body><pre><span class="hs-comment">-----------------------------------------------------------------------------</span><span>
2+</span><a name="line-2"></a><span class="hs-comment">-- |</span><span>
3+</span><a name="line-3"></a><span class="hs-comment">-- Module : Dist</span><span>
4+</span><a name="line-4"></a><span class="hs-comment">-- Copyright : (c) Armando Santos 2019-2020</span><span>
5+</span><a name="line-5"></a><span class="hs-comment">-- Maintainer : armandoifsantos@gmail.com</span><span>
6+</span><a name="line-6"></a><span class="hs-comment">-- Stability : experimental</span><span>
7+</span><a name="line-7"></a><span class="hs-comment">--</span><span>
8+</span><a name="line-8"></a><span class="hs-comment">-- __LAoP__ is a library for algebraic (inductive) construction and manipulation of matrices</span><span>
9+</span><a name="line-9"></a><span class="hs-comment">-- in Haskell. See &lt;https://github.com/bolt12/master-thesis my Msc Thesis&gt; for the</span><span>
10+</span><a name="line-10"></a><span class="hs-comment">-- motivation behind the library, the underlying theory, and implementation details.</span><span>
11+</span><a name="line-11"></a><span class="hs-comment">--</span><span>
12+</span><a name="line-12"></a><span class="hs-comment">-- This module exports a type synonym 'Dist'</span><span>
13+</span><a name="line-13"></a><span class="hs-comment">-- that represents a stochastic distribution </span><span>
14+</span><a name="line-14"></a><span class="hs-comment">-- matrix and several distribution construction</span><span>
15+</span><a name="line-15"></a><span class="hs-comment">-- functions.</span><span>
16+</span><a name="line-16"></a><span class="hs-comment">--</span><span>
17+</span><a name="line-17"></a><span class="hs-comment">-----------------------------------------------------------------------------</span><span>
18+</span><a name="line-18"></a><span>
19+</span><a name="line-19"></a><span class="hs-keyword">module</span><span> </span><span class="hs-identifier">Dist</span><span>
20+</span><a name="line-20"></a><span> </span><span class="hs-special">(</span><span> </span><span class="hs-comment">-- | If the sum of the rows of a column matrix </span><span>
21+</span><a name="line-21"></a><span> </span><span class="hs-comment">-- is equal to 1 then this stochastic matrix</span><span>
22+</span><a name="line-22"></a><span> </span><span class="hs-comment">-- can be seen as a probability distribution.</span><span>
23+</span><a name="line-23"></a><span> </span><span class="hs-comment">--</span><span>
24+</span><a name="line-24"></a><span> </span><span class="hs-comment">--</span><span>
25+</span><a name="line-25"></a><span> </span><span class="hs-comment">-- This module is still experimental but it's</span><span>
26+</span><a name="line-26"></a><span> </span><span class="hs-comment">-- already possible to model probabilistic programming</span><span>
27+</span><a name="line-27"></a><span> </span><span class="hs-comment">-- problems with it. Import 'Matrix.Nat' or 'Matrix.Type'</span><span>
28+</span><a name="line-28"></a><span> </span><span class="hs-comment">-- to access LAoP matrix combinators and then all you have</span><span>
29+</span><a name="line-29"></a><span> </span><span class="hs-comment">-- to do is to define your sample space, either by creating a new data</span><span>
30+</span><a name="line-30"></a><span> </span><span class="hs-comment">-- type or by abstracting it out via 'Natural'.</span><span>
31+</span><a name="line-31"></a><span> </span><span class="hs-comment">--</span><span>
32+</span><a name="line-32"></a><span> </span><span class="hs-comment">-- Write manipulation functions and promote them to matrices via</span><span>
33+</span><a name="line-33"></a><span> </span><span class="hs-comment">-- 'fromF' or 'fromF'' and you're good to go!</span><span>
34+</span><a name="line-34"></a><span>
35+</span><a name="line-35"></a><span> </span><span class="hs-comment">-- * 'Dist' and 'Prob' type synonyms</span><span>
36+</span><a name="line-36"></a><span> </span><a href="Dist.Internal.html#Dist"><span class="hs-identifier hs-type">Dist</span></a><span> </span><span class="hs-special">(</span><span class="hs-glyph">..</span><span class="hs-special">)</span><span class="hs-special">,</span><span>
37+</span><a name="line-37"></a><span> </span><a href="Dist.Internal.html#Prob"><span class="hs-identifier hs-type">Prob</span></a><span class="hs-special">,</span><span>
38+</span><a name="line-38"></a><span>
39+</span><a name="line-39"></a><span> </span><span class="hs-comment">-- * Functor instance equivalent functions</span><span>
40+</span><a name="line-40"></a><span> </span><a href="Dist.Internal.html#fmapD"><span class="hs-identifier hs-var">fmapD</span></a><span class="hs-special">,</span><span>
41+</span><a name="line-41"></a><span>
42+</span><a name="line-42"></a><span> </span><span class="hs-comment">-- * Applicative equivalent functions</span><span>
43+</span><a name="line-43"></a><span> </span><a href="Dist.Internal.html#unitD"><span class="hs-identifier hs-var">unitD</span></a><span class="hs-special">,</span><span>
44+</span><a name="line-44"></a><span> </span><a href="Dist.Internal.html#multD"><span class="hs-identifier hs-var">multD</span></a><span class="hs-special">,</span><span>
45+</span><a name="line-45"></a><span>
46+</span><a name="line-46"></a><span> </span><span class="hs-comment">-- * Selective equivalent functions</span><span>
47+</span><a name="line-47"></a><span> </span><a href="Dist.Internal.html#selectD"><span class="hs-identifier hs-var">selectD</span></a><span class="hs-special">,</span><span>
48+</span><a name="line-48"></a><span>
49+</span><a name="line-49"></a><span> </span><span class="hs-comment">-- * Monad equivalent functions</span><span>
50+</span><a name="line-50"></a><span> </span><a href="Dist.Internal.html#returnD"><span class="hs-identifier hs-var">returnD</span></a><span class="hs-special">,</span><span>
51+</span><a name="line-51"></a><span> </span><a href="Dist.Internal.html#bindD"><span class="hs-identifier hs-var">bindD</span></a><span class="hs-special">,</span><span>
52+</span><a name="line-52"></a><span>
53+</span><a name="line-53"></a><span> </span><span class="hs-comment">-- * Distribution construction functions</span><span>
54+</span><a name="line-54"></a><span> </span><a href="Dist.Internal.html#choose"><span class="hs-identifier hs-var">choose</span></a><span class="hs-special">,</span><span>
55+</span><a name="line-55"></a><span> </span><a href="Dist.Internal.html#shape"><span class="hs-identifier hs-var">shape</span></a><span class="hs-special">,</span><span>
56+</span><a name="line-56"></a><span> </span><a href="Dist.Internal.html#linear"><span class="hs-identifier hs-var">linear</span></a><span class="hs-special">,</span><span>
57+</span><a name="line-57"></a><span> </span><a href="Dist.Internal.html#uniform"><span class="hs-identifier hs-var">uniform</span></a><span class="hs-special">,</span><span>
58+</span><a name="line-58"></a><span> </span><a href="Dist.Internal.html#negExp"><span class="hs-identifier hs-var">negExp</span></a><span class="hs-special">,</span><span>
59+</span><a name="line-59"></a><span> </span><a href="Dist.Internal.html#normal"><span class="hs-identifier hs-var">normal</span></a><span class="hs-special">,</span><span>
60+</span><a name="line-60"></a><span>
61+</span><a name="line-61"></a><span> </span><span class="hs-comment">-- * Converto to list of pairs</span><span>
62+</span><a name="line-62"></a><span> </span><a href="Dist.Internal.html#toValues"><span class="hs-identifier hs-var">toValues</span></a><span class="hs-special">,</span><span>
63+</span><a name="line-63"></a><span> </span><span class="hs-comment">-- * Pretty print distribution</span><span>
64+</span><a name="line-64"></a><span> </span><a href="Dist.Internal.html#prettyDist"><span class="hs-identifier hs-var">prettyDist</span></a><span class="hs-special">,</span><span>
65+</span><a name="line-65"></a><span> </span><a href="Dist.Internal.html#prettyPrintDist"><span class="hs-identifier hs-var">prettyPrintDist</span></a><span>
66+</span><a name="line-66"></a><span> </span><span class="hs-special">)</span><span>
67+</span><a name="line-67"></a><span class="hs-keyword">where</span><span>
68+</span><a name="line-68"></a><span>
69+</span><a name="line-69"></a><span class="hs-keyword">import</span><span> </span><a href="Dist.Internal.html"><span class="hs-identifier">Dist.Internal</span></a><span>
70+</span><a name="line-70"></a></pre></body></html>
build/x86_64-linux/ghc-8.6.5/laop-0.1.0.0/doc/html/laop-0.1.0.0-docs/src/Matrix.Internal.htmlnew file+903
@@ -0,0 +1,903 @@
1+<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"><html xmlns="http://www.w3.org/1999/xhtml"><head><link rel="stylesheet" type="text/css" href="style.css" /><script type="text/javascript" src="highlight.js"></script></head><body><pre><span class="hs-pragma">{-# LANGUAGE AllowAmbiguousTypes #-}</span><span>
2+</span><a name="line-2"></a><span class="hs-pragma">{-# LANGUAGE DataKinds #-}</span><span>
3+</span><a name="line-3"></a><span class="hs-pragma">{-# LANGUAGE FlexibleContexts #-}</span><span>
4+</span><a name="line-4"></a><span class="hs-pragma">{-# LANGUAGE FlexibleInstances #-}</span><span>
5+</span><a name="line-5"></a><span class="hs-pragma">{-# LANGUAGE GADTs #-}</span><span>
6+</span><a name="line-6"></a><span class="hs-pragma">{-# LANGUAGE InstanceSigs #-}</span><span>
7+</span><a name="line-7"></a><span class="hs-pragma">{-# LANGUAGE MultiParamTypeClasses #-}</span><span>
8+</span><a name="line-8"></a><span class="hs-pragma">{-# LANGUAGE NoStarIsType #-}</span><span>
9+</span><a name="line-9"></a><span class="hs-pragma">{-# LANGUAGE ScopedTypeVariables #-}</span><span>
10+</span><a name="line-10"></a><span class="hs-pragma">{-# LANGUAGE StandaloneDeriving #-}</span><span>
11+</span><a name="line-11"></a><span class="hs-pragma">{-# LANGUAGE TypeApplications #-}</span><span>
12+</span><a name="line-12"></a><span class="hs-pragma">{-# LANGUAGE TypeFamilies #-}</span><span>
13+</span><a name="line-13"></a><span class="hs-pragma">{-# LANGUAGE TypeOperators #-}</span><span>
14+</span><a name="line-14"></a><span class="hs-pragma">{-# LANGUAGE UndecidableInstances #-}</span><span>
15+</span><a name="line-15"></a><span>
16+</span><a name="line-16"></a><span class="hs-comment">-----------------------------------------------------------------------------</span><span>
17+</span><a name="line-17"></a><span class="hs-comment">-- |</span><span>
18+</span><a name="line-18"></a><span class="hs-comment">-- Module : Matrix.Internal</span><span>
19+</span><a name="line-19"></a><span class="hs-comment">-- Copyright : (c) Armando Santos 2019-2020</span><span>
20+</span><a name="line-20"></a><span class="hs-comment">-- Maintainer : armandoifsantos@gmail.com</span><span>
21+</span><a name="line-21"></a><span class="hs-comment">-- Stability : experimental</span><span>
22+</span><a name="line-22"></a><span class="hs-comment">--</span><span>
23+</span><a name="line-23"></a><span class="hs-comment">-- The LAoP discipline generalises relations and functions treating them as</span><span>
24+</span><a name="line-24"></a><span class="hs-comment">-- Boolean matrices and in turn consider these as arrows.</span><span>
25+</span><a name="line-25"></a><span class="hs-comment">--</span><span>
26+</span><a name="line-26"></a><span class="hs-comment">-- __LAoP__ is a library for algebraic (inductive) construction and manipulation of matrices</span><span>
27+</span><a name="line-27"></a><span class="hs-comment">-- in Haskell. See &lt;https://github.com/bolt12/master-thesis my Msc Thesis&gt; for the</span><span>
28+</span><a name="line-28"></a><span class="hs-comment">-- motivation behind the library, the underlying theory, and implementation details.</span><span>
29+</span><a name="line-29"></a><span class="hs-comment">--</span><span>
30+</span><a name="line-30"></a><span class="hs-comment">-- This module offers many of the combinators mentioned in the work of</span><span>
31+</span><a name="line-31"></a><span class="hs-comment">-- Macedo (2012) and Oliveira (2012). </span><span>
32+</span><a name="line-32"></a><span class="hs-comment">--</span><span>
33+</span><a name="line-33"></a><span class="hs-comment">-- This is an Internal module and it is no supposed to be imported.</span><span>
34+</span><a name="line-34"></a><span class="hs-comment">--</span><span>
35+</span><a name="line-35"></a><span class="hs-comment">-----------------------------------------------------------------------------</span><span>
36+</span><a name="line-36"></a><span>
37+</span><a name="line-37"></a><span class="hs-keyword">module</span><span> </span><span class="hs-identifier">Matrix.Internal</span><span>
38+</span><a name="line-38"></a><span> </span><span class="hs-special">(</span><span> </span><span class="hs-comment">-- | This definition makes use of the fact that 'Void' is</span><span>
39+</span><a name="line-39"></a><span> </span><span class="hs-comment">-- isomorphic to 0 and '()' to 1 and captures matrix</span><span>
40+</span><a name="line-40"></a><span> </span><span class="hs-comment">-- dimensions as stacks of 'Either's.</span><span>
41+</span><a name="line-41"></a><span> </span><span class="hs-comment">--</span><span>
42+</span><a name="line-42"></a><span> </span><span class="hs-comment">-- There exists two type families that make it easier to write</span><span>
43+</span><a name="line-43"></a><span> </span><span class="hs-comment">-- matrix dimensions: 'FromNat' and 'Count'. This approach</span><span>
44+</span><a name="line-44"></a><span> </span><span class="hs-comment">-- leads to a very straightforward implementation </span><span>
45+</span><a name="line-45"></a><span> </span><span class="hs-comment">-- of LAoP combinators. </span><span>
46+</span><a name="line-46"></a><span>
47+</span><a name="line-47"></a><span> </span><span class="hs-comment">-- * Type safe matrix representation</span><span>
48+</span><a name="line-48"></a><span> </span><a href="Matrix.Internal.html#Matrix"><span class="hs-identifier hs-type">Matrix</span></a><span> </span><span class="hs-special">(</span><span class="hs-glyph">..</span><span class="hs-special">)</span><span class="hs-special">,</span><span>
49+</span><a name="line-49"></a><span>
50+</span><a name="line-50"></a><span> </span><span class="hs-comment">-- * Primitives</span><span>
51+</span><a name="line-51"></a><span> </span><a href="Matrix.Internal.html#empty"><span class="hs-identifier hs-var">empty</span></a><span class="hs-special">,</span><span>
52+</span><a name="line-52"></a><span> </span><a href="Matrix.Internal.html#one"><span class="hs-identifier hs-var">one</span></a><span class="hs-special">,</span><span>
53+</span><a name="line-53"></a><span> </span><a href="Matrix.Internal.html#junc"><span class="hs-identifier hs-var">junc</span></a><span class="hs-special">,</span><span>
54+</span><a name="line-54"></a><span> </span><a href="Matrix.Internal.html#split"><span class="hs-identifier hs-var">split</span></a><span class="hs-special">,</span><span>
55+</span><a name="line-55"></a><span>
56+</span><a name="line-56"></a><span> </span><span class="hs-comment">-- * Auxiliary type families</span><span>
57+</span><a name="line-57"></a><span> </span><a href="Matrix.Internal.html#FromNat"><span class="hs-identifier hs-type">FromNat</span></a><span class="hs-special">,</span><span>
58+</span><a name="line-58"></a><span> </span><a href="Matrix.Internal.html#Count"><span class="hs-identifier hs-type">Count</span></a><span class="hs-special">,</span><span>
59+</span><a name="line-59"></a><span> </span><a href="Matrix.Internal.html#Normalize"><span class="hs-identifier hs-type">Normalize</span></a><span class="hs-special">,</span><span>
60+</span><a name="line-60"></a><span>
61+</span><a name="line-61"></a><span> </span><span class="hs-comment">-- * Matrix construction and conversion</span><span>
62+</span><a name="line-62"></a><span> </span><a href="Matrix.Internal.html#FromLists"><span class="hs-identifier hs-type">FromLists</span></a><span class="hs-special">,</span><span>
63+</span><a name="line-63"></a><span> </span><a href="Matrix.Internal.html#fromLists"><span class="hs-identifier hs-var">fromLists</span></a><span class="hs-special">,</span><span>
64+</span><a name="line-64"></a><span> </span><a href="Matrix.Internal.html#toLists"><span class="hs-identifier hs-var">toLists</span></a><span class="hs-special">,</span><span>
65+</span><a name="line-65"></a><span> </span><a href="Matrix.Internal.html#toList"><span class="hs-identifier hs-var">toList</span></a><span class="hs-special">,</span><span>
66+</span><a name="line-66"></a><span> </span><a href="Matrix.Internal.html#matrixBuilder"><span class="hs-identifier hs-var">matrixBuilder</span></a><span class="hs-special">,</span><span>
67+</span><a name="line-67"></a><span> </span><a href="Matrix.Internal.html#row"><span class="hs-identifier hs-var">row</span></a><span class="hs-special">,</span><span>
68+</span><a name="line-68"></a><span> </span><a href="Matrix.Internal.html#col"><span class="hs-identifier hs-var">col</span></a><span class="hs-special">,</span><span>
69+</span><a name="line-69"></a><span> </span><a href="Matrix.Internal.html#zeros"><span class="hs-identifier hs-var">zeros</span></a><span class="hs-special">,</span><span>
70+</span><a name="line-70"></a><span> </span><a href="Matrix.Internal.html#ones"><span class="hs-identifier hs-var">ones</span></a><span class="hs-special">,</span><span>
71+</span><a name="line-71"></a><span> </span><a href="Matrix.Internal.html#bang"><span class="hs-identifier hs-var">bang</span></a><span class="hs-special">,</span><span>
72+</span><a name="line-72"></a><span> </span><a href="Matrix.Internal.html#constant"><span class="hs-identifier hs-var">constant</span></a><span class="hs-special">,</span><span>
73+</span><a name="line-73"></a><span>
74+</span><a name="line-74"></a><span> </span><span class="hs-comment">-- * Misc</span><span>
75+</span><a name="line-75"></a><span> </span><span class="hs-comment">-- ** Get dimensions</span><span>
76+</span><a name="line-76"></a><span> </span><a href="Matrix.Internal.html#columns"><span class="hs-identifier hs-var">columns</span></a><span class="hs-special">,</span><span>
77+</span><a name="line-77"></a><span> </span><a href="Matrix.Internal.html#rows"><span class="hs-identifier hs-var">rows</span></a><span class="hs-special">,</span><span>
78+</span><a name="line-78"></a><span>
79+</span><a name="line-79"></a><span> </span><span class="hs-comment">-- ** Matrix Transposition</span><span>
80+</span><a name="line-80"></a><span> </span><a href="Matrix.Internal.html#tr"><span class="hs-identifier hs-var">tr</span></a><span class="hs-special">,</span><span>
81+</span><a name="line-81"></a><span>
82+</span><a name="line-82"></a><span> </span><span class="hs-comment">-- ** Selective operator</span><span>
83+</span><a name="line-83"></a><span> </span><a href="Matrix.Internal.html#select"><span class="hs-identifier hs-var">select</span></a><span class="hs-special">,</span><span>
84+</span><a name="line-84"></a><span>
85+</span><a name="line-85"></a><span> </span><span class="hs-comment">-- ** McCarthy's Conditional</span><span>
86+</span><a name="line-86"></a><span> </span><a href="Matrix.Internal.html#cond"><span class="hs-identifier hs-var">cond</span></a><span class="hs-special">,</span><span>
87+</span><a name="line-87"></a><span>
88+</span><a name="line-88"></a><span> </span><span class="hs-comment">-- ** Matrix &quot;abiding&quot;</span><span>
89+</span><a name="line-89"></a><span> </span><a href="Matrix.Internal.html#abideJS"><span class="hs-identifier hs-var">abideJS</span></a><span class="hs-special">,</span><span>
90+</span><a name="line-90"></a><span> </span><a href="Matrix.Internal.html#abideSJ"><span class="hs-identifier hs-var">abideSJ</span></a><span class="hs-special">,</span><span>
91+</span><a name="line-91"></a><span>
92+</span><a name="line-92"></a><span> </span><span class="hs-comment">-- * Biproduct approach</span><span>
93+</span><a name="line-93"></a><span> </span><span class="hs-comment">-- ** Split</span><span>
94+</span><a name="line-94"></a><span> </span><span class="hs-special">(</span><a href="Matrix.Internal.html#%3D%3D%3D"><span class="hs-operator hs-var">===</span></a><span class="hs-special">)</span><span class="hs-special">,</span><span>
95+</span><a name="line-95"></a><span> </span><span class="hs-comment">-- *** Projections</span><span>
96+</span><a name="line-96"></a><span> </span><a href="Matrix.Internal.html#p1"><span class="hs-identifier hs-var">p1</span></a><span class="hs-special">,</span><span>
97+</span><a name="line-97"></a><span> </span><a href="Matrix.Internal.html#p2"><span class="hs-identifier hs-var">p2</span></a><span class="hs-special">,</span><span>
98+</span><a name="line-98"></a><span> </span><span class="hs-comment">-- ** Junc</span><span>
99+</span><a name="line-99"></a><span> </span><span class="hs-special">(</span><a href="Matrix.Internal.html#%7C%7C%7C"><span class="hs-operator hs-var">|||</span></a><span class="hs-special">)</span><span class="hs-special">,</span><span>
100+</span><a name="line-100"></a><span> </span><span class="hs-comment">-- *** Injections</span><span>
101+</span><a name="line-101"></a><span> </span><a href="Matrix.Internal.html#i1"><span class="hs-identifier hs-var">i1</span></a><span class="hs-special">,</span><span>
102+</span><a name="line-102"></a><span> </span><a href="Matrix.Internal.html#i2"><span class="hs-identifier hs-var">i2</span></a><span class="hs-special">,</span><span>
103+</span><a name="line-103"></a><span> </span><span class="hs-comment">-- ** Bifunctors</span><span>
104+</span><a name="line-104"></a><span> </span><span class="hs-special">(</span><a href="Matrix.Internal.html#-%7C-"><span class="hs-operator hs-var">-|-</span></a><span class="hs-special">)</span><span class="hs-special">,</span><span>
105+</span><a name="line-105"></a><span> </span><span class="hs-special">(</span><a href="Matrix.Internal.html#%3E%3C"><span class="hs-operator hs-var">&gt;&lt;</span></a><span class="hs-special">)</span><span class="hs-special">,</span><span>
106+</span><a name="line-106"></a><span>
107+</span><a name="line-107"></a><span> </span><span class="hs-comment">-- ** Applicative matrix combinators</span><span>
108+</span><a name="line-108"></a><span>
109+</span><a name="line-109"></a><span> </span><span class="hs-comment">-- | Note that given the restrictions imposed it is not possible to</span><span>
110+</span><a name="line-110"></a><span> </span><span class="hs-comment">-- implement the standard type classes present in standard Haskell.</span><span>
111+</span><a name="line-111"></a><span> </span><span class="hs-comment">-- *** Matrix pairing projections</span><span>
112+</span><a name="line-112"></a><span> </span><a href="Matrix.Internal.html#kp1"><span class="hs-identifier hs-var">kp1</span></a><span class="hs-special">,</span><span>
113+</span><a name="line-113"></a><span> </span><a href="Matrix.Internal.html#kp2"><span class="hs-identifier hs-var">kp2</span></a><span class="hs-special">,</span><span>
114+</span><a name="line-114"></a><span>
115+</span><a name="line-115"></a><span> </span><span class="hs-comment">-- *** Matrix pairing</span><span>
116+</span><a name="line-116"></a><span> </span><a href="Matrix.Internal.html#khatri"><span class="hs-identifier hs-var">khatri</span></a><span class="hs-special">,</span><span>
117+</span><a name="line-117"></a><span>
118+</span><a name="line-118"></a><span> </span><span class="hs-comment">-- * Matrix composition and lifting</span><span>
119+</span><a name="line-119"></a><span>
120+</span><a name="line-120"></a><span> </span><span class="hs-comment">-- ** Arrow matrix combinators</span><span>
121+</span><a name="line-121"></a><span>
122+</span><a name="line-122"></a><span> </span><span class="hs-comment">-- | Note that given the restrictions imposed it is not possible to</span><span>
123+</span><a name="line-123"></a><span> </span><span class="hs-comment">-- implement the standard type classes present in standard Haskell.</span><span>
124+</span><a name="line-124"></a><span> </span><a href="Matrix.Internal.html#identity"><span class="hs-identifier hs-var">identity</span></a><span class="hs-special">,</span><span>
125+</span><a name="line-125"></a><span> </span><a href="Matrix.Internal.html#comp"><span class="hs-identifier hs-var">comp</span></a><span class="hs-special">,</span><span>
126+</span><a name="line-126"></a><span> </span><a href="Matrix.Internal.html#fromF"><span class="hs-identifier hs-var">fromF</span></a><span class="hs-special">,</span><span>
127+</span><a name="line-127"></a><span> </span><a href="Matrix.Internal.html#fromF%27"><span class="hs-identifier hs-var">fromF'</span></a><span class="hs-special">,</span><span>
128+</span><a name="line-128"></a><span>
129+</span><a name="line-129"></a><span> </span><span class="hs-comment">-- * Matrix printing</span><span>
130+</span><a name="line-130"></a><span> </span><a href="Matrix.Internal.html#pretty"><span class="hs-identifier hs-var">pretty</span></a><span class="hs-special">,</span><span>
131+</span><a name="line-131"></a><span> </span><a href="Matrix.Internal.html#prettyPrint"><span class="hs-identifier hs-var">prettyPrint</span></a><span class="hs-special">,</span><span>
132+</span><a name="line-132"></a><span>
133+</span><a name="line-133"></a><span> </span><span class="hs-comment">-- * Other</span><span>
134+</span><a name="line-134"></a><span> </span><a href="Matrix.Internal.html#toBool"><span class="hs-identifier hs-var">toBool</span></a><span class="hs-special">,</span><span>
135+</span><a name="line-135"></a><span> </span><a href="Matrix.Internal.html#fromBool"><span class="hs-identifier hs-var">fromBool</span></a><span class="hs-special">,</span><span>
136+</span><a name="line-136"></a><span> </span><a href="Matrix.Internal.html#compRel"><span class="hs-identifier hs-var">compRel</span></a><span class="hs-special">,</span><span>
137+</span><a name="line-137"></a><span> </span><a href="Matrix.Internal.html#fromFRel"><span class="hs-identifier hs-var">fromFRel</span></a><span class="hs-special">,</span><span>
138+</span><a name="line-138"></a><span> </span><a href="Matrix.Internal.html#fromFRel%27"><span class="hs-identifier hs-var">fromFRel'</span></a><span class="hs-special">,</span><span>
139+</span><a name="line-139"></a><span> </span><a href="Matrix.Internal.html#orM"><span class="hs-identifier hs-var">orM</span></a><span class="hs-special">,</span><span>
140+</span><a name="line-140"></a><span> </span><a href="Matrix.Internal.html#andM"><span class="hs-identifier hs-var">andM</span></a><span class="hs-special">,</span><span>
141+</span><a name="line-141"></a><span> </span><a href="Matrix.Internal.html#subM"><span class="hs-identifier hs-var">subM</span></a><span>
142+</span><a name="line-142"></a><span> </span><span class="hs-special">)</span><span>
143+</span><a name="line-143"></a><span> </span><span class="hs-keyword">where</span><span>
144+</span><a name="line-144"></a><span>
145+</span><a name="line-145"></a><span class="hs-keyword">import</span><span> </span><a href="Utils.html"><span class="hs-identifier">Utils</span></a><span>
146+</span><a name="line-146"></a><span class="hs-keyword">import</span><span> </span><span class="hs-identifier">Data.Bool</span><span>
147+</span><a name="line-147"></a><span class="hs-keyword">import</span><span> </span><span class="hs-identifier">Data.Kind</span><span>
148+</span><a name="line-148"></a><span class="hs-keyword">import</span><span> </span><span class="hs-identifier">Data.List</span><span>
149+</span><a name="line-149"></a><span class="hs-keyword">import</span><span> </span><span class="hs-identifier">Data.Proxy</span><span>
150+</span><a name="line-150"></a><span class="hs-keyword">import</span><span> </span><span class="hs-identifier">Data.Void</span><span>
151+</span><a name="line-151"></a><span class="hs-keyword">import</span><span> </span><span class="hs-identifier">GHC.TypeLits</span><span>
152+</span><a name="line-152"></a><span class="hs-keyword">import</span><span> </span><span class="hs-identifier">Data.Type.Equality</span><span>
153+</span><a name="line-153"></a><span class="hs-keyword">import</span><span> </span><span class="hs-identifier">GHC.Generics</span><span>
154+</span><a name="line-154"></a><span class="hs-keyword">import</span><span> </span><span class="hs-identifier">Control.DeepSeq</span><span>
155+</span><a name="line-155"></a><span class="hs-keyword">import</span><span> </span><span class="hs-identifier">Control.Category</span><span>
156+</span><a name="line-156"></a><span class="hs-keyword">import</span><span> </span><span class="hs-identifier">Prelude</span><span> </span><span class="hs-keyword">hiding</span><span> </span><span class="hs-special">(</span><span class="hs-special">(</span><span class="hs-operator hs-var">.</span><span class="hs-special">)</span><span class="hs-special">)</span><span>
157+</span><a name="line-157"></a><span>
158+</span><a name="line-158"></a><span class="hs-comment">-- | LAoP (Linear Algebra of Programming) Inductive Matrix definition.</span><span>
159+</span><a name="line-159"></a><span class="hs-keyword">data</span><span> </span><a name="Matrix"><a href="Matrix.Internal.html#Matrix"><span class="hs-identifier">Matrix</span></a></a><span> </span><a name="local-6989586621679038240"><a href="#local-6989586621679038240"><span class="hs-identifier">e</span></a></a><span> </span><a name="local-6989586621679038241"><a href="#local-6989586621679038241"><span class="hs-identifier">cols</span></a></a><span> </span><a name="local-6989586621679038242"><a href="#local-6989586621679038242"><span class="hs-identifier">rows</span></a></a><span> </span><span class="hs-keyword">where</span><span>
160+</span><a name="line-160"></a><span> </span><a name="Empty"><a href="Matrix.Internal.html#Empty"><span class="hs-identifier">Empty</span></a></a><span> </span><span class="hs-glyph">::</span><span> </span><a href="Matrix.Internal.html#Matrix"><span class="hs-identifier hs-type">Matrix</span></a><span> </span><a href="#local-6989586621679038243"><span class="hs-identifier hs-type">e</span></a><span> </span><span class="hs-identifier hs-type">Void</span><span> </span><span class="hs-identifier hs-type">Void</span><span>
161+</span><a name="line-161"></a><span> </span><a name="One"><a href="Matrix.Internal.html#One"><span class="hs-identifier">One</span></a></a><span> </span><span class="hs-glyph">::</span><span> </span><a href="#local-6989586621679038244"><span class="hs-identifier hs-type">e</span></a><span> </span><span class="hs-glyph">-&gt;</span><span> </span><a href="Matrix.Internal.html#Matrix"><span class="hs-identifier hs-type">Matrix</span></a><span> </span><a href="#local-6989586621679038244"><span class="hs-identifier hs-type">e</span></a><span> </span><span class="hs-special">(</span><span class="hs-special">)</span><span> </span><span class="hs-special">(</span><span class="hs-special">)</span><span>
162+</span><a name="line-162"></a><span> </span><a name="Junc"><a href="Matrix.Internal.html#Junc"><span class="hs-identifier">Junc</span></a></a><span> </span><span class="hs-glyph">::</span><span> </span><a href="Matrix.Internal.html#Matrix"><span class="hs-identifier hs-type">Matrix</span></a><span> </span><a href="#local-6989586621679038245"><span class="hs-identifier hs-type">e</span></a><span> </span><a href="#local-6989586621679038246"><span class="hs-identifier hs-type">a</span></a><span> </span><a href="#local-6989586621679038247"><span class="hs-identifier hs-type">rows</span></a><span> </span><span class="hs-glyph">-&gt;</span><span> </span><a href="Matrix.Internal.html#Matrix"><span class="hs-identifier hs-type">Matrix</span></a><span> </span><a href="#local-6989586621679038245"><span class="hs-identifier hs-type">e</span></a><span> </span><a href="#local-6989586621679038248"><span class="hs-identifier hs-type">b</span></a><span> </span><a href="#local-6989586621679038247"><span class="hs-identifier hs-type">rows</span></a><span> </span><span class="hs-glyph">-&gt;</span><span> </span><a href="Matrix.Internal.html#Matrix"><span class="hs-identifier hs-type">Matrix</span></a><span> </span><a href="#local-6989586621679038245"><span class="hs-identifier hs-type">e</span></a><span> </span><span class="hs-special">(</span><span class="hs-identifier hs-type">Either</span><span> </span><a href="#local-6989586621679038246"><span class="hs-identifier hs-type">a</span></a><span> </span><a href="#local-6989586621679038248"><span class="hs-identifier hs-type">b</span></a><span class="hs-special">)</span><span> </span><a href="#local-6989586621679038247"><span class="hs-identifier hs-type">rows</span></a><span>
163+</span><a name="line-163"></a><span> </span><a name="Split"><a href="Matrix.Internal.html#Split"><span class="hs-identifier">Split</span></a></a><span> </span><span class="hs-glyph">::</span><span> </span><a href="Matrix.Internal.html#Matrix"><span class="hs-identifier hs-type">Matrix</span></a><span> </span><a href="#local-6989586621679038249"><span class="hs-identifier hs-type">e</span></a><span> </span><a href="#local-6989586621679038250"><span class="hs-identifier hs-type">cols</span></a><span> </span><a href="#local-6989586621679038251"><span class="hs-identifier hs-type">a</span></a><span> </span><span class="hs-glyph">-&gt;</span><span> </span><a href="Matrix.Internal.html#Matrix"><span class="hs-identifier hs-type">Matrix</span></a><span> </span><a href="#local-6989586621679038249"><span class="hs-identifier hs-type">e</span></a><span> </span><a href="#local-6989586621679038250"><span class="hs-identifier hs-type">cols</span></a><span> </span><a href="#local-6989586621679038252"><span class="hs-identifier hs-type">b</span></a><span> </span><span class="hs-glyph">-&gt;</span><span> </span><a href="Matrix.Internal.html#Matrix"><span class="hs-identifier hs-type">Matrix</span></a><span> </span><a href="#local-6989586621679038249"><span class="hs-identifier hs-type">e</span></a><span> </span><a href="#local-6989586621679038250"><span class="hs-identifier hs-type">cols</span></a><span> </span><span class="hs-special">(</span><span class="hs-identifier hs-type">Either</span><span> </span><a href="#local-6989586621679038251"><span class="hs-identifier hs-type">a</span></a><span> </span><a href="#local-6989586621679038252"><span class="hs-identifier hs-type">b</span></a><span class="hs-special">)</span><span>
164+</span><a name="line-164"></a><span>
165+</span><a name="line-165"></a><span class="hs-keyword">deriving</span><span> </span><span class="hs-keyword">instance</span><span> </span><span class="hs-special">(</span><span class="hs-identifier hs-type">Show</span><span> </span><a href="#local-6989586621679039296"><span class="hs-identifier hs-type">e</span></a><span class="hs-special">)</span><span> </span><span class="hs-glyph">=&gt;</span><span> </span><span class="hs-identifier hs-type">Show</span><span> </span><span class="hs-special">(</span><a href="Matrix.Internal.html#Matrix"><span class="hs-identifier hs-type">Matrix</span></a><span> </span><a href="#local-6989586621679039296"><span class="hs-identifier hs-type">e</span></a><span> </span><a href="#local-6989586621679039297"><span class="hs-identifier hs-type">cols</span></a><span> </span><a href="#local-6989586621679039298"><span class="hs-identifier hs-type">rows</span></a><span class="hs-special">)</span><span>
166+</span><a name="line-166"></a><span>
167+</span><a name="line-167"></a><span class="hs-comment">-- | Type family that computes the cardinality of a given type dimension.</span><span>
168+</span><a name="line-168"></a><span class="hs-comment">--</span><span>
169+</span><a name="line-169"></a><span class="hs-comment">-- It can also count the cardinality of custom types that implement the</span><span>
170+</span><a name="line-170"></a><span class="hs-comment">-- 'Generic' instance.</span><span>
171+</span><a name="line-171"></a><span class="hs-keyword">type</span><span> </span><span class="hs-keyword">family</span><span> </span><a name="Count"><a href="Matrix.Internal.html#Count"><span class="hs-identifier">Count</span></a></a><span> </span><span class="hs-special">(</span><a name="local-6989586621679038215"><a href="#local-6989586621679038215"><span class="hs-identifier">d</span></a></a><span> </span><span class="hs-glyph">::</span><span> </span><span class="hs-identifier hs-type">Type</span><span class="hs-special">)</span><span> </span><span class="hs-glyph">::</span><span> </span><span class="hs-identifier hs-type">Nat</span><span> </span><span class="hs-keyword">where</span><span>
172+</span><a name="line-172"></a><span> </span><span class="hs-identifier">Count</span><span> </span><span class="hs-special">(</span><a href="Utils.Internal.html#Natural"><span class="hs-identifier hs-type">Natural</span></a><span> </span><a href="#local-6989586621679038216"><span class="hs-identifier hs-type">n</span></a><span> </span><a href="#local-6989586621679038217"><span class="hs-identifier hs-type">m</span></a><span class="hs-special">)</span><span> </span><span class="hs-glyph">=</span><span> </span><span class="hs-special">(</span><span class="hs-identifier hs-type">m</span><span> </span><span class="hs-glyph">-</span><span> </span><a href="#local-6989586621679038216"><span class="hs-identifier hs-type">n</span></a><span class="hs-special">)</span><span> </span><span class="hs-operator">+</span><span> </span><span class="hs-number">1</span><span>
173+</span><a name="line-173"></a><span> </span><span class="hs-identifier">Count</span><span> </span><span class="hs-special">(</span><span class="hs-identifier hs-type">Either</span><span> </span><a href="#local-6989586621679038218"><span class="hs-identifier hs-type">a</span></a><span> </span><a href="#local-6989586621679038219"><span class="hs-identifier hs-type">b</span></a><span class="hs-special">)</span><span> </span><span class="hs-glyph">=</span><span> </span><span class="hs-special">(</span><span class="hs-operator hs-type">+</span><span class="hs-special">)</span><span> </span><span class="hs-special">(</span><a href="Matrix.Internal.html#Count"><span class="hs-identifier hs-type">Count</span></a><span> </span><a href="#local-6989586621679038218"><span class="hs-identifier hs-type">a</span></a><span class="hs-special">)</span><span> </span><span class="hs-special">(</span><a href="Matrix.Internal.html#Count"><span class="hs-identifier hs-type">Count</span></a><span> </span><a href="#local-6989586621679038219"><span class="hs-identifier hs-type">b</span></a><span class="hs-special">)</span><span>
174+</span><a name="line-174"></a><span> </span><span class="hs-identifier">Count</span><span> </span><span class="hs-special">(</span><a href="#local-6989586621679038220"><span class="hs-identifier hs-type">a</span></a><span class="hs-special">,</span><span> </span><a href="#local-6989586621679038221"><span class="hs-identifier hs-type">b</span></a><span class="hs-special">)</span><span> </span><span class="hs-glyph">=</span><span> </span><span class="hs-special">(</span><span class="hs-operator hs-type">*</span><span class="hs-special">)</span><span> </span><span class="hs-special">(</span><a href="Matrix.Internal.html#Count"><span class="hs-identifier hs-type">Count</span></a><span> </span><a href="#local-6989586621679038220"><span class="hs-identifier hs-type">a</span></a><span class="hs-special">)</span><span> </span><span class="hs-special">(</span><a href="Matrix.Internal.html#Count"><span class="hs-identifier hs-type">Count</span></a><span> </span><a href="#local-6989586621679038221"><span class="hs-identifier hs-type">b</span></a><span class="hs-special">)</span><span>
175+</span><a name="line-175"></a><span> </span><span class="hs-identifier">Count</span><span> </span><span class="hs-special">(</span><a href="#local-6989586621679038222"><span class="hs-identifier hs-type">a</span></a><span> </span><span class="hs-glyph">-&gt;</span><span> </span><a href="#local-6989586621679038223"><span class="hs-identifier hs-type">b</span></a><span class="hs-special">)</span><span> </span><span class="hs-glyph">=</span><span> </span><span class="hs-special">(</span><span class="hs-operator hs-type">^</span><span class="hs-special">)</span><span> </span><span class="hs-special">(</span><a href="Matrix.Internal.html#Count"><span class="hs-identifier hs-type">Count</span></a><span> </span><a href="#local-6989586621679038223"><span class="hs-identifier hs-type">b</span></a><span class="hs-special">)</span><span> </span><span class="hs-special">(</span><a href="Matrix.Internal.html#Count"><span class="hs-identifier hs-type">Count</span></a><span> </span><a href="#local-6989586621679038222"><span class="hs-identifier hs-type">a</span></a><span class="hs-special">)</span><span>
176+</span><a name="line-176"></a><span> </span><span class="hs-comment">-- Generics</span><span>
177+</span><a name="line-177"></a><span> </span><span class="hs-identifier">Count</span><span> </span><span class="hs-special">(</span><span class="hs-identifier hs-type">M1</span><span> </span><span class="hs-identifier">_</span><span> </span><span class="hs-identifier">_</span><span> </span><a href="#local-6989586621679038224"><span class="hs-identifier hs-type">f</span></a><span> </span><a href="#local-6989586621679038225"><span class="hs-identifier hs-type">p</span></a><span class="hs-special">)</span><span> </span><span class="hs-glyph">=</span><span> </span><a href="Matrix.Internal.html#Count"><span class="hs-identifier hs-type">Count</span></a><span> </span><span class="hs-special">(</span><a href="#local-6989586621679038224"><span class="hs-identifier hs-type">f</span></a><span> </span><a href="#local-6989586621679038225"><span class="hs-identifier hs-type">p</span></a><span class="hs-special">)</span><span>
178+</span><a name="line-178"></a><span> </span><span class="hs-identifier">Count</span><span> </span><span class="hs-special">(</span><span class="hs-identifier hs-type">K1</span><span> </span><span class="hs-identifier">_</span><span> </span><span class="hs-identifier">_</span><span> </span><span class="hs-identifier">_</span><span class="hs-special">)</span><span> </span><span class="hs-glyph">=</span><span> </span><span class="hs-number">1</span><span>
179+</span><a name="line-179"></a><span> </span><span class="hs-identifier">Count</span><span> </span><span class="hs-special">(</span><span class="hs-identifier hs-type">V1</span><span> </span><span class="hs-identifier">_</span><span class="hs-special">)</span><span> </span><span class="hs-glyph">=</span><span> </span><span class="hs-number">0</span><span>
180+</span><a name="line-180"></a><span> </span><span class="hs-identifier">Count</span><span> </span><span class="hs-special">(</span><span class="hs-identifier hs-type">U1</span><span> </span><span class="hs-identifier">_</span><span class="hs-special">)</span><span> </span><span class="hs-glyph">=</span><span> </span><span class="hs-number">1</span><span>
181+</span><a name="line-181"></a><span> </span><span class="hs-identifier">Count</span><span> </span><span class="hs-special">(</span><span class="hs-special">(</span><span class="hs-operator hs-type">:*:</span><span class="hs-special">)</span><span> </span><a href="#local-6989586621679038233"><span class="hs-identifier hs-type">a</span></a><span> </span><a href="#local-6989586621679038234"><span class="hs-identifier hs-type">b</span></a><span> </span><a href="#local-6989586621679038235"><span class="hs-identifier hs-type">p</span></a><span class="hs-special">)</span><span> </span><span class="hs-glyph">=</span><span> </span><span class="hs-identifier hs-type">Count</span><span> </span><span class="hs-special">(</span><a href="#local-6989586621679038233"><span class="hs-identifier hs-type">a</span></a><span> </span><a href="#local-6989586621679038235"><span class="hs-identifier hs-type">p</span></a><span class="hs-special">)</span><span> </span><span class="hs-operator">*</span><span> </span><a href="Matrix.Internal.html#Count"><span class="hs-identifier hs-type">Count</span></a><span> </span><span class="hs-special">(</span><a href="#local-6989586621679038234"><span class="hs-identifier hs-type">b</span></a><span> </span><a href="#local-6989586621679038235"><span class="hs-identifier hs-type">p</span></a><span class="hs-special">)</span><span>
182+</span><a name="line-182"></a><span> </span><span class="hs-identifier">Count</span><span> </span><span class="hs-special">(</span><span class="hs-special">(</span><span class="hs-operator hs-type">:+:</span><span class="hs-special">)</span><span> </span><a href="#local-6989586621679038236"><span class="hs-identifier hs-type">a</span></a><span> </span><a href="#local-6989586621679038237"><span class="hs-identifier hs-type">b</span></a><span> </span><a href="#local-6989586621679038238"><span class="hs-identifier hs-type">p</span></a><span class="hs-special">)</span><span> </span><span class="hs-glyph">=</span><span> </span><span class="hs-identifier hs-type">Count</span><span> </span><span class="hs-special">(</span><a href="#local-6989586621679038236"><span class="hs-identifier hs-type">a</span></a><span> </span><a href="#local-6989586621679038238"><span class="hs-identifier hs-type">p</span></a><span class="hs-special">)</span><span> </span><span class="hs-operator">+</span><span> </span><a href="Matrix.Internal.html#Count"><span class="hs-identifier hs-type">Count</span></a><span> </span><span class="hs-special">(</span><a href="#local-6989586621679038237"><span class="hs-identifier hs-type">b</span></a><span> </span><a href="#local-6989586621679038238"><span class="hs-identifier hs-type">p</span></a><span class="hs-special">)</span><span>
183+</span><a name="line-183"></a><span> </span><span class="hs-identifier">Count</span><span> </span><a href="#local-6989586621679038239"><span class="hs-identifier hs-type">d</span></a><span> </span><span class="hs-glyph">=</span><span> </span><a href="Matrix.Internal.html#Count"><span class="hs-identifier hs-type">Count</span></a><span> </span><span class="hs-special">(</span><span class="hs-identifier hs-type">Rep</span><span> </span><a href="#local-6989586621679038239"><span class="hs-identifier hs-type">d</span></a><span> </span><span class="hs-identifier hs-type">R</span><span class="hs-special">)</span><span>
184+</span><a name="line-184"></a><span>
185+</span><a name="line-185"></a><span class="hs-comment">-- | Type family that computes of a given type dimension from a given natural</span><span>
186+</span><a name="line-186"></a><span class="hs-comment">--</span><span>
187+</span><a name="line-187"></a><span class="hs-comment">-- Thanks to Li-Yao Xia this type family is super fast.</span><span>
188+</span><a name="line-188"></a><span class="hs-keyword">type</span><span> </span><span class="hs-keyword">family</span><span> </span><a name="FromNat"><a href="Matrix.Internal.html#FromNat"><span class="hs-identifier">FromNat</span></a></a><span> </span><span class="hs-special">(</span><a name="local-6989586621679038213"><a href="#local-6989586621679038213"><span class="hs-identifier">n</span></a></a><span> </span><span class="hs-glyph">::</span><span> </span><span class="hs-identifier hs-type">Nat</span><span class="hs-special">)</span><span> </span><span class="hs-glyph">::</span><span> </span><span class="hs-identifier hs-type">Type</span><span> </span><span class="hs-keyword">where</span><span>
189+</span><a name="line-189"></a><span> </span><span class="hs-identifier">FromNat</span><span> </span><span class="hs-number">0</span><span> </span><span class="hs-glyph">=</span><span> </span><span class="hs-identifier hs-type">Void</span><span>
190+</span><a name="line-190"></a><span> </span><span class="hs-identifier">FromNat</span><span> </span><span class="hs-number">1</span><span> </span><span class="hs-glyph">=</span><span> </span><span class="hs-special">(</span><span class="hs-special">)</span><span>
191+</span><a name="line-191"></a><span> </span><span class="hs-identifier">FromNat</span><span> </span><a href="#local-6989586621679038214"><span class="hs-identifier hs-type">n</span></a><span> </span><span class="hs-glyph">=</span><span> </span><a href="Matrix.Internal.html#FromNat%27"><span class="hs-identifier hs-type">FromNat'</span></a><span> </span><span class="hs-special">(</span><span class="hs-identifier hs-type">Mod</span><span> </span><a href="#local-6989586621679038214"><span class="hs-identifier hs-type">n</span></a><span> </span><span class="hs-number">2</span><span> </span><span class="hs-operator">==</span><span> </span><span class="hs-number">0</span><span class="hs-special">)</span><span> </span><span class="hs-special">(</span><a href="Matrix.Internal.html#FromNat"><span class="hs-identifier hs-type">FromNat</span></a><span> </span><span class="hs-special">(</span><span class="hs-identifier hs-type">Div</span><span> </span><a href="#local-6989586621679038214"><span class="hs-identifier hs-type">n</span></a><span> </span><span class="hs-number">2</span><span class="hs-special">)</span><span class="hs-special">)</span><span>
192+</span><a name="line-192"></a><span>
193+</span><a name="line-193"></a><span class="hs-keyword">type</span><span> </span><span class="hs-keyword">family</span><span> </span><a name="FromNat%27"><a href="Matrix.Internal.html#FromNat%27"><span class="hs-identifier">FromNat'</span></a></a><span> </span><span class="hs-special">(</span><a name="local-6989586621679038066"><a href="#local-6989586621679038066"><span class="hs-identifier">b</span></a></a><span> </span><span class="hs-glyph">::</span><span> </span><span class="hs-identifier hs-type">Bool</span><span class="hs-special">)</span><span> </span><span class="hs-special">(</span><a name="local-6989586621679038067"><a href="#local-6989586621679038067"><span class="hs-identifier">m</span></a></a><span> </span><span class="hs-glyph">::</span><span> </span><span class="hs-identifier hs-type">Type</span><span class="hs-special">)</span><span> </span><span class="hs-glyph">::</span><span> </span><span class="hs-identifier hs-type">Type</span><span> </span><span class="hs-keyword">where</span><span>
194+</span><a name="line-194"></a><span> </span><span class="hs-identifier">FromNat'</span><span> </span><span class="hs-special">'</span><span class="hs-identifier hs-type">True</span><span> </span><a href="#local-6989586621679038068"><span class="hs-identifier hs-type">m</span></a><span> </span><span class="hs-glyph">=</span><span> </span><span class="hs-identifier hs-type">Either</span><span> </span><a href="#local-6989586621679038068"><span class="hs-identifier hs-type">m</span></a><span> </span><a href="#local-6989586621679038068"><span class="hs-identifier hs-type">m</span></a><span>
195+</span><a name="line-195"></a><span> </span><span class="hs-identifier">FromNat'</span><span> </span><span class="hs-special">'</span><span class="hs-identifier hs-type">False</span><span> </span><a href="#local-6989586621679038212"><span class="hs-identifier hs-type">m</span></a><span> </span><span class="hs-glyph">=</span><span> </span><span class="hs-identifier hs-type">Either</span><span> </span><span class="hs-special">(</span><span class="hs-special">)</span><span> </span><span class="hs-special">(</span><span class="hs-identifier hs-type">Either</span><span> </span><a href="#local-6989586621679038212"><span class="hs-identifier hs-type">m</span></a><span> </span><a href="#local-6989586621679038212"><span class="hs-identifier hs-type">m</span></a><span class="hs-special">)</span><span>
196+</span><a name="line-196"></a><span>
197+</span><a name="line-197"></a><span class="hs-comment">-- | Type family that normalizes the representation of a given data</span><span>
198+</span><a name="line-198"></a><span class="hs-comment">-- structure</span><span>
199+</span><a name="line-199"></a><span class="hs-keyword">type</span><span> </span><span class="hs-keyword">family</span><span> </span><a name="Normalize"><a href="Matrix.Internal.html#Normalize"><span class="hs-identifier">Normalize</span></a></a><span> </span><span class="hs-special">(</span><a name="local-6989586621679038064"><a href="#local-6989586621679038064"><span class="hs-identifier">d</span></a></a><span> </span><span class="hs-glyph">::</span><span> </span><span class="hs-identifier hs-type">Type</span><span class="hs-special">)</span><span> </span><span class="hs-glyph">::</span><span> </span><span class="hs-identifier hs-type">Type</span><span> </span><span class="hs-keyword">where</span><span>
200+</span><a name="line-200"></a><span> </span><span class="hs-identifier">Normalize</span><span> </span><a href="#local-6989586621679038065"><span class="hs-identifier hs-type">d</span></a><span> </span><span class="hs-glyph">=</span><span> </span><a href="Matrix.Internal.html#FromNat"><span class="hs-identifier hs-type">FromNat</span></a><span> </span><span class="hs-special">(</span><a href="Matrix.Internal.html#Count"><span class="hs-identifier hs-type">Count</span></a><span> </span><a href="#local-6989586621679038065"><span class="hs-identifier hs-type">d</span></a><span class="hs-special">)</span><span>
201+</span><a name="line-201"></a><span>
202+</span><a name="line-202"></a><span class="hs-comment">-- | It isn't possible to implement the 'id' function so it's</span><span>
203+</span><a name="line-203"></a><span class="hs-comment">-- implementation is 'undefined'. However 'comp' can be and this partial</span><span>
204+</span><a name="line-204"></a><span class="hs-comment">-- class implementation exists just to make the code more readable.</span><span>
205+</span><a name="line-205"></a><span class="hs-comment">--</span><span>
206+</span><a name="line-206"></a><span class="hs-comment">-- Please use 'identity' instead.</span><span>
207+</span><a name="line-207"></a><span class="hs-keyword">instance</span><span> </span><span class="hs-special">(</span><span class="hs-identifier hs-type">Num</span><span> </span><a href="#local-6989586621679038572"><span class="hs-identifier hs-type">e</span></a><span class="hs-special">)</span><span> </span><span class="hs-glyph">=&gt;</span><span> </span><span class="hs-identifier hs-type">Category</span><span> </span><span class="hs-special">(</span><a href="Matrix.Internal.html#Matrix"><span class="hs-identifier hs-type">Matrix</span></a><span> </span><a href="#local-6989586621679038572"><span class="hs-identifier hs-type">e</span></a><span class="hs-special">)</span><span> </span><span class="hs-keyword">where</span><span>
208+</span><a name="line-208"></a><span> </span><a name="local-8214565720323789508"><span class="hs-identifier">id</span></a><span> </span><span class="hs-glyph">=</span><span> </span><span class="hs-identifier hs-var">undefined</span><span>
209+</span><a name="line-209"></a><span> </span><span class="hs-special">(</span><a name="local-8214565720323789507"><span class="hs-operator">.</span></a><span class="hs-special">)</span><span> </span><span class="hs-glyph">=</span><span> </span><a href="Matrix.Internal.html#comp"><span class="hs-identifier hs-var">comp</span></a><span>
210+</span><a name="line-210"></a><span>
211+</span><a name="line-211"></a><span class="hs-keyword">instance</span><span> </span><span class="hs-identifier hs-type">NFData</span><span> </span><a href="#local-6989586621679038564"><span class="hs-identifier hs-type">e</span></a><span> </span><span class="hs-glyph">=&gt;</span><span> </span><span class="hs-identifier hs-type">NFData</span><span> </span><span class="hs-special">(</span><a href="Matrix.Internal.html#Matrix"><span class="hs-identifier hs-type">Matrix</span></a><span> </span><a href="#local-6989586621679038564"><span class="hs-identifier hs-type">e</span></a><span> </span><a href="#local-6989586621679038565"><span class="hs-identifier hs-type">cols</span></a><span> </span><a href="#local-6989586621679038566"><span class="hs-identifier hs-type">rows</span></a><span class="hs-special">)</span><span> </span><span class="hs-keyword">where</span><span>
212+</span><a name="line-212"></a><span> </span><a name="local-8214565720323790686"><span class="hs-identifier">rnf</span></a><span> </span><a href="Matrix.Internal.html#Empty"><span class="hs-identifier hs-var">Empty</span></a><span> </span><span class="hs-glyph">=</span><span> </span><span class="hs-special">(</span><span class="hs-special">)</span><span>
213+</span><a name="line-213"></a><span> </span><span class="hs-identifier">rnf</span><span> </span><span class="hs-special">(</span><a href="Matrix.Internal.html#One"><span class="hs-identifier hs-var">One</span></a><span> </span><a name="local-6989586621679038567"><a href="#local-6989586621679038567"><span class="hs-identifier">e</span></a></a><span class="hs-special">)</span><span> </span><span class="hs-glyph">=</span><span> </span><span class="hs-identifier hs-var">rnf</span><span> </span><a href="#local-6989586621679038567"><span class="hs-identifier hs-var">e</span></a><span>
214+</span><a name="line-214"></a><span> </span><span class="hs-identifier">rnf</span><span> </span><span class="hs-special">(</span><a href="Matrix.Internal.html#Junc"><span class="hs-identifier hs-var">Junc</span></a><span> </span><a name="local-6989586621679038568"><a href="#local-6989586621679038568"><span class="hs-identifier">a</span></a></a><span> </span><a name="local-6989586621679038569"><a href="#local-6989586621679038569"><span class="hs-identifier">b</span></a></a><span class="hs-special">)</span><span> </span><span class="hs-glyph">=</span><span> </span><span class="hs-identifier hs-var">rnf</span><span> </span><a href="#local-6989586621679038568"><span class="hs-identifier hs-var">a</span></a><span> </span><span class="hs-special">`</span><span class="hs-identifier hs-var">seq</span><span class="hs-special">`</span><span> </span><span class="hs-identifier hs-var">rnf</span><span> </span><a href="#local-6989586621679038569"><span class="hs-identifier hs-var">b</span></a><span>
215+</span><a name="line-215"></a><span> </span><span class="hs-identifier">rnf</span><span> </span><span class="hs-special">(</span><a href="Matrix.Internal.html#Split"><span class="hs-identifier hs-var">Split</span></a><span> </span><a name="local-6989586621679038570"><a href="#local-6989586621679038570"><span class="hs-identifier">a</span></a></a><span> </span><a name="local-6989586621679038571"><a href="#local-6989586621679038571"><span class="hs-identifier">b</span></a></a><span class="hs-special">)</span><span> </span><span class="hs-glyph">=</span><span> </span><span class="hs-identifier hs-var">rnf</span><span> </span><a href="#local-6989586621679038570"><span class="hs-identifier hs-var">a</span></a><span> </span><span class="hs-special">`</span><span class="hs-identifier hs-var">seq</span><span class="hs-special">`</span><span> </span><span class="hs-identifier hs-var">rnf</span><span> </span><a href="#local-6989586621679038571"><span class="hs-identifier hs-var">b</span></a><span>
216+</span><a name="line-216"></a><span>
217+</span><a name="line-217"></a><span class="hs-keyword">instance</span><span> </span><span class="hs-identifier hs-type">Eq</span><span> </span><a href="#local-6989586621679038547"><span class="hs-identifier hs-type">e</span></a><span> </span><span class="hs-glyph">=&gt;</span><span> </span><span class="hs-identifier hs-type">Eq</span><span> </span><span class="hs-special">(</span><a href="Matrix.Internal.html#Matrix"><span class="hs-identifier hs-type">Matrix</span></a><span> </span><a href="#local-6989586621679038547"><span class="hs-identifier hs-type">e</span></a><span> </span><a href="#local-6989586621679038548"><span class="hs-identifier hs-type">cols</span></a><span> </span><a href="#local-6989586621679038549"><span class="hs-identifier hs-type">rows</span></a><span class="hs-special">)</span><span> </span><span class="hs-keyword">where</span><span>
218+</span><a name="line-218"></a><span> </span><a href="Matrix.Internal.html#Empty"><span class="hs-identifier hs-var">Empty</span></a><span> </span><a name="local-3458764513820541095"><span class="hs-operator">==</span></a><span> </span><a href="Matrix.Internal.html#Empty"><span class="hs-identifier hs-var">Empty</span></a><span> </span><span class="hs-glyph">=</span><span> </span><span class="hs-identifier hs-var">True</span><span>
219+</span><a name="line-219"></a><span> </span><span class="hs-special">(</span><a href="Matrix.Internal.html#One"><span class="hs-identifier hs-var">One</span></a><span> </span><a name="local-6989586621679038550"><a href="#local-6989586621679038550"><span class="hs-identifier">a</span></a></a><span class="hs-special">)</span><span> </span><span class="hs-operator">==</span><span> </span><span class="hs-special">(</span><a href="Matrix.Internal.html#One"><span class="hs-identifier hs-var">One</span></a><span> </span><a name="local-6989586621679038551"><a href="#local-6989586621679038551"><span class="hs-identifier">b</span></a></a><span class="hs-special">)</span><span> </span><span class="hs-glyph">=</span><span> </span><a href="#local-6989586621679038550"><span class="hs-identifier hs-var">a</span></a><span> </span><span class="hs-operator hs-var">==</span><span> </span><a href="#local-6989586621679038551"><span class="hs-identifier hs-var">b</span></a><span>
220+</span><a name="line-220"></a><span> </span><span class="hs-special">(</span><a href="Matrix.Internal.html#Junc"><span class="hs-identifier hs-var">Junc</span></a><span> </span><a name="local-6989586621679038552"><a href="#local-6989586621679038552"><span class="hs-identifier">a</span></a></a><span> </span><a name="local-6989586621679038553"><a href="#local-6989586621679038553"><span class="hs-identifier">b</span></a></a><span class="hs-special">)</span><span> </span><span class="hs-operator">==</span><span> </span><span class="hs-special">(</span><a href="Matrix.Internal.html#Junc"><span class="hs-identifier hs-var">Junc</span></a><span> </span><a name="local-6989586621679038554"><a href="#local-6989586621679038554"><span class="hs-identifier">c</span></a></a><span> </span><a name="local-6989586621679038555"><a href="#local-6989586621679038555"><span class="hs-identifier">d</span></a></a><span class="hs-special">)</span><span> </span><span class="hs-glyph">=</span><span> </span><a href="#local-6989586621679038552"><span class="hs-identifier hs-var">a</span></a><span> </span><span class="hs-operator hs-var">==</span><span> </span><a href="#local-6989586621679038554"><span class="hs-identifier hs-var">c</span></a><span> </span><span class="hs-operator hs-var">&amp;&amp;</span><span> </span><a href="#local-6989586621679038553"><span class="hs-identifier hs-var">b</span></a><span> </span><span class="hs-operator hs-var">==</span><span> </span><a href="#local-6989586621679038555"><span class="hs-identifier hs-var">d</span></a><span>
221+</span><a name="line-221"></a><span> </span><span class="hs-special">(</span><a href="Matrix.Internal.html#Split"><span class="hs-identifier hs-var">Split</span></a><span> </span><a name="local-6989586621679038556"><a href="#local-6989586621679038556"><span class="hs-identifier">a</span></a></a><span> </span><a name="local-6989586621679038557"><a href="#local-6989586621679038557"><span class="hs-identifier">b</span></a></a><span class="hs-special">)</span><span> </span><span class="hs-operator">==</span><span> </span><span class="hs-special">(</span><a href="Matrix.Internal.html#Split"><span class="hs-identifier hs-var">Split</span></a><span> </span><a name="local-6989586621679038558"><a href="#local-6989586621679038558"><span class="hs-identifier">c</span></a></a><span> </span><a name="local-6989586621679038559"><a href="#local-6989586621679038559"><span class="hs-identifier">d</span></a></a><span class="hs-special">)</span><span> </span><span class="hs-glyph">=</span><span> </span><a href="#local-6989586621679038556"><span class="hs-identifier hs-var">a</span></a><span> </span><span class="hs-operator hs-var">==</span><span> </span><a href="#local-6989586621679038558"><span class="hs-identifier hs-var">c</span></a><span> </span><span class="hs-operator hs-var">&amp;&amp;</span><span> </span><a href="#local-6989586621679038557"><span class="hs-identifier hs-var">b</span></a><span> </span><span class="hs-operator hs-var">==</span><span> </span><a href="#local-6989586621679038559"><span class="hs-identifier hs-var">d</span></a><span>
222+</span><a name="line-222"></a><span> </span><a name="local-6989586621679038560"><a href="#local-6989586621679038560"><span class="hs-identifier">x</span></a></a><span class="hs-glyph">@</span><span class="hs-special">(</span><a href="Matrix.Internal.html#Split"><span class="hs-identifier hs-var">Split</span></a><span> </span><span class="hs-identifier">_</span><span> </span><span class="hs-identifier">_</span><span class="hs-special">)</span><span> </span><span class="hs-operator">==</span><span> </span><a name="local-6989586621679038561"><a href="#local-6989586621679038561"><span class="hs-identifier">y</span></a></a><span class="hs-glyph">@</span><span class="hs-special">(</span><a href="Matrix.Internal.html#Junc"><span class="hs-identifier hs-var">Junc</span></a><span> </span><span class="hs-identifier">_</span><span> </span><span class="hs-identifier">_</span><span class="hs-special">)</span><span> </span><span class="hs-glyph">=</span><span> </span><a href="#local-6989586621679038560"><span class="hs-identifier hs-var">x</span></a><span> </span><span class="hs-operator hs-var">==</span><span> </span><a href="Matrix.Internal.html#abideJS"><span class="hs-identifier hs-var">abideJS</span></a><span> </span><a href="#local-6989586621679038561"><span class="hs-identifier hs-var">y</span></a><span>
223+</span><a name="line-223"></a><span> </span><a name="local-6989586621679038562"><a href="#local-6989586621679038562"><span class="hs-identifier">x</span></a></a><span class="hs-glyph">@</span><span class="hs-special">(</span><a href="Matrix.Internal.html#Junc"><span class="hs-identifier hs-var">Junc</span></a><span> </span><span class="hs-identifier">_</span><span> </span><span class="hs-identifier">_</span><span class="hs-special">)</span><span> </span><span class="hs-operator">==</span><span> </span><a name="local-6989586621679038563"><a href="#local-6989586621679038563"><span class="hs-identifier">y</span></a></a><span class="hs-glyph">@</span><span class="hs-special">(</span><a href="Matrix.Internal.html#Split"><span class="hs-identifier hs-var">Split</span></a><span> </span><span class="hs-identifier">_</span><span> </span><span class="hs-identifier">_</span><span class="hs-special">)</span><span> </span><span class="hs-glyph">=</span><span> </span><a href="Matrix.Internal.html#abideJS"><span class="hs-identifier hs-var">abideJS</span></a><span> </span><a href="#local-6989586621679038562"><span class="hs-identifier hs-var">x</span></a><span> </span><span class="hs-operator hs-var">==</span><span> </span><a href="#local-6989586621679038563"><span class="hs-identifier hs-var">y</span></a><span>
224+</span><a name="line-224"></a><span>
225+</span><a name="line-225"></a><span class="hs-keyword">instance</span><span> </span><span class="hs-identifier hs-type">Num</span><span> </span><a href="#local-6989586621679038492"><span class="hs-identifier hs-type">e</span></a><span> </span><span class="hs-glyph">=&gt;</span><span> </span><span class="hs-identifier hs-type">Num</span><span> </span><span class="hs-special">(</span><a href="Matrix.Internal.html#Matrix"><span class="hs-identifier hs-type">Matrix</span></a><span> </span><a href="#local-6989586621679038492"><span class="hs-identifier hs-type">e</span></a><span> </span><a href="#local-6989586621679038493"><span class="hs-identifier hs-type">cols</span></a><span> </span><a href="#local-6989586621679038494"><span class="hs-identifier hs-type">rows</span></a><span class="hs-special">)</span><span> </span><span class="hs-keyword">where</span><span>
226+</span><a name="line-226"></a><span>
227+</span><a name="line-227"></a><span> </span><a href="Matrix.Internal.html#Empty"><span class="hs-identifier hs-var">Empty</span></a><span> </span><a name="local-8214565720323790403"><span class="hs-operator">+</span></a><span> </span><a href="Matrix.Internal.html#Empty"><span class="hs-identifier hs-var">Empty</span></a><span> </span><span class="hs-glyph">=</span><span> </span><a href="Matrix.Internal.html#Empty"><span class="hs-identifier hs-var">Empty</span></a><span>
228+</span><a name="line-228"></a><span> </span><span class="hs-special">(</span><a href="Matrix.Internal.html#One"><span class="hs-identifier hs-var">One</span></a><span> </span><a name="local-6989586621679038495"><a href="#local-6989586621679038495"><span class="hs-identifier">a</span></a></a><span class="hs-special">)</span><span> </span><span class="hs-operator">+</span><span> </span><span class="hs-special">(</span><a href="Matrix.Internal.html#One"><span class="hs-identifier hs-var">One</span></a><span> </span><a name="local-6989586621679038496"><a href="#local-6989586621679038496"><span class="hs-identifier">b</span></a></a><span class="hs-special">)</span><span> </span><span class="hs-glyph">=</span><span> </span><a href="Matrix.Internal.html#One"><span class="hs-identifier hs-var">One</span></a><span> </span><span class="hs-special">(</span><a href="#local-6989586621679038495"><span class="hs-identifier hs-var">a</span></a><span> </span><span class="hs-operator hs-var">+</span><span> </span><a href="#local-6989586621679038496"><span class="hs-identifier hs-var">b</span></a><span class="hs-special">)</span><span>
229+</span><a name="line-229"></a><span> </span><span class="hs-special">(</span><a href="Matrix.Internal.html#Junc"><span class="hs-identifier hs-var">Junc</span></a><span> </span><a name="local-6989586621679038497"><a href="#local-6989586621679038497"><span class="hs-identifier">a</span></a></a><span> </span><a name="local-6989586621679038498"><a href="#local-6989586621679038498"><span class="hs-identifier">b</span></a></a><span class="hs-special">)</span><span> </span><span class="hs-operator">+</span><span> </span><span class="hs-special">(</span><a href="Matrix.Internal.html#Junc"><span class="hs-identifier hs-var">Junc</span></a><span> </span><a name="local-6989586621679038499"><a href="#local-6989586621679038499"><span class="hs-identifier">c</span></a></a><span> </span><a name="local-6989586621679038500"><a href="#local-6989586621679038500"><span class="hs-identifier">d</span></a></a><span class="hs-special">)</span><span> </span><span class="hs-glyph">=</span><span> </span><a href="Matrix.Internal.html#Junc"><span class="hs-identifier hs-var">Junc</span></a><span> </span><span class="hs-special">(</span><a href="#local-6989586621679038497"><span class="hs-identifier hs-var">a</span></a><span> </span><span class="hs-operator hs-var">+</span><span> </span><a href="#local-6989586621679038499"><span class="hs-identifier hs-var">c</span></a><span class="hs-special">)</span><span> </span><span class="hs-special">(</span><a href="#local-6989586621679038498"><span class="hs-identifier hs-var">b</span></a><span> </span><span class="hs-operator hs-var">+</span><span> </span><a href="#local-6989586621679038500"><span class="hs-identifier hs-var">d</span></a><span class="hs-special">)</span><span>
230+</span><a name="line-230"></a><span> </span><span class="hs-special">(</span><a href="Matrix.Internal.html#Split"><span class="hs-identifier hs-var">Split</span></a><span> </span><a name="local-6989586621679038501"><a href="#local-6989586621679038501"><span class="hs-identifier">a</span></a></a><span> </span><a name="local-6989586621679038502"><a href="#local-6989586621679038502"><span class="hs-identifier">b</span></a></a><span class="hs-special">)</span><span> </span><span class="hs-operator">+</span><span> </span><span class="hs-special">(</span><a href="Matrix.Internal.html#Split"><span class="hs-identifier hs-var">Split</span></a><span> </span><a name="local-6989586621679038503"><a href="#local-6989586621679038503"><span class="hs-identifier">c</span></a></a><span> </span><a name="local-6989586621679038504"><a href="#local-6989586621679038504"><span class="hs-identifier">d</span></a></a><span class="hs-special">)</span><span> </span><span class="hs-glyph">=</span><span> </span><a href="Matrix.Internal.html#Split"><span class="hs-identifier hs-var">Split</span></a><span> </span><span class="hs-special">(</span><a href="#local-6989586621679038501"><span class="hs-identifier hs-var">a</span></a><span> </span><span class="hs-operator hs-var">+</span><span> </span><a href="#local-6989586621679038503"><span class="hs-identifier hs-var">c</span></a><span class="hs-special">)</span><span> </span><span class="hs-special">(</span><a href="#local-6989586621679038502"><span class="hs-identifier hs-var">b</span></a><span> </span><span class="hs-operator hs-var">+</span><span> </span><a href="#local-6989586621679038504"><span class="hs-identifier hs-var">d</span></a><span class="hs-special">)</span><span>
231+</span><a name="line-231"></a><span> </span><a name="local-6989586621679038505"><a href="#local-6989586621679038505"><span class="hs-identifier">x</span></a></a><span class="hs-glyph">@</span><span class="hs-special">(</span><a href="Matrix.Internal.html#Split"><span class="hs-identifier hs-var">Split</span></a><span> </span><span class="hs-identifier">_</span><span> </span><span class="hs-identifier">_</span><span class="hs-special">)</span><span> </span><span class="hs-operator">+</span><span> </span><a name="local-6989586621679038506"><a href="#local-6989586621679038506"><span class="hs-identifier">y</span></a></a><span class="hs-glyph">@</span><span class="hs-special">(</span><a href="Matrix.Internal.html#Junc"><span class="hs-identifier hs-var">Junc</span></a><span> </span><span class="hs-identifier">_</span><span> </span><span class="hs-identifier">_</span><span class="hs-special">)</span><span> </span><span class="hs-glyph">=</span><span> </span><a href="#local-6989586621679038505"><span class="hs-identifier hs-var">x</span></a><span> </span><span class="hs-operator hs-var">+</span><span> </span><a href="Matrix.Internal.html#abideJS"><span class="hs-identifier hs-var">abideJS</span></a><span> </span><a href="#local-6989586621679038506"><span class="hs-identifier hs-var">y</span></a><span>
232+</span><a name="line-232"></a><span> </span><a name="local-6989586621679038507"><a href="#local-6989586621679038507"><span class="hs-identifier">x</span></a></a><span class="hs-glyph">@</span><span class="hs-special">(</span><a href="Matrix.Internal.html#Junc"><span class="hs-identifier hs-var">Junc</span></a><span> </span><span class="hs-identifier">_</span><span> </span><span class="hs-identifier">_</span><span class="hs-special">)</span><span> </span><span class="hs-operator">+</span><span> </span><a name="local-6989586621679038508"><a href="#local-6989586621679038508"><span class="hs-identifier">y</span></a></a><span class="hs-glyph">@</span><span class="hs-special">(</span><a href="Matrix.Internal.html#Split"><span class="hs-identifier hs-var">Split</span></a><span> </span><span class="hs-identifier">_</span><span> </span><span class="hs-identifier">_</span><span class="hs-special">)</span><span> </span><span class="hs-glyph">=</span><span> </span><a href="Matrix.Internal.html#abideJS"><span class="hs-identifier hs-var">abideJS</span></a><span> </span><a href="#local-6989586621679038507"><span class="hs-identifier hs-var">x</span></a><span> </span><span class="hs-operator hs-var">+</span><span> </span><a href="#local-6989586621679038508"><span class="hs-identifier hs-var">y</span></a><span>
233+</span><a name="line-233"></a><span>
234+</span><a name="line-234"></a><span> </span><a href="Matrix.Internal.html#Empty"><span class="hs-identifier hs-var">Empty</span></a><span> </span><span class="hs-glyph">-</span><span> </span><a href="Matrix.Internal.html#Empty"><span class="hs-identifier hs-var">Empty</span></a><span> </span><span class="hs-glyph">=</span><span> </span><a href="Matrix.Internal.html#Empty"><span class="hs-identifier hs-var">Empty</span></a><span>
235+</span><a name="line-235"></a><span> </span><span class="hs-special">(</span><a href="Matrix.Internal.html#One"><span class="hs-identifier hs-var">One</span></a><span> </span><a name="local-6989586621679038509"><a href="#local-6989586621679038509"><span class="hs-identifier">a</span></a></a><span class="hs-special">)</span><span> </span><span class="hs-glyph">-</span><span> </span><span class="hs-special">(</span><a href="Matrix.Internal.html#One"><span class="hs-identifier hs-var">One</span></a><span> </span><a name="local-6989586621679038510"><a href="#local-6989586621679038510"><span class="hs-identifier">b</span></a></a><span class="hs-special">)</span><span> </span><span class="hs-glyph">=</span><span> </span><a href="Matrix.Internal.html#One"><span class="hs-identifier hs-var">One</span></a><span> </span><span class="hs-special">(</span><a href="#local-6989586621679038509"><span class="hs-identifier hs-var">a</span></a><span> </span><span class="hs-glyph">-</span><span> </span><a href="#local-6989586621679038510"><span class="hs-identifier hs-var">b</span></a><span class="hs-special">)</span><span>
236+</span><a name="line-236"></a><span> </span><span class="hs-special">(</span><a href="Matrix.Internal.html#Junc"><span class="hs-identifier hs-var">Junc</span></a><span> </span><a name="local-6989586621679038511"><a href="#local-6989586621679038511"><span class="hs-identifier">a</span></a></a><span> </span><a name="local-6989586621679038512"><a href="#local-6989586621679038512"><span class="hs-identifier">b</span></a></a><span class="hs-special">)</span><span> </span><span class="hs-glyph">-</span><span> </span><span class="hs-special">(</span><a href="Matrix.Internal.html#Junc"><span class="hs-identifier hs-var">Junc</span></a><span> </span><a name="local-6989586621679038513"><a href="#local-6989586621679038513"><span class="hs-identifier">c</span></a></a><span> </span><a name="local-6989586621679038514"><a href="#local-6989586621679038514"><span class="hs-identifier">d</span></a></a><span class="hs-special">)</span><span> </span><span class="hs-glyph">=</span><span> </span><a href="Matrix.Internal.html#Junc"><span class="hs-identifier hs-var">Junc</span></a><span> </span><span class="hs-special">(</span><a href="#local-6989586621679038511"><span class="hs-identifier hs-var">a</span></a><span> </span><span class="hs-glyph">-</span><span> </span><a href="#local-6989586621679038513"><span class="hs-identifier hs-var">c</span></a><span class="hs-special">)</span><span> </span><span class="hs-special">(</span><a href="#local-6989586621679038512"><span class="hs-identifier hs-var">b</span></a><span> </span><span class="hs-glyph">-</span><span> </span><a href="#local-6989586621679038514"><span class="hs-identifier hs-var">d</span></a><span class="hs-special">)</span><span>
237+</span><a name="line-237"></a><span> </span><span class="hs-special">(</span><a href="Matrix.Internal.html#Split"><span class="hs-identifier hs-var">Split</span></a><span> </span><a name="local-6989586621679038515"><a href="#local-6989586621679038515"><span class="hs-identifier">a</span></a></a><span> </span><a name="local-6989586621679038516"><a href="#local-6989586621679038516"><span class="hs-identifier">b</span></a></a><span class="hs-special">)</span><span> </span><span class="hs-glyph">-</span><span> </span><span class="hs-special">(</span><a href="Matrix.Internal.html#Split"><span class="hs-identifier hs-var">Split</span></a><span> </span><a name="local-6989586621679038517"><a href="#local-6989586621679038517"><span class="hs-identifier">c</span></a></a><span> </span><a name="local-6989586621679038518"><a href="#local-6989586621679038518"><span class="hs-identifier">d</span></a></a><span class="hs-special">)</span><span> </span><span class="hs-glyph">=</span><span> </span><a href="Matrix.Internal.html#Split"><span class="hs-identifier hs-var">Split</span></a><span> </span><span class="hs-special">(</span><a href="#local-6989586621679038515"><span class="hs-identifier hs-var">a</span></a><span> </span><span class="hs-glyph">-</span><span> </span><a href="#local-6989586621679038517"><span class="hs-identifier hs-var">c</span></a><span class="hs-special">)</span><span> </span><span class="hs-special">(</span><a href="#local-6989586621679038516"><span class="hs-identifier hs-var">b</span></a><span> </span><span class="hs-glyph">-</span><span> </span><a href="#local-6989586621679038518"><span class="hs-identifier hs-var">d</span></a><span class="hs-special">)</span><span>
238+</span><a name="line-238"></a><span> </span><a name="local-6989586621679038519"><a href="#local-6989586621679038519"><span class="hs-identifier">x</span></a></a><span class="hs-glyph">@</span><span class="hs-special">(</span><a href="Matrix.Internal.html#Split"><span class="hs-identifier hs-var">Split</span></a><span> </span><span class="hs-identifier">_</span><span> </span><span class="hs-identifier">_</span><span class="hs-special">)</span><span> </span><span class="hs-glyph">-</span><span> </span><a name="local-6989586621679038520"><a href="#local-6989586621679038520"><span class="hs-identifier">y</span></a></a><span class="hs-glyph">@</span><span class="hs-special">(</span><a href="Matrix.Internal.html#Junc"><span class="hs-identifier hs-var">Junc</span></a><span> </span><span class="hs-identifier">_</span><span> </span><span class="hs-identifier">_</span><span class="hs-special">)</span><span> </span><span class="hs-glyph">=</span><span> </span><a href="#local-6989586621679038519"><span class="hs-identifier hs-var">x</span></a><span> </span><span class="hs-glyph">-</span><span> </span><a href="Matrix.Internal.html#abideJS"><span class="hs-identifier hs-var">abideJS</span></a><span> </span><a href="#local-6989586621679038520"><span class="hs-identifier hs-var">y</span></a><span>
239+</span><a name="line-239"></a><span> </span><a name="local-6989586621679038521"><a href="#local-6989586621679038521"><span class="hs-identifier">x</span></a></a><span class="hs-glyph">@</span><span class="hs-special">(</span><a href="Matrix.Internal.html#Junc"><span class="hs-identifier hs-var">Junc</span></a><span> </span><span class="hs-identifier">_</span><span> </span><span class="hs-identifier">_</span><span class="hs-special">)</span><span> </span><span class="hs-glyph">-</span><span> </span><a name="local-6989586621679038522"><a href="#local-6989586621679038522"><span class="hs-identifier">y</span></a></a><span class="hs-glyph">@</span><span class="hs-special">(</span><a href="Matrix.Internal.html#Split"><span class="hs-identifier hs-var">Split</span></a><span> </span><span class="hs-identifier">_</span><span> </span><span class="hs-identifier">_</span><span class="hs-special">)</span><span> </span><span class="hs-glyph">=</span><span> </span><a href="Matrix.Internal.html#abideJS"><span class="hs-identifier hs-var">abideJS</span></a><span> </span><a href="#local-6989586621679038521"><span class="hs-identifier hs-var">x</span></a><span> </span><span class="hs-glyph">-</span><span> </span><a href="#local-6989586621679038522"><span class="hs-identifier hs-var">y</span></a><span>
240+</span><a name="line-240"></a><span>
241+</span><a name="line-241"></a><span> </span><a href="Matrix.Internal.html#Empty"><span class="hs-identifier hs-var">Empty</span></a><span> </span><a name="local-8214565720323790402"><span class="hs-operator">*</span></a><span> </span><a href="Matrix.Internal.html#Empty"><span class="hs-identifier hs-var">Empty</span></a><span> </span><span class="hs-glyph">=</span><span> </span><a href="Matrix.Internal.html#Empty"><span class="hs-identifier hs-var">Empty</span></a><span>
242+</span><a name="line-242"></a><span> </span><span class="hs-special">(</span><a href="Matrix.Internal.html#One"><span class="hs-identifier hs-var">One</span></a><span> </span><a name="local-6989586621679038523"><a href="#local-6989586621679038523"><span class="hs-identifier">a</span></a></a><span class="hs-special">)</span><span> </span><span class="hs-operator">*</span><span> </span><span class="hs-special">(</span><a href="Matrix.Internal.html#One"><span class="hs-identifier hs-var">One</span></a><span> </span><a name="local-6989586621679038524"><a href="#local-6989586621679038524"><span class="hs-identifier">b</span></a></a><span class="hs-special">)</span><span> </span><span class="hs-glyph">=</span><span> </span><a href="Matrix.Internal.html#One"><span class="hs-identifier hs-var">One</span></a><span> </span><span class="hs-special">(</span><a href="#local-6989586621679038523"><span class="hs-identifier hs-var">a</span></a><span> </span><span class="hs-operator hs-var">*</span><span> </span><a href="#local-6989586621679038524"><span class="hs-identifier hs-var">b</span></a><span class="hs-special">)</span><span>
243+</span><a name="line-243"></a><span> </span><span class="hs-special">(</span><a href="Matrix.Internal.html#Junc"><span class="hs-identifier hs-var">Junc</span></a><span> </span><a name="local-6989586621679038525"><a href="#local-6989586621679038525"><span class="hs-identifier">a</span></a></a><span> </span><a name="local-6989586621679038526"><a href="#local-6989586621679038526"><span class="hs-identifier">b</span></a></a><span class="hs-special">)</span><span> </span><span class="hs-operator">*</span><span> </span><span class="hs-special">(</span><a href="Matrix.Internal.html#Junc"><span class="hs-identifier hs-var">Junc</span></a><span> </span><a name="local-6989586621679038527"><a href="#local-6989586621679038527"><span class="hs-identifier">c</span></a></a><span> </span><a name="local-6989586621679038528"><a href="#local-6989586621679038528"><span class="hs-identifier">d</span></a></a><span class="hs-special">)</span><span> </span><span class="hs-glyph">=</span><span> </span><a href="Matrix.Internal.html#Junc"><span class="hs-identifier hs-var">Junc</span></a><span> </span><span class="hs-special">(</span><a href="#local-6989586621679038525"><span class="hs-identifier hs-var">a</span></a><span> </span><span class="hs-operator hs-var">*</span><span> </span><a href="#local-6989586621679038527"><span class="hs-identifier hs-var">c</span></a><span class="hs-special">)</span><span> </span><span class="hs-special">(</span><a href="#local-6989586621679038526"><span class="hs-identifier hs-var">b</span></a><span> </span><span class="hs-operator hs-var">*</span><span> </span><a href="#local-6989586621679038528"><span class="hs-identifier hs-var">d</span></a><span class="hs-special">)</span><span>
244+</span><a name="line-244"></a><span> </span><span class="hs-special">(</span><a href="Matrix.Internal.html#Split"><span class="hs-identifier hs-var">Split</span></a><span> </span><a name="local-6989586621679038529"><a href="#local-6989586621679038529"><span class="hs-identifier">a</span></a></a><span> </span><a name="local-6989586621679038530"><a href="#local-6989586621679038530"><span class="hs-identifier">b</span></a></a><span class="hs-special">)</span><span> </span><span class="hs-operator">*</span><span> </span><span class="hs-special">(</span><a href="Matrix.Internal.html#Split"><span class="hs-identifier hs-var">Split</span></a><span> </span><a name="local-6989586621679038531"><a href="#local-6989586621679038531"><span class="hs-identifier">c</span></a></a><span> </span><a name="local-6989586621679038532"><a href="#local-6989586621679038532"><span class="hs-identifier">d</span></a></a><span class="hs-special">)</span><span> </span><span class="hs-glyph">=</span><span> </span><a href="Matrix.Internal.html#Split"><span class="hs-identifier hs-var">Split</span></a><span> </span><span class="hs-special">(</span><a href="#local-6989586621679038529"><span class="hs-identifier hs-var">a</span></a><span> </span><span class="hs-operator hs-var">*</span><span> </span><a href="#local-6989586621679038531"><span class="hs-identifier hs-var">c</span></a><span class="hs-special">)</span><span> </span><span class="hs-special">(</span><a href="#local-6989586621679038530"><span class="hs-identifier hs-var">b</span></a><span> </span><span class="hs-operator hs-var">*</span><span> </span><a href="#local-6989586621679038532"><span class="hs-identifier hs-var">d</span></a><span class="hs-special">)</span><span>
245+</span><a name="line-245"></a><span> </span><a name="local-6989586621679038533"><a href="#local-6989586621679038533"><span class="hs-identifier">x</span></a></a><span class="hs-glyph">@</span><span class="hs-special">(</span><a href="Matrix.Internal.html#Split"><span class="hs-identifier hs-var">Split</span></a><span> </span><span class="hs-identifier">_</span><span> </span><span class="hs-identifier">_</span><span class="hs-special">)</span><span> </span><span class="hs-operator">*</span><span> </span><a name="local-6989586621679038534"><a href="#local-6989586621679038534"><span class="hs-identifier">y</span></a></a><span class="hs-glyph">@</span><span class="hs-special">(</span><a href="Matrix.Internal.html#Junc"><span class="hs-identifier hs-var">Junc</span></a><span> </span><span class="hs-identifier">_</span><span> </span><span class="hs-identifier">_</span><span class="hs-special">)</span><span> </span><span class="hs-glyph">=</span><span> </span><a href="#local-6989586621679038533"><span class="hs-identifier hs-var">x</span></a><span> </span><span class="hs-operator hs-var">*</span><span> </span><a href="Matrix.Internal.html#abideJS"><span class="hs-identifier hs-var">abideJS</span></a><span> </span><a href="#local-6989586621679038534"><span class="hs-identifier hs-var">y</span></a><span>
246+</span><a name="line-246"></a><span> </span><a name="local-6989586621679038535"><a href="#local-6989586621679038535"><span class="hs-identifier">x</span></a></a><span class="hs-glyph">@</span><span class="hs-special">(</span><a href="Matrix.Internal.html#Junc"><span class="hs-identifier hs-var">Junc</span></a><span> </span><span class="hs-identifier">_</span><span> </span><span class="hs-identifier">_</span><span class="hs-special">)</span><span> </span><span class="hs-operator">*</span><span> </span><a name="local-6989586621679038536"><a href="#local-6989586621679038536"><span class="hs-identifier">y</span></a></a><span class="hs-glyph">@</span><span class="hs-special">(</span><a href="Matrix.Internal.html#Split"><span class="hs-identifier hs-var">Split</span></a><span> </span><span class="hs-identifier">_</span><span> </span><span class="hs-identifier">_</span><span class="hs-special">)</span><span> </span><span class="hs-glyph">=</span><span> </span><a href="Matrix.Internal.html#abideJS"><span class="hs-identifier hs-var">abideJS</span></a><span> </span><a href="#local-6989586621679038535"><span class="hs-identifier hs-var">x</span></a><span> </span><span class="hs-operator hs-var">*</span><span> </span><a href="#local-6989586621679038536"><span class="hs-identifier hs-var">y</span></a><span>
247+</span><a name="line-247"></a><span>
248+</span><a name="line-248"></a><span> </span><a name="local-8214565720323790401"><span class="hs-identifier">abs</span></a><span> </span><a href="Matrix.Internal.html#Empty"><span class="hs-identifier hs-var">Empty</span></a><span> </span><span class="hs-glyph">=</span><span> </span><a href="Matrix.Internal.html#Empty"><span class="hs-identifier hs-var">Empty</span></a><span>
249+</span><a name="line-249"></a><span> </span><span class="hs-identifier">abs</span><span> </span><span class="hs-special">(</span><a href="Matrix.Internal.html#One"><span class="hs-identifier hs-var">One</span></a><span> </span><a name="local-6989586621679038537"><a href="#local-6989586621679038537"><span class="hs-identifier">a</span></a></a><span class="hs-special">)</span><span> </span><span class="hs-glyph">=</span><span> </span><a href="Matrix.Internal.html#One"><span class="hs-identifier hs-var">One</span></a><span> </span><span class="hs-special">(</span><span class="hs-identifier hs-var">abs</span><span> </span><a href="#local-6989586621679038537"><span class="hs-identifier hs-var">a</span></a><span class="hs-special">)</span><span>
250+</span><a name="line-250"></a><span> </span><span class="hs-identifier">abs</span><span> </span><span class="hs-special">(</span><a href="Matrix.Internal.html#Junc"><span class="hs-identifier hs-var">Junc</span></a><span> </span><a name="local-6989586621679038538"><a href="#local-6989586621679038538"><span class="hs-identifier">a</span></a></a><span> </span><a name="local-6989586621679038539"><a href="#local-6989586621679038539"><span class="hs-identifier">b</span></a></a><span class="hs-special">)</span><span> </span><span class="hs-glyph">=</span><span> </span><a href="Matrix.Internal.html#Junc"><span class="hs-identifier hs-var">Junc</span></a><span> </span><span class="hs-special">(</span><span class="hs-identifier hs-var">abs</span><span> </span><a href="#local-6989586621679038538"><span class="hs-identifier hs-var">a</span></a><span class="hs-special">)</span><span> </span><span class="hs-special">(</span><span class="hs-identifier hs-var">abs</span><span> </span><a href="#local-6989586621679038539"><span class="hs-identifier hs-var">b</span></a><span class="hs-special">)</span><span>
251+</span><a name="line-251"></a><span> </span><span class="hs-identifier">abs</span><span> </span><span class="hs-special">(</span><a href="Matrix.Internal.html#Split"><span class="hs-identifier hs-var">Split</span></a><span> </span><a name="local-6989586621679038540"><a href="#local-6989586621679038540"><span class="hs-identifier">a</span></a></a><span> </span><a name="local-6989586621679038541"><a href="#local-6989586621679038541"><span class="hs-identifier">b</span></a></a><span class="hs-special">)</span><span> </span><span class="hs-glyph">=</span><span> </span><a href="Matrix.Internal.html#Split"><span class="hs-identifier hs-var">Split</span></a><span> </span><span class="hs-special">(</span><span class="hs-identifier hs-var">abs</span><span> </span><a href="#local-6989586621679038540"><span class="hs-identifier hs-var">a</span></a><span class="hs-special">)</span><span> </span><span class="hs-special">(</span><span class="hs-identifier hs-var">abs</span><span> </span><a href="#local-6989586621679038541"><span class="hs-identifier hs-var">b</span></a><span class="hs-special">)</span><span>
252+</span><a name="line-252"></a><span>
253+</span><a name="line-253"></a><span> </span><a name="local-8214565720323790400"><span class="hs-identifier">signum</span></a><span> </span><a href="Matrix.Internal.html#Empty"><span class="hs-identifier hs-var">Empty</span></a><span> </span><span class="hs-glyph">=</span><span> </span><a href="Matrix.Internal.html#Empty"><span class="hs-identifier hs-var">Empty</span></a><span>
254+</span><a name="line-254"></a><span> </span><span class="hs-identifier">signum</span><span> </span><span class="hs-special">(</span><a href="Matrix.Internal.html#One"><span class="hs-identifier hs-var">One</span></a><span> </span><a name="local-6989586621679038542"><a href="#local-6989586621679038542"><span class="hs-identifier">a</span></a></a><span class="hs-special">)</span><span> </span><span class="hs-glyph">=</span><span> </span><a href="Matrix.Internal.html#One"><span class="hs-identifier hs-var">One</span></a><span> </span><span class="hs-special">(</span><span class="hs-identifier hs-var">signum</span><span> </span><a href="#local-6989586621679038542"><span class="hs-identifier hs-var">a</span></a><span class="hs-special">)</span><span>
255+</span><a name="line-255"></a><span> </span><span class="hs-identifier">signum</span><span> </span><span class="hs-special">(</span><a href="Matrix.Internal.html#Junc"><span class="hs-identifier hs-var">Junc</span></a><span> </span><a name="local-6989586621679038543"><a href="#local-6989586621679038543"><span class="hs-identifier">a</span></a></a><span> </span><a name="local-6989586621679038544"><a href="#local-6989586621679038544"><span class="hs-identifier">b</span></a></a><span class="hs-special">)</span><span> </span><span class="hs-glyph">=</span><span> </span><a href="Matrix.Internal.html#Junc"><span class="hs-identifier hs-var">Junc</span></a><span> </span><span class="hs-special">(</span><span class="hs-identifier hs-var">signum</span><span> </span><a href="#local-6989586621679038543"><span class="hs-identifier hs-var">a</span></a><span class="hs-special">)</span><span> </span><span class="hs-special">(</span><span class="hs-identifier hs-var">signum</span><span> </span><a href="#local-6989586621679038544"><span class="hs-identifier hs-var">b</span></a><span class="hs-special">)</span><span>
256+</span><a name="line-256"></a><span> </span><span class="hs-identifier">signum</span><span> </span><span class="hs-special">(</span><a href="Matrix.Internal.html#Split"><span class="hs-identifier hs-var">Split</span></a><span> </span><a name="local-6989586621679038545"><a href="#local-6989586621679038545"><span class="hs-identifier">a</span></a></a><span> </span><a name="local-6989586621679038546"><a href="#local-6989586621679038546"><span class="hs-identifier">b</span></a></a><span class="hs-special">)</span><span> </span><span class="hs-glyph">=</span><span> </span><a href="Matrix.Internal.html#Split"><span class="hs-identifier hs-var">Split</span></a><span> </span><span class="hs-special">(</span><span class="hs-identifier hs-var">signum</span><span> </span><a href="#local-6989586621679038545"><span class="hs-identifier hs-var">a</span></a><span class="hs-special">)</span><span> </span><span class="hs-special">(</span><span class="hs-identifier hs-var">signum</span><span> </span><a href="#local-6989586621679038546"><span class="hs-identifier hs-var">b</span></a><span class="hs-special">)</span><span>
257+</span><a name="line-257"></a><span>
258+</span><a name="line-258"></a><span class="hs-keyword">instance</span><span> </span><span class="hs-identifier hs-type">Ord</span><span> </span><a href="#local-6989586621679038475"><span class="hs-identifier hs-type">e</span></a><span> </span><span class="hs-glyph">=&gt;</span><span> </span><span class="hs-identifier hs-type">Ord</span><span> </span><span class="hs-special">(</span><a href="Matrix.Internal.html#Matrix"><span class="hs-identifier hs-type">Matrix</span></a><span> </span><a href="#local-6989586621679038475"><span class="hs-identifier hs-type">e</span></a><span> </span><a href="#local-6989586621679038476"><span class="hs-identifier hs-type">cols</span></a><span> </span><a href="#local-6989586621679038477"><span class="hs-identifier hs-type">rows</span></a><span class="hs-special">)</span><span> </span><span class="hs-keyword">where</span><span>
259+</span><a name="line-259"></a><span> </span><a href="Matrix.Internal.html#Empty"><span class="hs-identifier hs-var">Empty</span></a><span> </span><a name="local-8214565720323790495"><span class="hs-operator">&lt;=</span></a><span> </span><a href="Matrix.Internal.html#Empty"><span class="hs-identifier hs-var">Empty</span></a><span> </span><span class="hs-glyph">=</span><span> </span><span class="hs-identifier hs-var">True</span><span>
260+</span><a name="line-260"></a><span> </span><span class="hs-special">(</span><a href="Matrix.Internal.html#One"><span class="hs-identifier hs-var">One</span></a><span> </span><a name="local-6989586621679038478"><a href="#local-6989586621679038478"><span class="hs-identifier">a</span></a></a><span class="hs-special">)</span><span> </span><span class="hs-operator">&lt;=</span><span> </span><span class="hs-special">(</span><a href="Matrix.Internal.html#One"><span class="hs-identifier hs-var">One</span></a><span> </span><a name="local-6989586621679038479"><a href="#local-6989586621679038479"><span class="hs-identifier">b</span></a></a><span class="hs-special">)</span><span> </span><span class="hs-glyph">=</span><span> </span><a href="#local-6989586621679038478"><span class="hs-identifier hs-var">a</span></a><span> </span><span class="hs-operator hs-var">&lt;=</span><span> </span><a href="#local-6989586621679038479"><span class="hs-identifier hs-var">b</span></a><span>
261+</span><a name="line-261"></a><span> </span><span class="hs-special">(</span><a href="Matrix.Internal.html#Junc"><span class="hs-identifier hs-var">Junc</span></a><span> </span><a name="local-6989586621679038480"><a href="#local-6989586621679038480"><span class="hs-identifier">a</span></a></a><span> </span><a name="local-6989586621679038481"><a href="#local-6989586621679038481"><span class="hs-identifier">b</span></a></a><span class="hs-special">)</span><span> </span><span class="hs-operator">&lt;=</span><span> </span><span class="hs-special">(</span><a href="Matrix.Internal.html#Junc"><span class="hs-identifier hs-var">Junc</span></a><span> </span><a name="local-6989586621679038482"><a href="#local-6989586621679038482"><span class="hs-identifier">c</span></a></a><span> </span><a name="local-6989586621679038483"><a href="#local-6989586621679038483"><span class="hs-identifier">d</span></a></a><span class="hs-special">)</span><span> </span><span class="hs-glyph">=</span><span> </span><span class="hs-special">(</span><a href="#local-6989586621679038480"><span class="hs-identifier hs-var">a</span></a><span> </span><span class="hs-operator hs-var">&lt;=</span><span> </span><a href="#local-6989586621679038482"><span class="hs-identifier hs-var">c</span></a><span class="hs-special">)</span><span> </span><span class="hs-operator hs-var">&amp;&amp;</span><span> </span><span class="hs-special">(</span><a href="#local-6989586621679038481"><span class="hs-identifier hs-var">b</span></a><span> </span><span class="hs-operator hs-var">&lt;=</span><span> </span><a href="#local-6989586621679038483"><span class="hs-identifier hs-var">d</span></a><span class="hs-special">)</span><span>
262+</span><a name="line-262"></a><span> </span><span class="hs-special">(</span><a href="Matrix.Internal.html#Split"><span class="hs-identifier hs-var">Split</span></a><span> </span><a name="local-6989586621679038484"><a href="#local-6989586621679038484"><span class="hs-identifier">a</span></a></a><span> </span><a name="local-6989586621679038485"><a href="#local-6989586621679038485"><span class="hs-identifier">b</span></a></a><span class="hs-special">)</span><span> </span><span class="hs-operator">&lt;=</span><span> </span><span class="hs-special">(</span><a href="Matrix.Internal.html#Split"><span class="hs-identifier hs-var">Split</span></a><span> </span><a name="local-6989586621679038486"><a href="#local-6989586621679038486"><span class="hs-identifier">c</span></a></a><span> </span><a name="local-6989586621679038487"><a href="#local-6989586621679038487"><span class="hs-identifier">d</span></a></a><span class="hs-special">)</span><span> </span><span class="hs-glyph">=</span><span> </span><span class="hs-special">(</span><a href="#local-6989586621679038484"><span class="hs-identifier hs-var">a</span></a><span> </span><span class="hs-operator hs-var">&lt;=</span><span> </span><a href="#local-6989586621679038486"><span class="hs-identifier hs-var">c</span></a><span class="hs-special">)</span><span> </span><span class="hs-operator hs-var">&amp;&amp;</span><span> </span><span class="hs-special">(</span><a href="#local-6989586621679038485"><span class="hs-identifier hs-var">b</span></a><span> </span><span class="hs-operator hs-var">&lt;=</span><span> </span><a href="#local-6989586621679038487"><span class="hs-identifier hs-var">d</span></a><span class="hs-special">)</span><span>
263+</span><a name="line-263"></a><span> </span><a name="local-6989586621679038488"><a href="#local-6989586621679038488"><span class="hs-identifier">x</span></a></a><span class="hs-glyph">@</span><span class="hs-special">(</span><a href="Matrix.Internal.html#Split"><span class="hs-identifier hs-var">Split</span></a><span> </span><span class="hs-identifier">_</span><span> </span><span class="hs-identifier">_</span><span class="hs-special">)</span><span> </span><span class="hs-operator">&lt;=</span><span> </span><a name="local-6989586621679038489"><a href="#local-6989586621679038489"><span class="hs-identifier">y</span></a></a><span class="hs-glyph">@</span><span class="hs-special">(</span><a href="Matrix.Internal.html#Junc"><span class="hs-identifier hs-var">Junc</span></a><span> </span><span class="hs-identifier">_</span><span> </span><span class="hs-identifier">_</span><span class="hs-special">)</span><span> </span><span class="hs-glyph">=</span><span> </span><a href="#local-6989586621679038488"><span class="hs-identifier hs-var">x</span></a><span> </span><span class="hs-operator hs-var">&lt;=</span><span> </span><a href="Matrix.Internal.html#abideJS"><span class="hs-identifier hs-var">abideJS</span></a><span> </span><a href="#local-6989586621679038489"><span class="hs-identifier hs-var">y</span></a><span>
264+</span><a name="line-264"></a><span> </span><a name="local-6989586621679038490"><a href="#local-6989586621679038490"><span class="hs-identifier">x</span></a></a><span class="hs-glyph">@</span><span class="hs-special">(</span><a href="Matrix.Internal.html#Junc"><span class="hs-identifier hs-var">Junc</span></a><span> </span><span class="hs-identifier">_</span><span> </span><span class="hs-identifier">_</span><span class="hs-special">)</span><span> </span><span class="hs-operator">&lt;=</span><span> </span><a name="local-6989586621679038491"><a href="#local-6989586621679038491"><span class="hs-identifier">y</span></a></a><span class="hs-glyph">@</span><span class="hs-special">(</span><a href="Matrix.Internal.html#Split"><span class="hs-identifier hs-var">Split</span></a><span> </span><span class="hs-identifier">_</span><span> </span><span class="hs-identifier">_</span><span class="hs-special">)</span><span> </span><span class="hs-glyph">=</span><span> </span><a href="Matrix.Internal.html#abideJS"><span class="hs-identifier hs-var">abideJS</span></a><span> </span><a href="#local-6989586621679038490"><span class="hs-identifier hs-var">x</span></a><span> </span><span class="hs-operator hs-var">&lt;=</span><span> </span><a href="#local-6989586621679038491"><span class="hs-identifier hs-var">y</span></a><span>
265+</span><a name="line-265"></a><span>
266+</span><a name="line-266"></a><span class="hs-comment">-- Primitives</span><span>
267+</span><a name="line-267"></a><span>
268+</span><a name="line-268"></a><span class="hs-comment">-- | Empty matrix constructor</span><span>
269+</span><a name="line-269"></a><span class="hs-identifier">empty</span><span> </span><span class="hs-glyph">::</span><span> </span><a href="Matrix.Internal.html#Matrix"><span class="hs-identifier hs-type">Matrix</span></a><span> </span><a href="#local-6989586621679038712"><span class="hs-identifier hs-type">e</span></a><span> </span><span class="hs-identifier hs-type">Void</span><span> </span><span class="hs-identifier hs-type">Void</span><span>
270+</span><a name="line-270"></a><a name="empty"><a href="Matrix.Internal.html#empty"><span class="hs-identifier">empty</span></a></a><span> </span><span class="hs-glyph">=</span><span> </span><a href="Matrix.Internal.html#Empty"><span class="hs-identifier hs-var">Empty</span></a><span>
271+</span><a name="line-271"></a><span>
272+</span><a name="line-272"></a><span class="hs-comment">-- | Unit matrix constructor</span><span>
273+</span><a name="line-273"></a><span class="hs-identifier">one</span><span> </span><span class="hs-glyph">::</span><span> </span><a href="#local-6989586621679038711"><span class="hs-identifier hs-type">e</span></a><span> </span><span class="hs-glyph">-&gt;</span><span> </span><a href="Matrix.Internal.html#Matrix"><span class="hs-identifier hs-type">Matrix</span></a><span> </span><a href="#local-6989586621679038711"><span class="hs-identifier hs-type">e</span></a><span> </span><span class="hs-special">(</span><span class="hs-special">)</span><span> </span><span class="hs-special">(</span><span class="hs-special">)</span><span>
274+</span><a name="line-274"></a><a name="one"><a href="Matrix.Internal.html#one"><span class="hs-identifier">one</span></a></a><span> </span><span class="hs-glyph">=</span><span> </span><a href="Matrix.Internal.html#One"><span class="hs-identifier hs-var">One</span></a><span>
275+</span><a name="line-275"></a><span>
276+</span><a name="line-276"></a><span class="hs-comment">-- | Matrix 'Junc' constructor</span><span>
277+</span><a name="line-277"></a><span class="hs-identifier">junc</span><span> </span><span class="hs-glyph">::</span><span> </span><a href="Matrix.Internal.html#Matrix"><span class="hs-identifier hs-type">Matrix</span></a><span> </span><a href="#local-6989586621679038707"><span class="hs-identifier hs-type">e</span></a><span> </span><a href="#local-6989586621679038708"><span class="hs-identifier hs-type">a</span></a><span> </span><a href="#local-6989586621679038709"><span class="hs-identifier hs-type">rows</span></a><span> </span><span class="hs-glyph">-&gt;</span><span> </span><a href="Matrix.Internal.html#Matrix"><span class="hs-identifier hs-type">Matrix</span></a><span> </span><a href="#local-6989586621679038707"><span class="hs-identifier hs-type">e</span></a><span> </span><a href="#local-6989586621679038710"><span class="hs-identifier hs-type">b</span></a><span> </span><a href="#local-6989586621679038709"><span class="hs-identifier hs-type">rows</span></a><span> </span><span class="hs-glyph">-&gt;</span><span> </span><a href="Matrix.Internal.html#Matrix"><span class="hs-identifier hs-type">Matrix</span></a><span> </span><a href="#local-6989586621679038707"><span class="hs-identifier hs-type">e</span></a><span> </span><span class="hs-special">(</span><span class="hs-identifier hs-type">Either</span><span> </span><a href="#local-6989586621679038708"><span class="hs-identifier hs-type">a</span></a><span> </span><a href="#local-6989586621679038710"><span class="hs-identifier hs-type">b</span></a><span class="hs-special">)</span><span> </span><a href="#local-6989586621679038709"><span class="hs-identifier hs-type">rows</span></a><span>
278+</span><a name="line-278"></a><a name="junc"><a href="Matrix.Internal.html#junc"><span class="hs-identifier">junc</span></a></a><span> </span><span class="hs-glyph">=</span><span> </span><a href="Matrix.Internal.html#Junc"><span class="hs-identifier hs-var">Junc</span></a><span>
279+</span><a name="line-279"></a><span>
280+</span><a name="line-280"></a><span class="hs-keyword">infixl</span><span> </span><span class="hs-number">3</span><span> </span><a href="Matrix.Internal.html#%7C%7C%7C"><span class="hs-operator hs-var">|||</span></a><span>
281+</span><a name="line-281"></a><span>
282+</span><a name="line-282"></a><span class="hs-comment">-- | Matrix 'Junc' constructor</span><span>
283+</span><a name="line-283"></a><span class="hs-special">(</span><span class="hs-operator">|||</span><span class="hs-special">)</span><span> </span><span class="hs-glyph">::</span><span> </span><a href="Matrix.Internal.html#Matrix"><span class="hs-identifier hs-type">Matrix</span></a><span> </span><a href="#local-6989586621679038703"><span class="hs-identifier hs-type">e</span></a><span> </span><a href="#local-6989586621679038704"><span class="hs-identifier hs-type">a</span></a><span> </span><a href="#local-6989586621679038705"><span class="hs-identifier hs-type">rows</span></a><span> </span><span class="hs-glyph">-&gt;</span><span> </span><a href="Matrix.Internal.html#Matrix"><span class="hs-identifier hs-type">Matrix</span></a><span> </span><a href="#local-6989586621679038703"><span class="hs-identifier hs-type">e</span></a><span> </span><a href="#local-6989586621679038706"><span class="hs-identifier hs-type">b</span></a><span> </span><a href="#local-6989586621679038705"><span class="hs-identifier hs-type">rows</span></a><span> </span><span class="hs-glyph">-&gt;</span><span> </span><a href="Matrix.Internal.html#Matrix"><span class="hs-identifier hs-type">Matrix</span></a><span> </span><a href="#local-6989586621679038703"><span class="hs-identifier hs-type">e</span></a><span> </span><span class="hs-special">(</span><span class="hs-identifier hs-type">Either</span><span> </span><a href="#local-6989586621679038704"><span class="hs-identifier hs-type">a</span></a><span> </span><a href="#local-6989586621679038706"><span class="hs-identifier hs-type">b</span></a><span class="hs-special">)</span><span> </span><a href="#local-6989586621679038705"><span class="hs-identifier hs-type">rows</span></a><span>
284+</span><a name="line-284"></a><span class="hs-special">(</span><a name="%7C%7C%7C"><a href="Matrix.Internal.html#%7C%7C%7C"><span class="hs-operator">|||</span></a></a><span class="hs-special">)</span><span> </span><span class="hs-glyph">=</span><span> </span><a href="Matrix.Internal.html#Junc"><span class="hs-identifier hs-var">Junc</span></a><span>
285+</span><a name="line-285"></a><span>
286+</span><a name="line-286"></a><span class="hs-comment">-- | Matrix 'Split' constructor</span><span>
287+</span><a name="line-287"></a><span class="hs-identifier">split</span><span> </span><span class="hs-glyph">::</span><span> </span><a href="Matrix.Internal.html#Matrix"><span class="hs-identifier hs-type">Matrix</span></a><span> </span><a href="#local-6989586621679038699"><span class="hs-identifier hs-type">e</span></a><span> </span><a href="#local-6989586621679038700"><span class="hs-identifier hs-type">cols</span></a><span> </span><a href="#local-6989586621679038701"><span class="hs-identifier hs-type">a</span></a><span> </span><span class="hs-glyph">-&gt;</span><span> </span><a href="Matrix.Internal.html#Matrix"><span class="hs-identifier hs-type">Matrix</span></a><span> </span><a href="#local-6989586621679038699"><span class="hs-identifier hs-type">e</span></a><span> </span><a href="#local-6989586621679038700"><span class="hs-identifier hs-type">cols</span></a><span> </span><a href="#local-6989586621679038702"><span class="hs-identifier hs-type">b</span></a><span> </span><span class="hs-glyph">-&gt;</span><span> </span><a href="Matrix.Internal.html#Matrix"><span class="hs-identifier hs-type">Matrix</span></a><span> </span><a href="#local-6989586621679038699"><span class="hs-identifier hs-type">e</span></a><span> </span><a href="#local-6989586621679038700"><span class="hs-identifier hs-type">cols</span></a><span> </span><span class="hs-special">(</span><span class="hs-identifier hs-type">Either</span><span> </span><a href="#local-6989586621679038701"><span class="hs-identifier hs-type">a</span></a><span> </span><a href="#local-6989586621679038702"><span class="hs-identifier hs-type">b</span></a><span class="hs-special">)</span><span>
288+</span><a name="line-288"></a><a name="split"><a href="Matrix.Internal.html#split"><span class="hs-identifier">split</span></a></a><span> </span><span class="hs-glyph">=</span><span> </span><a href="Matrix.Internal.html#Split"><span class="hs-identifier hs-var">Split</span></a><span>
289+</span><a name="line-289"></a><span>
290+</span><a name="line-290"></a><span class="hs-keyword">infixl</span><span> </span><span class="hs-number">2</span><span> </span><a href="Matrix.Internal.html#%3D%3D%3D"><span class="hs-operator hs-var">===</span></a><span>
291+</span><a name="line-291"></a><span>
292+</span><a name="line-292"></a><span class="hs-comment">-- | Matrix 'Split' constructor</span><span>
293+</span><a name="line-293"></a><span class="hs-special">(</span><span class="hs-operator">===</span><span class="hs-special">)</span><span> </span><span class="hs-glyph">::</span><span> </span><a href="Matrix.Internal.html#Matrix"><span class="hs-identifier hs-type">Matrix</span></a><span> </span><a href="#local-6989586621679038695"><span class="hs-identifier hs-type">e</span></a><span> </span><a href="#local-6989586621679038696"><span class="hs-identifier hs-type">cols</span></a><span> </span><a href="#local-6989586621679038697"><span class="hs-identifier hs-type">a</span></a><span> </span><span class="hs-glyph">-&gt;</span><span> </span><a href="Matrix.Internal.html#Matrix"><span class="hs-identifier hs-type">Matrix</span></a><span> </span><a href="#local-6989586621679038695"><span class="hs-identifier hs-type">e</span></a><span> </span><a href="#local-6989586621679038696"><span class="hs-identifier hs-type">cols</span></a><span> </span><a href="#local-6989586621679038698"><span class="hs-identifier hs-type">b</span></a><span> </span><span class="hs-glyph">-&gt;</span><span> </span><a href="Matrix.Internal.html#Matrix"><span class="hs-identifier hs-type">Matrix</span></a><span> </span><a href="#local-6989586621679038695"><span class="hs-identifier hs-type">e</span></a><span> </span><a href="#local-6989586621679038696"><span class="hs-identifier hs-type">cols</span></a><span> </span><span class="hs-special">(</span><span class="hs-identifier hs-type">Either</span><span> </span><a href="#local-6989586621679038697"><span class="hs-identifier hs-type">a</span></a><span> </span><a href="#local-6989586621679038698"><span class="hs-identifier hs-type">b</span></a><span class="hs-special">)</span><span>
294+</span><a name="line-294"></a><span class="hs-special">(</span><a name="%3D%3D%3D"><a href="Matrix.Internal.html#%3D%3D%3D"><span class="hs-operator">===</span></a></a><span class="hs-special">)</span><span> </span><span class="hs-glyph">=</span><span> </span><a href="Matrix.Internal.html#Split"><span class="hs-identifier hs-var">Split</span></a><span>
295+</span><a name="line-295"></a><span>
296+</span><a name="line-296"></a><span class="hs-comment">-- Construction</span><span>
297+</span><a name="line-297"></a><span>
298+</span><a name="line-298"></a><span class="hs-comment">-- | Type class for defining the 'fromList' conversion function.</span><span>
299+</span><a name="line-299"></a><span class="hs-comment">--</span><span>
300+</span><a name="line-300"></a><span class="hs-comment">-- Given that it is not possible to branch on types at the term level type</span><span>
301+</span><a name="line-301"></a><span class="hs-comment">-- classes are needed bery much like an inductive definition but on types.</span><span>
302+</span><a name="line-302"></a><span class="hs-keyword">class</span><span> </span><a name="FromLists"><a href="Matrix.Internal.html#FromLists"><span class="hs-identifier">FromLists</span></a></a><span> </span><a name="local-6989586621679038061"><a href="#local-6989586621679038061"><span class="hs-identifier">e</span></a></a><span> </span><a name="local-6989586621679038062"><a href="#local-6989586621679038062"><span class="hs-identifier">cols</span></a></a><span> </span><a name="local-6989586621679038063"><a href="#local-6989586621679038063"><span class="hs-identifier">rows</span></a></a><span> </span><span class="hs-keyword">where</span><span>
303+</span><a name="line-303"></a><span> </span><span class="hs-comment">-- | Build a matrix out of a list of list of elements. Throws a runtime</span><span>
304+</span><a name="line-304"></a><span> </span><span class="hs-comment">-- error if the dimensions do not match.</span><span>
305+</span><a name="line-305"></a><span> </span><a name="fromLists"><a href="Matrix.Internal.html#fromLists"><span class="hs-identifier">fromLists</span></a></a><span> </span><span class="hs-glyph">::</span><span> </span><span class="hs-special">[</span><span class="hs-special">[</span><a href="#local-6989586621679038061"><span class="hs-identifier hs-type">e</span></a><span class="hs-special">]</span><span class="hs-special">]</span><span> </span><span class="hs-glyph">-&gt;</span><span> </span><a href="Matrix.Internal.html#Matrix"><span class="hs-identifier hs-type">Matrix</span></a><span> </span><a href="#local-6989586621679038061"><span class="hs-identifier hs-type">e</span></a><span> </span><a href="#local-6989586621679038062"><span class="hs-identifier hs-type">cols</span></a><span> </span><a href="#local-6989586621679038063"><span class="hs-identifier hs-type">rows</span></a><span>
306+</span><a name="line-306"></a><span>
307+</span><a name="line-307"></a><span class="hs-keyword">instance</span><span> </span><a href="Matrix.Internal.html#FromLists"><span class="hs-identifier hs-type">FromLists</span></a><span> </span><a href="#local-6989586621679038474"><span class="hs-identifier hs-type">e</span></a><span> </span><span class="hs-identifier hs-type">Void</span><span> </span><span class="hs-identifier hs-type">Void</span><span> </span><span class="hs-keyword">where</span><span>
308+</span><a name="line-308"></a><span> </span><a name="local-8214565720323812914"><a href="Matrix.Internal.html#fromLists"><span class="hs-identifier">fromLists</span></a></a><span> </span><span class="hs-special">[</span><span class="hs-special">]</span><span> </span><span class="hs-glyph">=</span><span> </span><a href="Matrix.Internal.html#Empty"><span class="hs-identifier hs-var">Empty</span></a><span>
309+</span><a name="line-309"></a><span> </span><span class="hs-identifier">fromLists</span><span> </span><span class="hs-identifier">_</span><span> </span><span class="hs-glyph">=</span><span> </span><span class="hs-identifier hs-var">error</span><span> </span><span class="hs-string">&quot;Wrong dimensions&quot;</span><span>
310+</span><a name="line-310"></a><span>
311+</span><a name="line-311"></a><span class="hs-keyword">instance</span><span> </span><span class="hs-pragma">{-# OVERLAPPING</span><span> </span><span class="hs-pragma">#-}</span><span> </span><a href="Matrix.Internal.html#FromLists"><span class="hs-identifier hs-type">FromLists</span></a><span> </span><a href="#local-6989586621679038472"><span class="hs-identifier hs-type">e</span></a><span> </span><span class="hs-special">(</span><span class="hs-special">)</span><span> </span><span class="hs-special">(</span><span class="hs-special">)</span><span> </span><span class="hs-keyword">where</span><span>
312+</span><a name="line-312"></a><span> </span><a name="local-8214565720323812914"><a href="Matrix.Internal.html#fromLists"><span class="hs-identifier">fromLists</span></a></a><span> </span><span class="hs-special">[</span><span class="hs-special">[</span><a name="local-6989586621679038473"><a href="#local-6989586621679038473"><span class="hs-identifier">e</span></a></a><span class="hs-special">]</span><span class="hs-special">]</span><span> </span><span class="hs-glyph">=</span><span> </span><a href="Matrix.Internal.html#One"><span class="hs-identifier hs-var">One</span></a><span> </span><a href="#local-6989586621679038473"><span class="hs-identifier hs-var">e</span></a><span>
313+</span><a name="line-313"></a><span> </span><span class="hs-identifier">fromLists</span><span> </span><span class="hs-identifier">_</span><span> </span><span class="hs-glyph">=</span><span> </span><span class="hs-identifier hs-var">error</span><span> </span><span class="hs-string">&quot;Wrong dimensions&quot;</span><span>
314+</span><a name="line-314"></a><span>
315+</span><a name="line-315"></a><span class="hs-keyword">instance</span><span> </span><span class="hs-pragma">{-# OVERLAPPING</span><span> </span><span class="hs-pragma">#-}</span><span> </span><span class="hs-special">(</span><a href="Matrix.Internal.html#FromLists"><span class="hs-identifier hs-type">FromLists</span></a><span> </span><a href="#local-6989586621679038468"><span class="hs-identifier hs-type">e</span></a><span> </span><a href="#local-6989586621679038469"><span class="hs-identifier hs-type">cols</span></a><span> </span><span class="hs-special">(</span><span class="hs-special">)</span><span class="hs-special">)</span><span> </span><span class="hs-glyph">=&gt;</span><span> </span><a href="Matrix.Internal.html#FromLists"><span class="hs-identifier hs-type">FromLists</span></a><span> </span><a href="#local-6989586621679038468"><span class="hs-identifier hs-type">e</span></a><span> </span><span class="hs-special">(</span><span class="hs-identifier hs-type">Either</span><span> </span><span class="hs-special">(</span><span class="hs-special">)</span><span> </span><a href="#local-6989586621679038469"><span class="hs-identifier hs-type">cols</span></a><span class="hs-special">)</span><span> </span><span class="hs-special">(</span><span class="hs-special">)</span><span> </span><span class="hs-keyword">where</span><span>
316+</span><a name="line-316"></a><span> </span><a name="local-8214565720323812914"><a href="Matrix.Internal.html#fromLists"><span class="hs-identifier">fromLists</span></a></a><span> </span><span class="hs-special">[</span><a name="local-6989586621679038470"><a href="#local-6989586621679038470"><span class="hs-identifier">h</span></a></a><span> </span><span class="hs-glyph">:</span><span> </span><a name="local-6989586621679038471"><a href="#local-6989586621679038471"><span class="hs-identifier">t</span></a></a><span class="hs-special">]</span><span> </span><span class="hs-glyph">=</span><span> </span><a href="Matrix.Internal.html#Junc"><span class="hs-identifier hs-var">Junc</span></a><span> </span><span class="hs-special">(</span><a href="Matrix.Internal.html#One"><span class="hs-identifier hs-var">One</span></a><span> </span><a href="#local-6989586621679038470"><span class="hs-identifier hs-var">h</span></a><span class="hs-special">)</span><span> </span><span class="hs-special">(</span><a href="Matrix.Internal.html#fromLists"><span class="hs-identifier hs-var">fromLists</span></a><span> </span><span class="hs-special">[</span><a href="#local-6989586621679038471"><span class="hs-identifier hs-var">t</span></a><span class="hs-special">]</span><span class="hs-special">)</span><span>
317+</span><a name="line-317"></a><span> </span><span class="hs-identifier">fromLists</span><span> </span><span class="hs-identifier">_</span><span> </span><span class="hs-glyph">=</span><span> </span><span class="hs-identifier hs-var">error</span><span> </span><span class="hs-string">&quot;Wrong dimensions&quot;</span><span>
318+</span><a name="line-318"></a><span>
319+</span><a name="line-319"></a><span class="hs-keyword">instance</span><span> </span><span class="hs-pragma">{-# OVERLAPPABLE</span><span> </span><span class="hs-pragma">#-}</span><span> </span><span class="hs-special">(</span><a href="Matrix.Internal.html#FromLists"><span class="hs-identifier hs-type">FromLists</span></a><span> </span><a href="#local-6989586621679038463"><span class="hs-identifier hs-type">e</span></a><span> </span><a href="#local-6989586621679038464"><span class="hs-identifier hs-type">a</span></a><span> </span><span class="hs-special">(</span><span class="hs-special">)</span><span class="hs-special">,</span><span> </span><a href="Matrix.Internal.html#FromLists"><span class="hs-identifier hs-type">FromLists</span></a><span> </span><a href="#local-6989586621679038463"><span class="hs-identifier hs-type">e</span></a><span> </span><a href="#local-6989586621679038465"><span class="hs-identifier hs-type">b</span></a><span> </span><span class="hs-special">(</span><span class="hs-special">)</span><span class="hs-special">,</span><span> </span><span class="hs-identifier hs-type">KnownNat</span><span> </span><span class="hs-special">(</span><a href="Matrix.Internal.html#Count"><span class="hs-identifier hs-type">Count</span></a><span> </span><a href="#local-6989586621679038464"><span class="hs-identifier hs-type">a</span></a><span class="hs-special">)</span><span class="hs-special">)</span><span> </span><span class="hs-glyph">=&gt;</span><span> </span><a href="Matrix.Internal.html#FromLists"><span class="hs-identifier hs-type">FromLists</span></a><span> </span><a href="#local-6989586621679038463"><span class="hs-identifier hs-type">e</span></a><span> </span><span class="hs-special">(</span><span class="hs-identifier hs-type">Either</span><span> </span><a href="#local-6989586621679038464"><span class="hs-identifier hs-type">a</span></a><span> </span><a href="#local-6989586621679038465"><span class="hs-identifier hs-type">b</span></a><span class="hs-special">)</span><span> </span><span class="hs-special">(</span><span class="hs-special">)</span><span> </span><span class="hs-keyword">where</span><span>
320+</span><a name="line-320"></a><span> </span><a name="local-8214565720323812914"><a href="Matrix.Internal.html#fromLists"><span class="hs-identifier">fromLists</span></a></a><span> </span><span class="hs-special">[</span><a name="local-6989586621679038466"><a href="#local-6989586621679038466"><span class="hs-identifier">l</span></a></a><span class="hs-special">]</span><span> </span><span class="hs-glyph">=</span><span>
321+</span><a name="line-321"></a><span> </span><span class="hs-keyword">let</span><span> </span><a name="local-6989586621679038467"><a href="#local-6989586621679038467"><span class="hs-identifier">rowsA</span></a></a><span> </span><span class="hs-glyph">=</span><span> </span><span class="hs-identifier hs-var">fromInteger</span><span> </span><span class="hs-special">(</span><span class="hs-identifier hs-var">natVal</span><span> </span><span class="hs-special">(</span><span class="hs-identifier hs-var">Proxy</span><span> </span><span class="hs-glyph">::</span><span> </span><span class="hs-identifier hs-type">Proxy</span><span> </span><span class="hs-special">(</span><a href="Matrix.Internal.html#Count"><span class="hs-identifier hs-type">Count</span></a><span> </span><a href="#local-6989586621679038464"><span class="hs-identifier hs-type">a</span></a><span class="hs-special">)</span><span class="hs-special">)</span><span class="hs-special">)</span><span>
322+</span><a name="line-322"></a><span> </span><span class="hs-keyword">in</span><span> </span><a href="Matrix.Internal.html#Junc"><span class="hs-identifier hs-var">Junc</span></a><span> </span><span class="hs-special">(</span><a href="Matrix.Internal.html#fromLists"><span class="hs-identifier hs-var">fromLists</span></a><span> </span><span class="hs-special">[</span><span class="hs-identifier hs-var">take</span><span> </span><a href="#local-6989586621679038467"><span class="hs-identifier hs-var">rowsA</span></a><span> </span><a href="#local-6989586621679038466"><span class="hs-identifier hs-var">l</span></a><span class="hs-special">]</span><span class="hs-special">)</span><span> </span><span class="hs-special">(</span><a href="Matrix.Internal.html#fromLists"><span class="hs-identifier hs-var">fromLists</span></a><span> </span><span class="hs-special">[</span><span class="hs-identifier hs-var">drop</span><span> </span><a href="#local-6989586621679038467"><span class="hs-identifier hs-var">rowsA</span></a><span> </span><a href="#local-6989586621679038466"><span class="hs-identifier hs-var">l</span></a><span class="hs-special">]</span><span class="hs-special">)</span><span>
323+</span><a name="line-323"></a><span> </span><span class="hs-identifier">fromLists</span><span> </span><span class="hs-identifier">_</span><span> </span><span class="hs-glyph">=</span><span> </span><span class="hs-identifier hs-var">error</span><span> </span><span class="hs-string">&quot;Wrong dimensions&quot;</span><span>
324+</span><a name="line-324"></a><span>
325+</span><a name="line-325"></a><span class="hs-keyword">instance</span><span> </span><span class="hs-pragma">{-# OVERLAPPING</span><span> </span><span class="hs-pragma">#-}</span><span> </span><span class="hs-special">(</span><a href="Matrix.Internal.html#FromLists"><span class="hs-identifier hs-type">FromLists</span></a><span> </span><a href="#local-6989586621679038459"><span class="hs-identifier hs-type">e</span></a><span> </span><span class="hs-special">(</span><span class="hs-special">)</span><span> </span><a href="#local-6989586621679038460"><span class="hs-identifier hs-type">rows</span></a><span class="hs-special">)</span><span> </span><span class="hs-glyph">=&gt;</span><span> </span><a href="Matrix.Internal.html#FromLists"><span class="hs-identifier hs-type">FromLists</span></a><span> </span><a href="#local-6989586621679038459"><span class="hs-identifier hs-type">e</span></a><span> </span><span class="hs-special">(</span><span class="hs-special">)</span><span> </span><span class="hs-special">(</span><span class="hs-identifier hs-type">Either</span><span> </span><span class="hs-special">(</span><span class="hs-special">)</span><span> </span><a href="#local-6989586621679038460"><span class="hs-identifier hs-type">rows</span></a><span class="hs-special">)</span><span> </span><span class="hs-keyword">where</span><span>
326+</span><a name="line-326"></a><span> </span><a name="local-8214565720323812914"><a href="Matrix.Internal.html#fromLists"><span class="hs-identifier">fromLists</span></a></a><span> </span><span class="hs-special">(</span><span class="hs-special">[</span><a name="local-6989586621679038461"><a href="#local-6989586621679038461"><span class="hs-identifier">h</span></a></a><span class="hs-special">]</span><span> </span><span class="hs-glyph">:</span><span> </span><a name="local-6989586621679038462"><a href="#local-6989586621679038462"><span class="hs-identifier">t</span></a></a><span class="hs-special">)</span><span> </span><span class="hs-glyph">=</span><span> </span><a href="Matrix.Internal.html#Split"><span class="hs-identifier hs-var">Split</span></a><span> </span><span class="hs-special">(</span><a href="Matrix.Internal.html#One"><span class="hs-identifier hs-var">One</span></a><span> </span><a href="#local-6989586621679038461"><span class="hs-identifier hs-var">h</span></a><span class="hs-special">)</span><span> </span><span class="hs-special">(</span><a href="Matrix.Internal.html#fromLists"><span class="hs-identifier hs-var">fromLists</span></a><span> </span><a href="#local-6989586621679038462"><span class="hs-identifier hs-var">t</span></a><span class="hs-special">)</span><span>
327+</span><a name="line-327"></a><span> </span><span class="hs-identifier">fromLists</span><span> </span><span class="hs-identifier">_</span><span> </span><span class="hs-glyph">=</span><span> </span><span class="hs-identifier hs-var">error</span><span> </span><span class="hs-string">&quot;Wrong dimensions&quot;</span><span>
328+</span><a name="line-328"></a><span>
329+</span><a name="line-329"></a><span class="hs-keyword">instance</span><span> </span><span class="hs-pragma">{-# OVERLAPPABLE</span><span> </span><span class="hs-pragma">#-}</span><span> </span><span class="hs-special">(</span><a href="Matrix.Internal.html#FromLists"><span class="hs-identifier hs-type">FromLists</span></a><span> </span><a href="#local-6989586621679038454"><span class="hs-identifier hs-type">e</span></a><span> </span><span class="hs-special">(</span><span class="hs-special">)</span><span> </span><a href="#local-6989586621679038455"><span class="hs-identifier hs-type">a</span></a><span class="hs-special">,</span><span> </span><a href="Matrix.Internal.html#FromLists"><span class="hs-identifier hs-type">FromLists</span></a><span> </span><a href="#local-6989586621679038454"><span class="hs-identifier hs-type">e</span></a><span> </span><span class="hs-special">(</span><span class="hs-special">)</span><span> </span><a href="#local-6989586621679038456"><span class="hs-identifier hs-type">b</span></a><span class="hs-special">,</span><span> </span><span class="hs-identifier hs-type">KnownNat</span><span> </span><span class="hs-special">(</span><a href="Matrix.Internal.html#Count"><span class="hs-identifier hs-type">Count</span></a><span> </span><a href="#local-6989586621679038455"><span class="hs-identifier hs-type">a</span></a><span class="hs-special">)</span><span class="hs-special">)</span><span> </span><span class="hs-glyph">=&gt;</span><span> </span><a href="Matrix.Internal.html#FromLists"><span class="hs-identifier hs-type">FromLists</span></a><span> </span><a href="#local-6989586621679038454"><span class="hs-identifier hs-type">e</span></a><span> </span><span class="hs-special">(</span><span class="hs-special">)</span><span> </span><span class="hs-special">(</span><span class="hs-identifier hs-type">Either</span><span> </span><a href="#local-6989586621679038455"><span class="hs-identifier hs-type">a</span></a><span> </span><a href="#local-6989586621679038456"><span class="hs-identifier hs-type">b</span></a><span class="hs-special">)</span><span> </span><span class="hs-keyword">where</span><span>
330+</span><a name="line-330"></a><span> </span><a name="local-8214565720323812914"><a href="Matrix.Internal.html#fromLists"><span class="hs-identifier">fromLists</span></a></a><span> </span><a name="local-6989586621679038457"><a href="#local-6989586621679038457"><span class="hs-identifier">l</span></a></a><span class="hs-glyph">@</span><span class="hs-special">(</span><span class="hs-special">[</span><span class="hs-identifier">_</span><span class="hs-special">]</span><span> </span><span class="hs-glyph">:</span><span> </span><span class="hs-identifier">_</span><span class="hs-special">)</span><span> </span><span class="hs-glyph">=</span><span>
331+</span><a name="line-331"></a><span> </span><span class="hs-keyword">let</span><span> </span><a name="local-6989586621679038458"><a href="#local-6989586621679038458"><span class="hs-identifier">rowsA</span></a></a><span> </span><span class="hs-glyph">=</span><span> </span><span class="hs-identifier hs-var">fromInteger</span><span> </span><span class="hs-special">(</span><span class="hs-identifier hs-var">natVal</span><span> </span><span class="hs-special">(</span><span class="hs-identifier hs-var">Proxy</span><span> </span><span class="hs-glyph">::</span><span> </span><span class="hs-identifier hs-type">Proxy</span><span> </span><span class="hs-special">(</span><a href="Matrix.Internal.html#Count"><span class="hs-identifier hs-type">Count</span></a><span> </span><a href="#local-6989586621679038455"><span class="hs-identifier hs-type">a</span></a><span class="hs-special">)</span><span class="hs-special">)</span><span class="hs-special">)</span><span>
332+</span><a name="line-332"></a><span> </span><span class="hs-keyword">in</span><span> </span><a href="Matrix.Internal.html#Split"><span class="hs-identifier hs-var">Split</span></a><span> </span><span class="hs-special">(</span><a href="Matrix.Internal.html#fromLists"><span class="hs-identifier hs-var">fromLists</span></a><span> </span><span class="hs-special">(</span><span class="hs-identifier hs-var">take</span><span> </span><a href="#local-6989586621679038458"><span class="hs-identifier hs-var">rowsA</span></a><span> </span><a href="#local-6989586621679038457"><span class="hs-identifier hs-var">l</span></a><span class="hs-special">)</span><span class="hs-special">)</span><span> </span><span class="hs-special">(</span><a href="Matrix.Internal.html#fromLists"><span class="hs-identifier hs-var">fromLists</span></a><span> </span><span class="hs-special">(</span><span class="hs-identifier hs-var">drop</span><span> </span><a href="#local-6989586621679038458"><span class="hs-identifier hs-var">rowsA</span></a><span> </span><a href="#local-6989586621679038457"><span class="hs-identifier hs-var">l</span></a><span class="hs-special">)</span><span class="hs-special">)</span><span>
333+</span><a name="line-333"></a><span> </span><span class="hs-identifier">fromLists</span><span> </span><span class="hs-identifier">_</span><span> </span><span class="hs-glyph">=</span><span> </span><span class="hs-identifier hs-var">error</span><span> </span><span class="hs-string">&quot;Wrong dimensions&quot;</span><span>
334+</span><a name="line-334"></a><span>
335+</span><a name="line-335"></a><span class="hs-keyword">instance</span><span> </span><span class="hs-pragma">{-# OVERLAPPABLE</span><span> </span><span class="hs-pragma">#-}</span><span> </span><span class="hs-special">(</span><a href="Matrix.Internal.html#FromLists"><span class="hs-identifier hs-type">FromLists</span></a><span> </span><a href="#local-6989586621679038253"><span class="hs-identifier hs-type">e</span></a><span> </span><span class="hs-special">(</span><span class="hs-identifier hs-type">Either</span><span> </span><a href="#local-6989586621679038254"><span class="hs-identifier hs-type">a</span></a><span> </span><a href="#local-6989586621679038255"><span class="hs-identifier hs-type">b</span></a><span class="hs-special">)</span><span> </span><a href="#local-6989586621679038256"><span class="hs-identifier hs-type">c</span></a><span class="hs-special">,</span><span> </span><a href="Matrix.Internal.html#FromLists"><span class="hs-identifier hs-type">FromLists</span></a><span> </span><a href="#local-6989586621679038253"><span class="hs-identifier hs-type">e</span></a><span> </span><span class="hs-special">(</span><span class="hs-identifier hs-type">Either</span><span> </span><a href="#local-6989586621679038254"><span class="hs-identifier hs-type">a</span></a><span> </span><a href="#local-6989586621679038255"><span class="hs-identifier hs-type">b</span></a><span class="hs-special">)</span><span> </span><a href="#local-6989586621679038257"><span class="hs-identifier hs-type">d</span></a><span class="hs-special">,</span><span> </span><span class="hs-identifier hs-type">KnownNat</span><span> </span><span class="hs-special">(</span><a href="Matrix.Internal.html#Count"><span class="hs-identifier hs-type">Count</span></a><span> </span><a href="#local-6989586621679038256"><span class="hs-identifier hs-type">c</span></a><span class="hs-special">)</span><span class="hs-special">)</span><span> </span><span class="hs-glyph">=&gt;</span><span> </span><a href="Matrix.Internal.html#FromLists"><span class="hs-identifier hs-type">FromLists</span></a><span> </span><a href="#local-6989586621679038253"><span class="hs-identifier hs-type">e</span></a><span> </span><span class="hs-special">(</span><span class="hs-identifier hs-type">Either</span><span> </span><a href="#local-6989586621679038254"><span class="hs-identifier hs-type">a</span></a><span> </span><a href="#local-6989586621679038255"><span class="hs-identifier hs-type">b</span></a><span class="hs-special">)</span><span> </span><span class="hs-special">(</span><span class="hs-identifier hs-type">Either</span><span> </span><a href="#local-6989586621679038256"><span class="hs-identifier hs-type">c</span></a><span> </span><a href="#local-6989586621679038257"><span class="hs-identifier hs-type">d</span></a><span class="hs-special">)</span><span> </span><span class="hs-keyword">where</span><span>
336+</span><a name="line-336"></a><span> </span><a name="local-8214565720323812914"><a href="Matrix.Internal.html#fromLists"><span class="hs-identifier">fromLists</span></a></a><span> </span><a name="local-6989586621679038258"><a href="#local-6989586621679038258"><span class="hs-identifier">l</span></a></a><span class="hs-glyph">@</span><span class="hs-special">(</span><a name="local-6989586621679038259"><a href="#local-6989586621679038259"><span class="hs-identifier">h</span></a></a><span> </span><span class="hs-glyph">:</span><span> </span><a name="local-6989586621679038260"><a href="#local-6989586621679038260"><span class="hs-identifier">t</span></a></a><span class="hs-special">)</span><span> </span><span class="hs-glyph">=</span><span>
337+</span><a name="line-337"></a><span> </span><span class="hs-keyword">let</span><span> </span><a name="local-6989586621679038261"><a href="#local-6989586621679038261"><span class="hs-identifier">lh</span></a></a><span> </span><span class="hs-glyph">=</span><span> </span><span class="hs-identifier hs-var">length</span><span> </span><a href="#local-6989586621679038259"><span class="hs-identifier hs-var">h</span></a><span>
338+</span><a name="line-338"></a><span> </span><a name="local-6989586621679038262"><a href="#local-6989586621679038262"><span class="hs-identifier">rowsC</span></a></a><span> </span><span class="hs-glyph">=</span><span> </span><span class="hs-identifier hs-var">fromInteger</span><span> </span><span class="hs-special">(</span><span class="hs-identifier hs-var">natVal</span><span> </span><span class="hs-special">(</span><span class="hs-identifier hs-var">Proxy</span><span> </span><span class="hs-glyph">::</span><span> </span><span class="hs-identifier hs-type">Proxy</span><span> </span><span class="hs-special">(</span><a href="Matrix.Internal.html#Count"><span class="hs-identifier hs-type">Count</span></a><span> </span><a href="#local-6989586621679038256"><span class="hs-identifier hs-type">c</span></a><span class="hs-special">)</span><span class="hs-special">)</span><span class="hs-special">)</span><span>
339+</span><a name="line-339"></a><span> </span><a name="local-6989586621679038263"><a href="#local-6989586621679038263"><span class="hs-identifier">condition</span></a></a><span> </span><span class="hs-glyph">=</span><span> </span><span class="hs-identifier hs-var">all</span><span> </span><span class="hs-special">(</span><span class="hs-operator hs-var">==</span><span> </span><a href="#local-6989586621679038261"><span class="hs-identifier hs-var">lh</span></a><span class="hs-special">)</span><span> </span><span class="hs-special">(</span><span class="hs-identifier hs-var">map</span><span> </span><span class="hs-identifier hs-var">length</span><span> </span><a href="#local-6989586621679038260"><span class="hs-identifier hs-var">t</span></a><span class="hs-special">)</span><span>
340+</span><a name="line-340"></a><span> </span><span class="hs-keyword">in</span><span> </span><span class="hs-keyword">if</span><span> </span><a href="#local-6989586621679038261"><span class="hs-identifier hs-var">lh</span></a><span> </span><span class="hs-operator hs-var">&gt;</span><span> </span><span class="hs-number">0</span><span> </span><span class="hs-operator hs-var">&amp;&amp;</span><span> </span><a href="#local-6989586621679038263"><span class="hs-identifier hs-var">condition</span></a><span>
341+</span><a name="line-341"></a><span> </span><span class="hs-keyword">then</span><span> </span><a href="Matrix.Internal.html#Split"><span class="hs-identifier hs-var">Split</span></a><span> </span><span class="hs-special">(</span><a href="Matrix.Internal.html#fromLists"><span class="hs-identifier hs-var">fromLists</span></a><span> </span><span class="hs-special">(</span><span class="hs-identifier hs-var">take</span><span> </span><a href="#local-6989586621679038262"><span class="hs-identifier hs-var">rowsC</span></a><span> </span><a href="#local-6989586621679038258"><span class="hs-identifier hs-var">l</span></a><span class="hs-special">)</span><span class="hs-special">)</span><span> </span><span class="hs-special">(</span><a href="Matrix.Internal.html#fromLists"><span class="hs-identifier hs-var">fromLists</span></a><span> </span><span class="hs-special">(</span><span class="hs-identifier hs-var">drop</span><span> </span><a href="#local-6989586621679038262"><span class="hs-identifier hs-var">rowsC</span></a><span> </span><a href="#local-6989586621679038258"><span class="hs-identifier hs-var">l</span></a><span class="hs-special">)</span><span class="hs-special">)</span><span>
342+</span><a name="line-342"></a><span> </span><span class="hs-keyword">else</span><span> </span><span class="hs-identifier hs-var">error</span><span> </span><span class="hs-string">&quot;Not all rows have the same length&quot;</span><span>
343+</span><a name="line-343"></a><span>
344+</span><a name="line-344"></a><span class="hs-comment">-- | Matrix builder function. Constructs a matrix provided with</span><span>
345+</span><a name="line-345"></a><span class="hs-comment">-- a construction function.</span><span>
346+</span><a name="line-346"></a><span class="hs-identifier">matrixBuilder</span><span> </span><span class="hs-glyph">::</span><span>
347+</span><a name="line-347"></a><span> </span><span class="hs-keyword">forall</span><span> </span><a name="local-6989586621679038692"><a href="#local-6989586621679038692"><span class="hs-identifier">e</span></a></a><span> </span><a name="local-6989586621679038693"><a href="#local-6989586621679038693"><span class="hs-identifier">cols</span></a></a><span> </span><a name="local-6989586621679038694"><a href="#local-6989586621679038694"><span class="hs-identifier">rows</span></a></a><span class="hs-operator">.</span><span>
348+</span><a name="line-348"></a><span> </span><span class="hs-special">(</span><span> </span><a href="Matrix.Internal.html#FromLists"><span class="hs-identifier hs-type">FromLists</span></a><span> </span><a href="#local-6989586621679038692"><span class="hs-identifier hs-type">e</span></a><span> </span><a href="#local-6989586621679038693"><span class="hs-identifier hs-type">cols</span></a><span> </span><a href="#local-6989586621679038694"><span class="hs-identifier hs-type">rows</span></a><span class="hs-special">,</span><span>
349+</span><a name="line-349"></a><span> </span><span class="hs-identifier hs-type">KnownNat</span><span> </span><span class="hs-special">(</span><a href="Matrix.Internal.html#Count"><span class="hs-identifier hs-type">Count</span></a><span> </span><a href="#local-6989586621679038693"><span class="hs-identifier hs-type">cols</span></a><span class="hs-special">)</span><span class="hs-special">,</span><span>
350+</span><a name="line-350"></a><span> </span><span class="hs-identifier hs-type">KnownNat</span><span> </span><span class="hs-special">(</span><a href="Matrix.Internal.html#Count"><span class="hs-identifier hs-type">Count</span></a><span> </span><a href="#local-6989586621679038694"><span class="hs-identifier hs-type">rows</span></a><span class="hs-special">)</span><span>
351+</span><a name="line-351"></a><span> </span><span class="hs-special">)</span><span> </span><span class="hs-glyph">=&gt;</span><span>
352+</span><a name="line-352"></a><span> </span><span class="hs-special">(</span><span class="hs-special">(</span><span class="hs-identifier hs-type">Int</span><span class="hs-special">,</span><span> </span><span class="hs-identifier hs-type">Int</span><span class="hs-special">)</span><span> </span><span class="hs-glyph">-&gt;</span><span> </span><a href="#local-6989586621679038692"><span class="hs-identifier hs-type">e</span></a><span class="hs-special">)</span><span> </span><span class="hs-glyph">-&gt;</span><span>
353+</span><a name="line-353"></a><span> </span><a href="Matrix.Internal.html#Matrix"><span class="hs-identifier hs-type">Matrix</span></a><span> </span><a href="#local-6989586621679038692"><span class="hs-identifier hs-type">e</span></a><span> </span><a href="#local-6989586621679038693"><span class="hs-identifier hs-type">cols</span></a><span> </span><a href="#local-6989586621679038694"><span class="hs-identifier hs-type">rows</span></a><span>
354+</span><a name="line-354"></a><a name="matrixBuilder"><a href="Matrix.Internal.html#matrixBuilder"><span class="hs-identifier">matrixBuilder</span></a></a><span> </span><a name="local-6989586621679038713"><a href="#local-6989586621679038713"><span class="hs-identifier">f</span></a></a><span> </span><span class="hs-glyph">=</span><span>
355+</span><a name="line-355"></a><span> </span><span class="hs-keyword">let</span><span> </span><a name="local-6989586621679038714"><a href="#local-6989586621679038714"><span class="hs-identifier">c</span></a></a><span> </span><span class="hs-glyph">=</span><span> </span><span class="hs-identifier hs-var">fromInteger</span><span> </span><span class="hs-operator hs-var">$</span><span> </span><span class="hs-identifier hs-var">natVal</span><span> </span><span class="hs-special">(</span><span class="hs-identifier hs-var">Proxy</span><span> </span><span class="hs-glyph">::</span><span> </span><span class="hs-identifier hs-type">Proxy</span><span> </span><span class="hs-special">(</span><a href="Matrix.Internal.html#Count"><span class="hs-identifier hs-type">Count</span></a><span> </span><a href="#local-6989586621679038693"><span class="hs-identifier hs-type">cols</span></a><span class="hs-special">)</span><span class="hs-special">)</span><span>
356+</span><a name="line-356"></a><span> </span><a name="local-6989586621679038715"><a href="#local-6989586621679038715"><span class="hs-identifier">r</span></a></a><span> </span><span class="hs-glyph">=</span><span> </span><span class="hs-identifier hs-var">fromInteger</span><span> </span><span class="hs-operator hs-var">$</span><span> </span><span class="hs-identifier hs-var">natVal</span><span> </span><span class="hs-special">(</span><span class="hs-identifier hs-var">Proxy</span><span> </span><span class="hs-glyph">::</span><span> </span><span class="hs-identifier hs-type">Proxy</span><span> </span><span class="hs-special">(</span><a href="Matrix.Internal.html#Count"><span class="hs-identifier hs-type">Count</span></a><span> </span><a href="#local-6989586621679038694"><span class="hs-identifier hs-type">rows</span></a><span class="hs-special">)</span><span class="hs-special">)</span><span>
357+</span><a name="line-357"></a><span> </span><a name="local-6989586621679038716"><a href="#local-6989586621679038716"><span class="hs-identifier">positions</span></a></a><span> </span><span class="hs-glyph">=</span><span> </span><span class="hs-special">[</span><span class="hs-special">(</span><a href="#local-6989586621679038717"><span class="hs-identifier hs-var">a</span></a><span class="hs-special">,</span><span> </span><a href="#local-6989586621679038718"><span class="hs-identifier hs-var">b</span></a><span class="hs-special">)</span><span> </span><span class="hs-glyph">|</span><span> </span><a name="local-6989586621679038717"><a href="#local-6989586621679038717"><span class="hs-identifier">a</span></a></a><span> </span><span class="hs-glyph">&lt;-</span><span> </span><span class="hs-special">[</span><span class="hs-number">0</span><span> </span><span class="hs-glyph">..</span><span> </span><span class="hs-special">(</span><a href="#local-6989586621679038715"><span class="hs-identifier hs-var">r</span></a><span> </span><span class="hs-glyph">-</span><span> </span><span class="hs-number">1</span><span class="hs-special">)</span><span class="hs-special">]</span><span class="hs-special">,</span><span> </span><a name="local-6989586621679038718"><a href="#local-6989586621679038718"><span class="hs-identifier">b</span></a></a><span> </span><span class="hs-glyph">&lt;-</span><span> </span><span class="hs-special">[</span><span class="hs-number">0</span><span> </span><span class="hs-glyph">..</span><span> </span><span class="hs-special">(</span><a href="#local-6989586621679038714"><span class="hs-identifier hs-var">c</span></a><span> </span><span class="hs-glyph">-</span><span> </span><span class="hs-number">1</span><span class="hs-special">)</span><span class="hs-special">]</span><span class="hs-special">]</span><span>
358+</span><a name="line-358"></a><span> </span><span class="hs-keyword">in</span><span> </span><a href="Matrix.Internal.html#fromLists"><span class="hs-identifier hs-var">fromLists</span></a><span> </span><span class="hs-operator hs-var">.</span><span> </span><span class="hs-identifier hs-var">map</span><span> </span><span class="hs-special">(</span><span class="hs-identifier hs-var">map</span><span> </span><a href="#local-6989586621679038713"><span class="hs-identifier hs-var">f</span></a><span class="hs-special">)</span><span> </span><span class="hs-operator hs-var">.</span><span> </span><span class="hs-identifier hs-var">groupBy</span><span> </span><span class="hs-special">(</span><span class="hs-glyph">\</span><span class="hs-special">(</span><a name="local-6989586621679038874"><a href="#local-6989586621679038874"><span class="hs-identifier">x</span></a></a><span class="hs-special">,</span><span> </span><span class="hs-identifier">_</span><span class="hs-special">)</span><span> </span><span class="hs-special">(</span><a name="local-6989586621679038875"><a href="#local-6989586621679038875"><span class="hs-identifier">w</span></a></a><span class="hs-special">,</span><span> </span><span class="hs-identifier">_</span><span class="hs-special">)</span><span> </span><span class="hs-glyph">-&gt;</span><span> </span><a href="#local-6989586621679038874"><span class="hs-identifier hs-var">x</span></a><span> </span><span class="hs-operator hs-var">==</span><span> </span><a href="#local-6989586621679038875"><span class="hs-identifier hs-var">w</span></a><span class="hs-special">)</span><span> </span><span class="hs-operator hs-var">$</span><span> </span><a href="#local-6989586621679038716"><span class="hs-identifier hs-var">positions</span></a><span>
359+</span><a name="line-359"></a><span>
360+</span><a name="line-360"></a><span class="hs-comment">-- | Constructs a column vector matrix</span><span>
361+</span><a name="line-361"></a><span class="hs-identifier">col</span><span> </span><span class="hs-glyph">::</span><span> </span><span class="hs-special">(</span><a href="Matrix.Internal.html#FromLists"><span class="hs-identifier hs-type">FromLists</span></a><span> </span><a href="#local-6989586621679038690"><span class="hs-identifier hs-type">e</span></a><span> </span><span class="hs-special">(</span><span class="hs-special">)</span><span> </span><a href="#local-6989586621679038691"><span class="hs-identifier hs-type">rows</span></a><span class="hs-special">)</span><span> </span><span class="hs-glyph">=&gt;</span><span> </span><span class="hs-special">[</span><a href="#local-6989586621679038690"><span class="hs-identifier hs-type">e</span></a><span class="hs-special">]</span><span> </span><span class="hs-glyph">-&gt;</span><span> </span><a href="Matrix.Internal.html#Matrix"><span class="hs-identifier hs-type">Matrix</span></a><span> </span><a href="#local-6989586621679038690"><span class="hs-identifier hs-type">e</span></a><span> </span><span class="hs-special">(</span><span class="hs-special">)</span><span> </span><a href="#local-6989586621679038691"><span class="hs-identifier hs-type">rows</span></a><span>
362+</span><a name="line-362"></a><a name="col"><a href="Matrix.Internal.html#col"><span class="hs-identifier">col</span></a></a><span> </span><span class="hs-glyph">=</span><span> </span><a href="Matrix.Internal.html#fromLists"><span class="hs-identifier hs-var">fromLists</span></a><span> </span><span class="hs-operator hs-var">.</span><span> </span><span class="hs-identifier hs-var">map</span><span> </span><span class="hs-special">(</span><span class="hs-glyph">:</span><span> </span><span class="hs-special">[</span><span class="hs-special">]</span><span class="hs-special">)</span><span>
363+</span><a name="line-363"></a><span>
364+</span><a name="line-364"></a><span class="hs-comment">-- | Constructs a row vector matrix</span><span>
365+</span><a name="line-365"></a><span class="hs-identifier">row</span><span> </span><span class="hs-glyph">::</span><span> </span><span class="hs-special">(</span><a href="Matrix.Internal.html#FromLists"><span class="hs-identifier hs-type">FromLists</span></a><span> </span><a href="#local-6989586621679038688"><span class="hs-identifier hs-type">e</span></a><span> </span><a href="#local-6989586621679038689"><span class="hs-identifier hs-type">cols</span></a><span> </span><span class="hs-special">(</span><span class="hs-special">)</span><span class="hs-special">)</span><span> </span><span class="hs-glyph">=&gt;</span><span> </span><span class="hs-special">[</span><a href="#local-6989586621679038688"><span class="hs-identifier hs-type">e</span></a><span class="hs-special">]</span><span> </span><span class="hs-glyph">-&gt;</span><span> </span><a href="Matrix.Internal.html#Matrix"><span class="hs-identifier hs-type">Matrix</span></a><span> </span><a href="#local-6989586621679038688"><span class="hs-identifier hs-type">e</span></a><span> </span><a href="#local-6989586621679038689"><span class="hs-identifier hs-type">cols</span></a><span> </span><span class="hs-special">(</span><span class="hs-special">)</span><span>
366+</span><a name="line-366"></a><a name="row"><a href="Matrix.Internal.html#row"><span class="hs-identifier">row</span></a></a><span> </span><span class="hs-glyph">=</span><span> </span><a href="Matrix.Internal.html#fromLists"><span class="hs-identifier hs-var">fromLists</span></a><span> </span><span class="hs-operator hs-var">.</span><span> </span><span class="hs-special">(</span><span class="hs-glyph">:</span><span> </span><span class="hs-special">[</span><span class="hs-special">]</span><span class="hs-special">)</span><span>
367+</span><a name="line-367"></a><span>
368+</span><a name="line-368"></a><span class="hs-comment">-- | Lifts functions to matrices with arbitrary dimensions.</span><span>
369+</span><a name="line-369"></a><span class="hs-comment">--</span><span>
370+</span><a name="line-370"></a><span class="hs-comment">-- NOTE: Be careful to not ask for a matrix bigger than the cardinality of</span><span>
371+</span><a name="line-371"></a><span class="hs-comment">-- types @a@ or @b@ allows.</span><span>
372+</span><a name="line-372"></a><span class="hs-identifier">fromF</span><span> </span><span class="hs-glyph">::</span><span>
373+</span><a name="line-373"></a><span> </span><span class="hs-keyword">forall</span><span> </span><a name="local-6989586621679038683"><a href="#local-6989586621679038683"><span class="hs-identifier">a</span></a></a><span> </span><a name="local-6989586621679038684"><a href="#local-6989586621679038684"><span class="hs-identifier">b</span></a></a><span> </span><a name="local-6989586621679038685"><a href="#local-6989586621679038685"><span class="hs-identifier">cols</span></a></a><span> </span><a name="local-6989586621679038686"><a href="#local-6989586621679038686"><span class="hs-identifier">rows</span></a></a><span> </span><a name="local-6989586621679038687"><a href="#local-6989586621679038687"><span class="hs-identifier">e</span></a></a><span class="hs-operator">.</span><span>
374+</span><a name="line-374"></a><span> </span><span class="hs-special">(</span><span> </span><span class="hs-identifier hs-type">Bounded</span><span> </span><a href="#local-6989586621679038683"><span class="hs-identifier hs-type">a</span></a><span class="hs-special">,</span><span>
375+</span><a name="line-375"></a><span> </span><span class="hs-identifier hs-type">Bounded</span><span> </span><a href="#local-6989586621679038684"><span class="hs-identifier hs-type">b</span></a><span class="hs-special">,</span><span>
376+</span><a name="line-376"></a><span> </span><span class="hs-identifier hs-type">Enum</span><span> </span><a href="#local-6989586621679038683"><span class="hs-identifier hs-type">a</span></a><span class="hs-special">,</span><span>
377+</span><a name="line-377"></a><span> </span><span class="hs-identifier hs-type">Enum</span><span> </span><a href="#local-6989586621679038684"><span class="hs-identifier hs-type">b</span></a><span class="hs-special">,</span><span>
378+</span><a name="line-378"></a><span> </span><span class="hs-identifier hs-type">Eq</span><span> </span><a href="#local-6989586621679038684"><span class="hs-identifier hs-type">b</span></a><span class="hs-special">,</span><span>
379+</span><a name="line-379"></a><span> </span><span class="hs-identifier hs-type">Num</span><span> </span><a href="#local-6989586621679038687"><span class="hs-identifier hs-type">e</span></a><span class="hs-special">,</span><span>
380+</span><a name="line-380"></a><span> </span><span class="hs-identifier hs-type">Ord</span><span> </span><a href="#local-6989586621679038687"><span class="hs-identifier hs-type">e</span></a><span class="hs-special">,</span><span>
381+</span><a name="line-381"></a><span> </span><span class="hs-identifier hs-type">KnownNat</span><span> </span><span class="hs-special">(</span><a href="Matrix.Internal.html#Count"><span class="hs-identifier hs-type">Count</span></a><span> </span><a href="#local-6989586621679038685"><span class="hs-identifier hs-type">cols</span></a><span class="hs-special">)</span><span class="hs-special">,</span><span>
382+</span><a name="line-382"></a><span> </span><span class="hs-identifier hs-type">KnownNat</span><span> </span><span class="hs-special">(</span><a href="Matrix.Internal.html#Count"><span class="hs-identifier hs-type">Count</span></a><span> </span><a href="#local-6989586621679038686"><span class="hs-identifier hs-type">rows</span></a><span class="hs-special">)</span><span class="hs-special">,</span><span>
383+</span><a name="line-383"></a><span> </span><a href="Matrix.Internal.html#FromLists"><span class="hs-identifier hs-type">FromLists</span></a><span> </span><a href="#local-6989586621679038687"><span class="hs-identifier hs-type">e</span></a><span> </span><a href="#local-6989586621679038686"><span class="hs-identifier hs-type">rows</span></a><span> </span><a href="#local-6989586621679038685"><span class="hs-identifier hs-type">cols</span></a><span>
384+</span><a name="line-384"></a><span> </span><span class="hs-special">)</span><span> </span><span class="hs-glyph">=&gt;</span><span>
385+</span><a name="line-385"></a><span> </span><span class="hs-special">(</span><a href="#local-6989586621679038683"><span class="hs-identifier hs-type">a</span></a><span> </span><span class="hs-glyph">-&gt;</span><span> </span><a href="#local-6989586621679038684"><span class="hs-identifier hs-type">b</span></a><span class="hs-special">)</span><span> </span><span class="hs-glyph">-&gt;</span><span>
386+</span><a name="line-386"></a><span> </span><a href="Matrix.Internal.html#Matrix"><span class="hs-identifier hs-type">Matrix</span></a><span> </span><a href="#local-6989586621679038687"><span class="hs-identifier hs-type">e</span></a><span> </span><a href="#local-6989586621679038685"><span class="hs-identifier hs-type">cols</span></a><span> </span><a href="#local-6989586621679038686"><span class="hs-identifier hs-type">rows</span></a><span>
387+</span><a name="line-387"></a><a name="fromF"><a href="Matrix.Internal.html#fromF"><span class="hs-identifier">fromF</span></a></a><span> </span><a name="local-6989586621679038876"><a href="#local-6989586621679038876"><span class="hs-identifier">f</span></a></a><span> </span><span class="hs-glyph">=</span><span>
388+</span><a name="line-388"></a><span> </span><span class="hs-keyword">let</span><span> </span><a name="local-6989586621679038880"><a href="#local-6989586621679038880"><span class="hs-identifier">minA</span></a></a><span> </span><span class="hs-glyph">=</span><span> </span><span class="hs-identifier hs-var">minBound</span><span> </span><span class="hs-glyph">@</span><a href="#local-6989586621679038683"><span class="hs-identifier hs-type">a</span></a><span>
389+</span><a name="line-389"></a><span> </span><a name="local-6989586621679038881"><a href="#local-6989586621679038881"><span class="hs-identifier">maxA</span></a></a><span> </span><span class="hs-glyph">=</span><span> </span><span class="hs-identifier hs-var">maxBound</span><span> </span><span class="hs-glyph">@</span><a href="#local-6989586621679038683"><span class="hs-identifier hs-type">a</span></a><span>
390+</span><a name="line-390"></a><span> </span><a name="local-6989586621679038882"><a href="#local-6989586621679038882"><span class="hs-identifier">minB</span></a></a><span> </span><span class="hs-glyph">=</span><span> </span><span class="hs-identifier hs-var">minBound</span><span> </span><span class="hs-glyph">@</span><a href="#local-6989586621679038684"><span class="hs-identifier hs-type">b</span></a><span>
391+</span><a name="line-391"></a><span> </span><a name="local-6989586621679038883"><a href="#local-6989586621679038883"><span class="hs-identifier">maxB</span></a></a><span> </span><span class="hs-glyph">=</span><span> </span><span class="hs-identifier hs-var">maxBound</span><span> </span><span class="hs-glyph">@</span><a href="#local-6989586621679038684"><span class="hs-identifier hs-type">b</span></a><span>
392+</span><a name="line-392"></a><span> </span><a name="local-6989586621679038884"><a href="#local-6989586621679038884"><span class="hs-identifier">ccols</span></a></a><span> </span><span class="hs-glyph">=</span><span> </span><span class="hs-identifier hs-var">fromInteger</span><span> </span><span class="hs-operator hs-var">$</span><span> </span><span class="hs-identifier hs-var">natVal</span><span> </span><span class="hs-special">(</span><span class="hs-identifier hs-var">Proxy</span><span> </span><span class="hs-glyph">::</span><span> </span><span class="hs-identifier hs-type">Proxy</span><span> </span><span class="hs-special">(</span><a href="Matrix.Internal.html#Count"><span class="hs-identifier hs-type">Count</span></a><span> </span><a href="#local-6989586621679038685"><span class="hs-identifier hs-type">cols</span></a><span class="hs-special">)</span><span class="hs-special">)</span><span>
393+</span><a name="line-393"></a><span> </span><a name="local-6989586621679038885"><a href="#local-6989586621679038885"><span class="hs-identifier">rrows</span></a></a><span> </span><span class="hs-glyph">=</span><span> </span><span class="hs-identifier hs-var">fromInteger</span><span> </span><span class="hs-operator hs-var">$</span><span> </span><span class="hs-identifier hs-var">natVal</span><span> </span><span class="hs-special">(</span><span class="hs-identifier hs-var">Proxy</span><span> </span><span class="hs-glyph">::</span><span> </span><span class="hs-identifier hs-type">Proxy</span><span> </span><span class="hs-special">(</span><a href="Matrix.Internal.html#Count"><span class="hs-identifier hs-type">Count</span></a><span> </span><a href="#local-6989586621679038686"><span class="hs-identifier hs-type">rows</span></a><span class="hs-special">)</span><span class="hs-special">)</span><span>
394+</span><a name="line-394"></a><span> </span><a name="local-6989586621679038886"><a href="#local-6989586621679038886"><span class="hs-identifier">elementsA</span></a></a><span> </span><span class="hs-glyph">=</span><span> </span><span class="hs-identifier hs-var">take</span><span> </span><a href="#local-6989586621679038884"><span class="hs-identifier hs-var">ccols</span></a><span> </span><span class="hs-special">[</span><a href="#local-6989586621679038880"><span class="hs-identifier hs-var">minA</span></a><span> </span><span class="hs-glyph">..</span><span> </span><a href="#local-6989586621679038881"><span class="hs-identifier hs-var">maxA</span></a><span class="hs-special">]</span><span>
395+</span><a name="line-395"></a><span> </span><a name="local-6989586621679038887"><a href="#local-6989586621679038887"><span class="hs-identifier">elementsB</span></a></a><span> </span><span class="hs-glyph">=</span><span> </span><span class="hs-identifier hs-var">take</span><span> </span><a href="#local-6989586621679038885"><span class="hs-identifier hs-var">rrows</span></a><span> </span><span class="hs-special">[</span><a href="#local-6989586621679038882"><span class="hs-identifier hs-var">minB</span></a><span> </span><span class="hs-glyph">..</span><span> </span><a href="#local-6989586621679038883"><span class="hs-identifier hs-var">maxB</span></a><span class="hs-special">]</span><span>
396+</span><a name="line-396"></a><span> </span><a name="local-6989586621679038888"><a href="#local-6989586621679038888"><span class="hs-identifier">combinations</span></a></a><span> </span><span class="hs-glyph">=</span><span> </span><span class="hs-special">(</span><span class="hs-special">,</span><span class="hs-special">)</span><span> </span><span class="hs-operator hs-var">&lt;$&gt;</span><span> </span><a href="#local-6989586621679038886"><span class="hs-identifier hs-var">elementsA</span></a><span> </span><span class="hs-operator hs-var">&lt;*&gt;</span><span> </span><a href="#local-6989586621679038887"><span class="hs-identifier hs-var">elementsB</span></a><span>
397+</span><a name="line-397"></a><span> </span><a name="local-6989586621679038889"><a href="#local-6989586621679038889"><span class="hs-identifier">combAp</span></a></a><span> </span><span class="hs-glyph">=</span><span> </span><span class="hs-identifier hs-var">map</span><span> </span><span class="hs-identifier hs-var">snd</span><span> </span><span class="hs-operator hs-var">.</span><span> </span><span class="hs-identifier hs-var">sort</span><span> </span><span class="hs-operator hs-var">.</span><span> </span><span class="hs-identifier hs-var">map</span><span> </span><span class="hs-special">(</span><span class="hs-glyph">\</span><span class="hs-special">(</span><a name="local-6989586621679038920"><a href="#local-6989586621679038920"><span class="hs-identifier">a</span></a></a><span class="hs-special">,</span><span> </span><a name="local-6989586621679038921"><a href="#local-6989586621679038921"><span class="hs-identifier">b</span></a></a><span class="hs-special">)</span><span> </span><span class="hs-glyph">-&gt;</span><span> </span><span class="hs-keyword">if</span><span> </span><a href="#local-6989586621679038876"><span class="hs-identifier hs-var">f</span></a><span> </span><a href="#local-6989586621679038920"><span class="hs-identifier hs-var">a</span></a><span> </span><span class="hs-operator hs-var">==</span><span> </span><a href="#local-6989586621679038921"><span class="hs-identifier hs-var">b</span></a><span>
398+</span><a name="line-398"></a><span> </span><span class="hs-keyword">then</span><span> </span><span class="hs-special">(</span><span class="hs-special">(</span><span class="hs-identifier hs-var">fromEnum</span><span> </span><a href="#local-6989586621679038920"><span class="hs-identifier hs-var">a</span></a><span class="hs-special">,</span><span> </span><span class="hs-identifier hs-var">fromEnum</span><span> </span><a href="#local-6989586621679038921"><span class="hs-identifier hs-var">b</span></a><span class="hs-special">)</span><span class="hs-special">,</span><span> </span><span class="hs-number">1</span><span class="hs-special">)</span><span>
399+</span><a name="line-399"></a><span> </span><span class="hs-keyword">else</span><span> </span><span class="hs-special">(</span><span class="hs-special">(</span><span class="hs-identifier hs-var">fromEnum</span><span> </span><a href="#local-6989586621679038920"><span class="hs-identifier hs-var">a</span></a><span class="hs-special">,</span><span> </span><span class="hs-identifier hs-var">fromEnum</span><span> </span><a href="#local-6989586621679038921"><span class="hs-identifier hs-var">b</span></a><span class="hs-special">)</span><span class="hs-special">,</span><span> </span><span class="hs-number">0</span><span class="hs-special">)</span><span class="hs-special">)</span><span> </span><span class="hs-operator hs-var">$</span><span> </span><a href="#local-6989586621679038888"><span class="hs-identifier hs-var">combinations</span></a><span>
400+</span><a name="line-400"></a><span> </span><a name="local-6989586621679038890"><a href="#local-6989586621679038890"><span class="hs-identifier">mList</span></a></a><span> </span><span class="hs-glyph">=</span><span> </span><a href="#local-6989586621679038877"><span class="hs-identifier hs-var">buildList</span></a><span> </span><a href="#local-6989586621679038889"><span class="hs-identifier hs-var">combAp</span></a><span> </span><a href="#local-6989586621679038885"><span class="hs-identifier hs-var">rrows</span></a><span>
401+</span><a name="line-401"></a><span> </span><span class="hs-keyword">in</span><span> </span><a href="Matrix.Internal.html#tr"><span class="hs-identifier hs-var">tr</span></a><span> </span><span class="hs-operator hs-var">$</span><span> </span><a href="Matrix.Internal.html#fromLists"><span class="hs-identifier hs-var">fromLists</span></a><span> </span><a href="#local-6989586621679038890"><span class="hs-identifier hs-var">mList</span></a><span>
402+</span><a name="line-402"></a><span> </span><span class="hs-keyword">where</span><span>
403+</span><a name="line-403"></a><span> </span><a name="local-6989586621679038877"><a href="#local-6989586621679038877"><span class="hs-identifier">buildList</span></a></a><span> </span><span class="hs-special">[</span><span class="hs-special">]</span><span> </span><span class="hs-identifier">_</span><span> </span><span class="hs-glyph">=</span><span> </span><span class="hs-special">[</span><span class="hs-special">]</span><span>
404+</span><a name="line-404"></a><span> </span><span class="hs-identifier">buildList</span><span> </span><a name="local-6989586621679038878"><a href="#local-6989586621679038878"><span class="hs-identifier">l</span></a></a><span> </span><a name="local-6989586621679038879"><a href="#local-6989586621679038879"><span class="hs-identifier">r</span></a></a><span> </span><span class="hs-glyph">=</span><span> </span><span class="hs-identifier hs-var">take</span><span> </span><a href="#local-6989586621679038879"><span class="hs-identifier hs-var">r</span></a><span> </span><a href="#local-6989586621679038878"><span class="hs-identifier hs-var">l</span></a><span> </span><span class="hs-glyph">:</span><span> </span><a href="#local-6989586621679038877"><span class="hs-identifier hs-var">buildList</span></a><span> </span><span class="hs-special">(</span><span class="hs-identifier hs-var">drop</span><span> </span><a href="#local-6989586621679038879"><span class="hs-identifier hs-var">r</span></a><span> </span><a href="#local-6989586621679038878"><span class="hs-identifier hs-var">l</span></a><span class="hs-special">)</span><span> </span><a href="#local-6989586621679038879"><span class="hs-identifier hs-var">r</span></a><span>
405+</span><a name="line-405"></a><span>
406+</span><a name="line-406"></a><span class="hs-comment">-- | Lifts functions to matrices with dimensions matching @a@ and @b@</span><span>
407+</span><a name="line-407"></a><span class="hs-comment">-- cardinality's.</span><span>
408+</span><a name="line-408"></a><span class="hs-identifier">fromF'</span><span> </span><span class="hs-glyph">::</span><span>
409+</span><a name="line-409"></a><span> </span><span class="hs-keyword">forall</span><span> </span><a name="local-6989586621679038680"><a href="#local-6989586621679038680"><span class="hs-identifier">a</span></a></a><span> </span><a name="local-6989586621679038681"><a href="#local-6989586621679038681"><span class="hs-identifier">b</span></a></a><span> </span><a name="local-6989586621679038682"><a href="#local-6989586621679038682"><span class="hs-identifier">e</span></a></a><span class="hs-operator">.</span><span>
410+</span><a name="line-410"></a><span> </span><span class="hs-special">(</span><span> </span><span class="hs-identifier hs-type">Bounded</span><span> </span><a href="#local-6989586621679038680"><span class="hs-identifier hs-type">a</span></a><span class="hs-special">,</span><span>
411+</span><a name="line-411"></a><span> </span><span class="hs-identifier hs-type">Bounded</span><span> </span><a href="#local-6989586621679038681"><span class="hs-identifier hs-type">b</span></a><span class="hs-special">,</span><span>
412+</span><a name="line-412"></a><span> </span><span class="hs-identifier hs-type">Enum</span><span> </span><a href="#local-6989586621679038680"><span class="hs-identifier hs-type">a</span></a><span class="hs-special">,</span><span>
413+</span><a name="line-413"></a><span> </span><span class="hs-identifier hs-type">Enum</span><span> </span><a href="#local-6989586621679038681"><span class="hs-identifier hs-type">b</span></a><span class="hs-special">,</span><span>
414+</span><a name="line-414"></a><span> </span><span class="hs-identifier hs-type">Eq</span><span> </span><a href="#local-6989586621679038681"><span class="hs-identifier hs-type">b</span></a><span class="hs-special">,</span><span>
415+</span><a name="line-415"></a><span> </span><span class="hs-identifier hs-type">Num</span><span> </span><a href="#local-6989586621679038682"><span class="hs-identifier hs-type">e</span></a><span class="hs-special">,</span><span>
416+</span><a name="line-416"></a><span> </span><span class="hs-identifier hs-type">Ord</span><span> </span><a href="#local-6989586621679038682"><span class="hs-identifier hs-type">e</span></a><span class="hs-special">,</span><span>
417+</span><a name="line-417"></a><span> </span><span class="hs-identifier hs-type">KnownNat</span><span> </span><span class="hs-special">(</span><a href="Matrix.Internal.html#Count"><span class="hs-identifier hs-type">Count</span></a><span> </span><span class="hs-special">(</span><a href="Matrix.Internal.html#Normalize"><span class="hs-identifier hs-type">Normalize</span></a><span> </span><a href="#local-6989586621679038680"><span class="hs-identifier hs-type">a</span></a><span class="hs-special">)</span><span class="hs-special">)</span><span class="hs-special">,</span><span>
418+</span><a name="line-418"></a><span> </span><span class="hs-identifier hs-type">KnownNat</span><span> </span><span class="hs-special">(</span><a href="Matrix.Internal.html#Count"><span class="hs-identifier hs-type">Count</span></a><span> </span><span class="hs-special">(</span><a href="Matrix.Internal.html#Normalize"><span class="hs-identifier hs-type">Normalize</span></a><span> </span><a href="#local-6989586621679038681"><span class="hs-identifier hs-type">b</span></a><span class="hs-special">)</span><span class="hs-special">)</span><span class="hs-special">,</span><span>
419+</span><a name="line-419"></a><span> </span><a href="Matrix.Internal.html#FromLists"><span class="hs-identifier hs-type">FromLists</span></a><span> </span><a href="#local-6989586621679038682"><span class="hs-identifier hs-type">e</span></a><span> </span><span class="hs-special">(</span><a href="Matrix.Internal.html#Normalize"><span class="hs-identifier hs-type">Normalize</span></a><span> </span><a href="#local-6989586621679038681"><span class="hs-identifier hs-type">b</span></a><span class="hs-special">)</span><span> </span><span class="hs-special">(</span><a href="Matrix.Internal.html#Normalize"><span class="hs-identifier hs-type">Normalize</span></a><span> </span><a href="#local-6989586621679038680"><span class="hs-identifier hs-type">a</span></a><span class="hs-special">)</span><span>
420+</span><a name="line-420"></a><span> </span><span class="hs-special">)</span><span> </span><span class="hs-glyph">=&gt;</span><span>
421+</span><a name="line-421"></a><span> </span><span class="hs-special">(</span><a href="#local-6989586621679038680"><span class="hs-identifier hs-type">a</span></a><span> </span><span class="hs-glyph">-&gt;</span><span> </span><a href="#local-6989586621679038681"><span class="hs-identifier hs-type">b</span></a><span class="hs-special">)</span><span> </span><span class="hs-glyph">-&gt;</span><span>
422+</span><a name="line-422"></a><span> </span><a href="Matrix.Internal.html#Matrix"><span class="hs-identifier hs-type">Matrix</span></a><span> </span><a href="#local-6989586621679038682"><span class="hs-identifier hs-type">e</span></a><span> </span><span class="hs-special">(</span><a href="Matrix.Internal.html#Normalize"><span class="hs-identifier hs-type">Normalize</span></a><span> </span><a href="#local-6989586621679038680"><span class="hs-identifier hs-type">a</span></a><span class="hs-special">)</span><span> </span><span class="hs-special">(</span><a href="Matrix.Internal.html#Normalize"><span class="hs-identifier hs-type">Normalize</span></a><span> </span><a href="#local-6989586621679038681"><span class="hs-identifier hs-type">b</span></a><span class="hs-special">)</span><span>
423+</span><a name="line-423"></a><a name="fromF%27"><a href="Matrix.Internal.html#fromF%27"><span class="hs-identifier">fromF'</span></a></a><span> </span><a name="local-6989586621679038922"><a href="#local-6989586621679038922"><span class="hs-identifier">f</span></a></a><span> </span><span class="hs-glyph">=</span><span>
424+</span><a name="line-424"></a><span> </span><span class="hs-keyword">let</span><span> </span><a name="local-6989586621679038926"><a href="#local-6989586621679038926"><span class="hs-identifier">minA</span></a></a><span> </span><span class="hs-glyph">=</span><span> </span><span class="hs-identifier hs-var">minBound</span><span> </span><span class="hs-glyph">@</span><a href="#local-6989586621679038680"><span class="hs-identifier hs-type">a</span></a><span>
425+</span><a name="line-425"></a><span> </span><a name="local-6989586621679038927"><a href="#local-6989586621679038927"><span class="hs-identifier">maxA</span></a></a><span> </span><span class="hs-glyph">=</span><span> </span><span class="hs-identifier hs-var">maxBound</span><span> </span><span class="hs-glyph">@</span><a href="#local-6989586621679038680"><span class="hs-identifier hs-type">a</span></a><span>
426+</span><a name="line-426"></a><span> </span><a name="local-6989586621679038928"><a href="#local-6989586621679038928"><span class="hs-identifier">minB</span></a></a><span> </span><span class="hs-glyph">=</span><span> </span><span class="hs-identifier hs-var">minBound</span><span> </span><span class="hs-glyph">@</span><a href="#local-6989586621679038681"><span class="hs-identifier hs-type">b</span></a><span>
427+</span><a name="line-427"></a><span> </span><a name="local-6989586621679038929"><a href="#local-6989586621679038929"><span class="hs-identifier">maxB</span></a></a><span> </span><span class="hs-glyph">=</span><span> </span><span class="hs-identifier hs-var">maxBound</span><span> </span><span class="hs-glyph">@</span><a href="#local-6989586621679038681"><span class="hs-identifier hs-type">b</span></a><span>
428+</span><a name="line-428"></a><span> </span><a name="local-6989586621679038930"><a href="#local-6989586621679038930"><span class="hs-identifier">ccols</span></a></a><span> </span><span class="hs-glyph">=</span><span> </span><span class="hs-identifier hs-var">fromInteger</span><span> </span><span class="hs-operator hs-var">$</span><span> </span><span class="hs-identifier hs-var">natVal</span><span> </span><span class="hs-special">(</span><span class="hs-identifier hs-var">Proxy</span><span> </span><span class="hs-glyph">::</span><span> </span><span class="hs-identifier hs-type">Proxy</span><span> </span><span class="hs-special">(</span><a href="Matrix.Internal.html#Count"><span class="hs-identifier hs-type">Count</span></a><span> </span><span class="hs-special">(</span><a href="Matrix.Internal.html#Normalize"><span class="hs-identifier hs-type">Normalize</span></a><span> </span><a href="#local-6989586621679038680"><span class="hs-identifier hs-type">a</span></a><span class="hs-special">)</span><span class="hs-special">)</span><span class="hs-special">)</span><span>
429+</span><a name="line-429"></a><span> </span><a name="local-6989586621679038931"><a href="#local-6989586621679038931"><span class="hs-identifier">rrows</span></a></a><span> </span><span class="hs-glyph">=</span><span> </span><span class="hs-identifier hs-var">fromInteger</span><span> </span><span class="hs-operator hs-var">$</span><span> </span><span class="hs-identifier hs-var">natVal</span><span> </span><span class="hs-special">(</span><span class="hs-identifier hs-var">Proxy</span><span> </span><span class="hs-glyph">::</span><span> </span><span class="hs-identifier hs-type">Proxy</span><span> </span><span class="hs-special">(</span><a href="Matrix.Internal.html#Count"><span class="hs-identifier hs-type">Count</span></a><span> </span><span class="hs-special">(</span><a href="Matrix.Internal.html#Normalize"><span class="hs-identifier hs-type">Normalize</span></a><span> </span><a href="#local-6989586621679038681"><span class="hs-identifier hs-type">b</span></a><span class="hs-special">)</span><span class="hs-special">)</span><span class="hs-special">)</span><span>
430+</span><a name="line-430"></a><span> </span><a name="local-6989586621679038932"><a href="#local-6989586621679038932"><span class="hs-identifier">elementsA</span></a></a><span> </span><span class="hs-glyph">=</span><span> </span><span class="hs-identifier hs-var">take</span><span> </span><a href="#local-6989586621679038930"><span class="hs-identifier hs-var">ccols</span></a><span> </span><span class="hs-special">[</span><a href="#local-6989586621679038926"><span class="hs-identifier hs-var">minA</span></a><span> </span><span class="hs-glyph">..</span><span> </span><a href="#local-6989586621679038927"><span class="hs-identifier hs-var">maxA</span></a><span class="hs-special">]</span><span>
431+</span><a name="line-431"></a><span> </span><a name="local-6989586621679038933"><a href="#local-6989586621679038933"><span class="hs-identifier">elementsB</span></a></a><span> </span><span class="hs-glyph">=</span><span> </span><span class="hs-identifier hs-var">take</span><span> </span><a href="#local-6989586621679038931"><span class="hs-identifier hs-var">rrows</span></a><span> </span><span class="hs-special">[</span><a href="#local-6989586621679038928"><span class="hs-identifier hs-var">minB</span></a><span> </span><span class="hs-glyph">..</span><span> </span><a href="#local-6989586621679038929"><span class="hs-identifier hs-var">maxB</span></a><span class="hs-special">]</span><span>
432+</span><a name="line-432"></a><span> </span><a name="local-6989586621679038934"><a href="#local-6989586621679038934"><span class="hs-identifier">combinations</span></a></a><span> </span><span class="hs-glyph">=</span><span> </span><span class="hs-special">(</span><span class="hs-special">,</span><span class="hs-special">)</span><span> </span><span class="hs-operator hs-var">&lt;$&gt;</span><span> </span><a href="#local-6989586621679038932"><span class="hs-identifier hs-var">elementsA</span></a><span> </span><span class="hs-operator hs-var">&lt;*&gt;</span><span> </span><a href="#local-6989586621679038933"><span class="hs-identifier hs-var">elementsB</span></a><span>
433+</span><a name="line-433"></a><span> </span><a name="local-6989586621679038935"><a href="#local-6989586621679038935"><span class="hs-identifier">combAp</span></a></a><span> </span><span class="hs-glyph">=</span><span> </span><span class="hs-identifier hs-var">map</span><span> </span><span class="hs-identifier hs-var">snd</span><span> </span><span class="hs-operator hs-var">.</span><span> </span><span class="hs-identifier hs-var">sort</span><span> </span><span class="hs-operator hs-var">.</span><span> </span><span class="hs-identifier hs-var">map</span><span> </span><span class="hs-special">(</span><span class="hs-glyph">\</span><span class="hs-special">(</span><a name="local-6989586621679038937"><a href="#local-6989586621679038937"><span class="hs-identifier">a</span></a></a><span class="hs-special">,</span><span> </span><a name="local-6989586621679038938"><a href="#local-6989586621679038938"><span class="hs-identifier">b</span></a></a><span class="hs-special">)</span><span> </span><span class="hs-glyph">-&gt;</span><span> </span><span class="hs-keyword">if</span><span> </span><a href="#local-6989586621679038922"><span class="hs-identifier hs-var">f</span></a><span> </span><a href="#local-6989586621679038937"><span class="hs-identifier hs-var">a</span></a><span> </span><span class="hs-operator hs-var">==</span><span> </span><a href="#local-6989586621679038938"><span class="hs-identifier hs-var">b</span></a><span>
434+</span><a name="line-434"></a><span> </span><span class="hs-keyword">then</span><span> </span><span class="hs-special">(</span><span class="hs-special">(</span><span class="hs-identifier hs-var">fromEnum</span><span> </span><a href="#local-6989586621679038937"><span class="hs-identifier hs-var">a</span></a><span class="hs-special">,</span><span> </span><span class="hs-identifier hs-var">fromEnum</span><span> </span><a href="#local-6989586621679038938"><span class="hs-identifier hs-var">b</span></a><span class="hs-special">)</span><span class="hs-special">,</span><span> </span><span class="hs-number">1</span><span class="hs-special">)</span><span>
435+</span><a name="line-435"></a><span> </span><span class="hs-keyword">else</span><span> </span><span class="hs-special">(</span><span class="hs-special">(</span><span class="hs-identifier hs-var">fromEnum</span><span> </span><a href="#local-6989586621679038937"><span class="hs-identifier hs-var">a</span></a><span class="hs-special">,</span><span> </span><span class="hs-identifier hs-var">fromEnum</span><span> </span><a href="#local-6989586621679038938"><span class="hs-identifier hs-var">b</span></a><span class="hs-special">)</span><span class="hs-special">,</span><span> </span><span class="hs-number">0</span><span class="hs-special">)</span><span class="hs-special">)</span><span> </span><span class="hs-operator hs-var">$</span><span> </span><a href="#local-6989586621679038934"><span class="hs-identifier hs-var">combinations</span></a><span>
436+</span><a name="line-436"></a><span> </span><a name="local-6989586621679038936"><a href="#local-6989586621679038936"><span class="hs-identifier">mList</span></a></a><span> </span><span class="hs-glyph">=</span><span> </span><a href="#local-6989586621679038923"><span class="hs-identifier hs-var">buildList</span></a><span> </span><a href="#local-6989586621679038935"><span class="hs-identifier hs-var">combAp</span></a><span> </span><a href="#local-6989586621679038931"><span class="hs-identifier hs-var">rrows</span></a><span>
437+</span><a name="line-437"></a><span> </span><span class="hs-keyword">in</span><span> </span><a href="Matrix.Internal.html#tr"><span class="hs-identifier hs-var">tr</span></a><span> </span><span class="hs-operator hs-var">$</span><span> </span><a href="Matrix.Internal.html#fromLists"><span class="hs-identifier hs-var">fromLists</span></a><span> </span><a href="#local-6989586621679038936"><span class="hs-identifier hs-var">mList</span></a><span>
438+</span><a name="line-438"></a><span> </span><span class="hs-keyword">where</span><span>
439+</span><a name="line-439"></a><span> </span><a name="local-6989586621679038923"><a href="#local-6989586621679038923"><span class="hs-identifier">buildList</span></a></a><span> </span><span class="hs-special">[</span><span class="hs-special">]</span><span> </span><span class="hs-identifier">_</span><span> </span><span class="hs-glyph">=</span><span> </span><span class="hs-special">[</span><span class="hs-special">]</span><span>
440+</span><a name="line-440"></a><span> </span><span class="hs-identifier">buildList</span><span> </span><a name="local-6989586621679038924"><a href="#local-6989586621679038924"><span class="hs-identifier">l</span></a></a><span> </span><a name="local-6989586621679038925"><a href="#local-6989586621679038925"><span class="hs-identifier">r</span></a></a><span> </span><span class="hs-glyph">=</span><span> </span><span class="hs-identifier hs-var">take</span><span> </span><a href="#local-6989586621679038925"><span class="hs-identifier hs-var">r</span></a><span> </span><a href="#local-6989586621679038924"><span class="hs-identifier hs-var">l</span></a><span> </span><span class="hs-glyph">:</span><span> </span><a href="#local-6989586621679038923"><span class="hs-identifier hs-var">buildList</span></a><span> </span><span class="hs-special">(</span><span class="hs-identifier hs-var">drop</span><span> </span><a href="#local-6989586621679038925"><span class="hs-identifier hs-var">r</span></a><span> </span><a href="#local-6989586621679038924"><span class="hs-identifier hs-var">l</span></a><span class="hs-special">)</span><span> </span><a href="#local-6989586621679038925"><span class="hs-identifier hs-var">r</span></a><span>
441+</span><a name="line-441"></a><span>
442+</span><a name="line-442"></a><span class="hs-comment">-- Conversion</span><span>
443+</span><a name="line-443"></a><span>
444+</span><a name="line-444"></a><span class="hs-comment">-- | Converts a matrix to a list of lists of elements.</span><span>
445+</span><a name="line-445"></a><span class="hs-identifier">toLists</span><span> </span><span class="hs-glyph">::</span><span> </span><a href="Matrix.Internal.html#Matrix"><span class="hs-identifier hs-type">Matrix</span></a><span> </span><a href="#local-6989586621679038677"><span class="hs-identifier hs-type">e</span></a><span> </span><a href="#local-6989586621679038678"><span class="hs-identifier hs-type">cols</span></a><span> </span><a href="#local-6989586621679038679"><span class="hs-identifier hs-type">rows</span></a><span> </span><span class="hs-glyph">-&gt;</span><span> </span><span class="hs-special">[</span><span class="hs-special">[</span><a href="#local-6989586621679038677"><span class="hs-identifier hs-type">e</span></a><span class="hs-special">]</span><span class="hs-special">]</span><span>
446+</span><a name="line-446"></a><a name="toLists"><a href="Matrix.Internal.html#toLists"><span class="hs-identifier">toLists</span></a></a><span> </span><a href="Matrix.Internal.html#Empty"><span class="hs-identifier hs-var">Empty</span></a><span> </span><span class="hs-glyph">=</span><span> </span><span class="hs-special">[</span><span class="hs-special">]</span><span>
447+</span><a name="line-447"></a><span class="hs-identifier">toLists</span><span> </span><span class="hs-special">(</span><a href="Matrix.Internal.html#One"><span class="hs-identifier hs-var">One</span></a><span> </span><a name="local-6989586621679038939"><a href="#local-6989586621679038939"><span class="hs-identifier">e</span></a></a><span class="hs-special">)</span><span> </span><span class="hs-glyph">=</span><span> </span><span class="hs-special">[</span><span class="hs-special">[</span><a href="#local-6989586621679038939"><span class="hs-identifier hs-var">e</span></a><span class="hs-special">]</span><span class="hs-special">]</span><span>
448+</span><a name="line-448"></a><span class="hs-identifier">toLists</span><span> </span><span class="hs-special">(</span><a href="Matrix.Internal.html#Split"><span class="hs-identifier hs-var">Split</span></a><span> </span><a name="local-6989586621679038940"><a href="#local-6989586621679038940"><span class="hs-identifier">l</span></a></a><span> </span><a name="local-6989586621679038941"><a href="#local-6989586621679038941"><span class="hs-identifier">r</span></a></a><span class="hs-special">)</span><span> </span><span class="hs-glyph">=</span><span> </span><a href="Matrix.Internal.html#toLists"><span class="hs-identifier hs-var">toLists</span></a><span> </span><a href="#local-6989586621679038940"><span class="hs-identifier hs-var">l</span></a><span> </span><span class="hs-operator hs-var">++</span><span> </span><a href="Matrix.Internal.html#toLists"><span class="hs-identifier hs-var">toLists</span></a><span> </span><a href="#local-6989586621679038941"><span class="hs-identifier hs-var">r</span></a><span>
449+</span><a name="line-449"></a><span class="hs-identifier">toLists</span><span> </span><span class="hs-special">(</span><a href="Matrix.Internal.html#Junc"><span class="hs-identifier hs-var">Junc</span></a><span> </span><a name="local-6989586621679038942"><a href="#local-6989586621679038942"><span class="hs-identifier">l</span></a></a><span> </span><a name="local-6989586621679038943"><a href="#local-6989586621679038943"><span class="hs-identifier">r</span></a></a><span class="hs-special">)</span><span> </span><span class="hs-glyph">=</span><span> </span><span class="hs-identifier hs-var">zipWith</span><span> </span><span class="hs-special">(</span><span class="hs-operator hs-var">++</span><span class="hs-special">)</span><span> </span><span class="hs-special">(</span><a href="Matrix.Internal.html#toLists"><span class="hs-identifier hs-var">toLists</span></a><span> </span><a href="#local-6989586621679038942"><span class="hs-identifier hs-var">l</span></a><span class="hs-special">)</span><span> </span><span class="hs-special">(</span><a href="Matrix.Internal.html#toLists"><span class="hs-identifier hs-var">toLists</span></a><span> </span><a href="#local-6989586621679038943"><span class="hs-identifier hs-var">r</span></a><span class="hs-special">)</span><span>
450+</span><a name="line-450"></a><span>
451+</span><a name="line-451"></a><span class="hs-comment">-- | Converts a matrix to a list of elements.</span><span>
452+</span><a name="line-452"></a><span class="hs-identifier">toList</span><span> </span><span class="hs-glyph">::</span><span> </span><a href="Matrix.Internal.html#Matrix"><span class="hs-identifier hs-type">Matrix</span></a><span> </span><a href="#local-6989586621679038674"><span class="hs-identifier hs-type">e</span></a><span> </span><a href="#local-6989586621679038675"><span class="hs-identifier hs-type">cols</span></a><span> </span><a href="#local-6989586621679038676"><span class="hs-identifier hs-type">rows</span></a><span> </span><span class="hs-glyph">-&gt;</span><span> </span><span class="hs-special">[</span><a href="#local-6989586621679038674"><span class="hs-identifier hs-type">e</span></a><span class="hs-special">]</span><span>
453+</span><a name="line-453"></a><a name="toList"><a href="Matrix.Internal.html#toList"><span class="hs-identifier">toList</span></a></a><span> </span><span class="hs-glyph">=</span><span> </span><span class="hs-identifier hs-var">concat</span><span> </span><span class="hs-operator hs-var">.</span><span> </span><a href="Matrix.Internal.html#toLists"><span class="hs-identifier hs-var">toLists</span></a><span>
454+</span><a name="line-454"></a><span>
455+</span><a name="line-455"></a><span class="hs-comment">-- Zeros Matrix</span><span>
456+</span><a name="line-456"></a><span>
457+</span><a name="line-457"></a><span class="hs-comment">-- | The zero matrix. A matrix wholly filled with zeros.</span><span>
458+</span><a name="line-458"></a><span class="hs-identifier">zeros</span><span> </span><span class="hs-glyph">::</span><span> </span><span class="hs-special">(</span><span class="hs-identifier hs-type">Num</span><span> </span><a href="#local-6989586621679038671"><span class="hs-identifier hs-type">e</span></a><span class="hs-special">,</span><span> </span><a href="Matrix.Internal.html#FromLists"><span class="hs-identifier hs-type">FromLists</span></a><span> </span><a href="#local-6989586621679038671"><span class="hs-identifier hs-type">e</span></a><span> </span><a href="#local-6989586621679038672"><span class="hs-identifier hs-type">cols</span></a><span> </span><a href="#local-6989586621679038673"><span class="hs-identifier hs-type">rows</span></a><span class="hs-special">,</span><span> </span><span class="hs-identifier hs-type">KnownNat</span><span> </span><span class="hs-special">(</span><a href="Matrix.Internal.html#Count"><span class="hs-identifier hs-type">Count</span></a><span> </span><a href="#local-6989586621679038672"><span class="hs-identifier hs-type">cols</span></a><span class="hs-special">)</span><span class="hs-special">,</span><span> </span><span class="hs-identifier hs-type">KnownNat</span><span> </span><span class="hs-special">(</span><a href="Matrix.Internal.html#Count"><span class="hs-identifier hs-type">Count</span></a><span> </span><a href="#local-6989586621679038673"><span class="hs-identifier hs-type">rows</span></a><span class="hs-special">)</span><span class="hs-special">)</span><span> </span><span class="hs-glyph">=&gt;</span><span> </span><a href="Matrix.Internal.html#Matrix"><span class="hs-identifier hs-type">Matrix</span></a><span> </span><a href="#local-6989586621679038671"><span class="hs-identifier hs-type">e</span></a><span> </span><a href="#local-6989586621679038672"><span class="hs-identifier hs-type">cols</span></a><span> </span><a href="#local-6989586621679038673"><span class="hs-identifier hs-type">rows</span></a><span>
459+</span><a name="line-459"></a><a name="zeros"><a href="Matrix.Internal.html#zeros"><span class="hs-identifier">zeros</span></a></a><span> </span><span class="hs-glyph">=</span><span> </span><a href="Matrix.Internal.html#matrixBuilder"><span class="hs-identifier hs-var">matrixBuilder</span></a><span> </span><span class="hs-special">(</span><span class="hs-identifier hs-var">const</span><span> </span><span class="hs-number">0</span><span class="hs-special">)</span><span>
460+</span><a name="line-460"></a><span>
461+</span><a name="line-461"></a><span class="hs-comment">-- Ones Matrix</span><span>
462+</span><a name="line-462"></a><span>
463+</span><a name="line-463"></a><span class="hs-comment">-- | The ones matrix. A matrix wholly filled with ones.</span><span>
464+</span><a name="line-464"></a><span class="hs-comment">--</span><span>
465+</span><a name="line-465"></a><span class="hs-comment">-- Also known as T (Top) matrix.</span><span>
466+</span><a name="line-466"></a><span class="hs-identifier">ones</span><span> </span><span class="hs-glyph">::</span><span> </span><span class="hs-special">(</span><span class="hs-identifier hs-type">Num</span><span> </span><a href="#local-6989586621679038668"><span class="hs-identifier hs-type">e</span></a><span class="hs-special">,</span><span> </span><a href="Matrix.Internal.html#FromLists"><span class="hs-identifier hs-type">FromLists</span></a><span> </span><a href="#local-6989586621679038668"><span class="hs-identifier hs-type">e</span></a><span> </span><a href="#local-6989586621679038669"><span class="hs-identifier hs-type">cols</span></a><span> </span><a href="#local-6989586621679038670"><span class="hs-identifier hs-type">rows</span></a><span class="hs-special">,</span><span> </span><span class="hs-identifier hs-type">KnownNat</span><span> </span><span class="hs-special">(</span><a href="Matrix.Internal.html#Count"><span class="hs-identifier hs-type">Count</span></a><span> </span><a href="#local-6989586621679038669"><span class="hs-identifier hs-type">cols</span></a><span class="hs-special">)</span><span class="hs-special">,</span><span> </span><span class="hs-identifier hs-type">KnownNat</span><span> </span><span class="hs-special">(</span><a href="Matrix.Internal.html#Count"><span class="hs-identifier hs-type">Count</span></a><span> </span><a href="#local-6989586621679038670"><span class="hs-identifier hs-type">rows</span></a><span class="hs-special">)</span><span class="hs-special">)</span><span> </span><span class="hs-glyph">=&gt;</span><span> </span><a href="Matrix.Internal.html#Matrix"><span class="hs-identifier hs-type">Matrix</span></a><span> </span><a href="#local-6989586621679038668"><span class="hs-identifier hs-type">e</span></a><span> </span><a href="#local-6989586621679038669"><span class="hs-identifier hs-type">cols</span></a><span> </span><a href="#local-6989586621679038670"><span class="hs-identifier hs-type">rows</span></a><span>
467+</span><a name="line-467"></a><a name="ones"><a href="Matrix.Internal.html#ones"><span class="hs-identifier">ones</span></a></a><span> </span><span class="hs-glyph">=</span><span> </span><a href="Matrix.Internal.html#matrixBuilder"><span class="hs-identifier hs-var">matrixBuilder</span></a><span> </span><span class="hs-special">(</span><span class="hs-identifier hs-var">const</span><span> </span><span class="hs-number">1</span><span class="hs-special">)</span><span>
468+</span><a name="line-468"></a><span>
469+</span><a name="line-469"></a><span class="hs-comment">-- Const Matrix</span><span>
470+</span><a name="line-470"></a><span>
471+</span><a name="line-471"></a><span class="hs-comment">-- | The constant matrix constructor. A matrix wholly filled with a given</span><span>
472+</span><a name="line-472"></a><span class="hs-comment">-- value.</span><span>
473+</span><a name="line-473"></a><span class="hs-identifier">constant</span><span> </span><span class="hs-glyph">::</span><span> </span><span class="hs-special">(</span><span class="hs-identifier hs-type">Num</span><span> </span><a href="#local-6989586621679038665"><span class="hs-identifier hs-type">e</span></a><span class="hs-special">,</span><span> </span><a href="Matrix.Internal.html#FromLists"><span class="hs-identifier hs-type">FromLists</span></a><span> </span><a href="#local-6989586621679038665"><span class="hs-identifier hs-type">e</span></a><span> </span><a href="#local-6989586621679038666"><span class="hs-identifier hs-type">cols</span></a><span> </span><a href="#local-6989586621679038667"><span class="hs-identifier hs-type">rows</span></a><span class="hs-special">,</span><span> </span><span class="hs-identifier hs-type">KnownNat</span><span> </span><span class="hs-special">(</span><a href="Matrix.Internal.html#Count"><span class="hs-identifier hs-type">Count</span></a><span> </span><a href="#local-6989586621679038666"><span class="hs-identifier hs-type">cols</span></a><span class="hs-special">)</span><span class="hs-special">,</span><span> </span><span class="hs-identifier hs-type">KnownNat</span><span> </span><span class="hs-special">(</span><a href="Matrix.Internal.html#Count"><span class="hs-identifier hs-type">Count</span></a><span> </span><a href="#local-6989586621679038667"><span class="hs-identifier hs-type">rows</span></a><span class="hs-special">)</span><span class="hs-special">)</span><span> </span><span class="hs-glyph">=&gt;</span><span> </span><a href="#local-6989586621679038665"><span class="hs-identifier hs-type">e</span></a><span> </span><span class="hs-glyph">-&gt;</span><span> </span><a href="Matrix.Internal.html#Matrix"><span class="hs-identifier hs-type">Matrix</span></a><span> </span><a href="#local-6989586621679038665"><span class="hs-identifier hs-type">e</span></a><span> </span><a href="#local-6989586621679038666"><span class="hs-identifier hs-type">cols</span></a><span> </span><a href="#local-6989586621679038667"><span class="hs-identifier hs-type">rows</span></a><span>
474+</span><a name="line-474"></a><a name="constant"><a href="Matrix.Internal.html#constant"><span class="hs-identifier">constant</span></a></a><span> </span><a name="local-6989586621679038944"><a href="#local-6989586621679038944"><span class="hs-identifier">e</span></a></a><span> </span><span class="hs-glyph">=</span><span> </span><a href="Matrix.Internal.html#matrixBuilder"><span class="hs-identifier hs-var">matrixBuilder</span></a><span> </span><span class="hs-special">(</span><span class="hs-identifier hs-var">const</span><span> </span><a href="#local-6989586621679038944"><span class="hs-identifier hs-var">e</span></a><span class="hs-special">)</span><span>
475+</span><a name="line-475"></a><span>
476+</span><a name="line-476"></a><span class="hs-comment">-- Bang Matrix</span><span>
477+</span><a name="line-477"></a><span>
478+</span><a name="line-478"></a><span class="hs-comment">-- | The T (Top) row vector matrix.</span><span>
479+</span><a name="line-479"></a><span class="hs-identifier">bang</span><span> </span><span class="hs-glyph">::</span><span> </span><span class="hs-keyword">forall</span><span> </span><a name="local-6989586621679038663"><a href="#local-6989586621679038663"><span class="hs-identifier">e</span></a></a><span> </span><a name="local-6989586621679038664"><a href="#local-6989586621679038664"><span class="hs-identifier">cols</span></a></a><span class="hs-operator">.</span><span> </span><span class="hs-special">(</span><span class="hs-identifier hs-type">Num</span><span> </span><a href="#local-6989586621679038663"><span class="hs-identifier hs-type">e</span></a><span class="hs-special">,</span><span> </span><span class="hs-identifier hs-type">Enum</span><span> </span><a href="#local-6989586621679038663"><span class="hs-identifier hs-type">e</span></a><span class="hs-special">,</span><span> </span><a href="Matrix.Internal.html#FromLists"><span class="hs-identifier hs-type">FromLists</span></a><span> </span><a href="#local-6989586621679038663"><span class="hs-identifier hs-type">e</span></a><span> </span><a href="#local-6989586621679038664"><span class="hs-identifier hs-type">cols</span></a><span> </span><span class="hs-special">(</span><span class="hs-special">)</span><span class="hs-special">,</span><span> </span><span class="hs-identifier hs-type">KnownNat</span><span> </span><span class="hs-special">(</span><a href="Matrix.Internal.html#Count"><span class="hs-identifier hs-type">Count</span></a><span> </span><a href="#local-6989586621679038664"><span class="hs-identifier hs-type">cols</span></a><span class="hs-special">)</span><span class="hs-special">)</span><span> </span><span class="hs-glyph">=&gt;</span><span> </span><a href="Matrix.Internal.html#Matrix"><span class="hs-identifier hs-type">Matrix</span></a><span> </span><a href="#local-6989586621679038663"><span class="hs-identifier hs-type">e</span></a><span> </span><a href="#local-6989586621679038664"><span class="hs-identifier hs-type">cols</span></a><span> </span><span class="hs-special">(</span><span class="hs-special">)</span><span>
480+</span><a name="line-480"></a><a name="bang"><a href="Matrix.Internal.html#bang"><span class="hs-identifier">bang</span></a></a><span> </span><span class="hs-glyph">=</span><span>
481+</span><a name="line-481"></a><span> </span><span class="hs-keyword">let</span><span> </span><a name="local-6989586621679038945"><a href="#local-6989586621679038945"><span class="hs-identifier">c</span></a></a><span> </span><span class="hs-glyph">=</span><span> </span><span class="hs-identifier hs-var">fromInteger</span><span> </span><span class="hs-operator hs-var">$</span><span> </span><span class="hs-identifier hs-var">natVal</span><span> </span><span class="hs-special">(</span><span class="hs-identifier hs-var">Proxy</span><span> </span><span class="hs-glyph">::</span><span> </span><span class="hs-identifier hs-type">Proxy</span><span> </span><span class="hs-special">(</span><a href="Matrix.Internal.html#Count"><span class="hs-identifier hs-type">Count</span></a><span> </span><a href="#local-6989586621679038664"><span class="hs-identifier hs-type">cols</span></a><span class="hs-special">)</span><span class="hs-special">)</span><span>
482+</span><a name="line-482"></a><span> </span><span class="hs-keyword">in</span><span> </span><a href="Matrix.Internal.html#fromLists"><span class="hs-identifier hs-var">fromLists</span></a><span> </span><span class="hs-special">[</span><span class="hs-identifier hs-var">take</span><span> </span><a href="#local-6989586621679038945"><span class="hs-identifier hs-var">c</span></a><span> </span><span class="hs-special">[</span><span class="hs-number">1</span><span class="hs-special">,</span><span> </span><span class="hs-number">1</span><span> </span><span class="hs-glyph">..</span><span class="hs-special">]</span><span class="hs-special">]</span><span>
483+</span><a name="line-483"></a><span>
484+</span><a name="line-484"></a><span class="hs-comment">-- Identity Matrix</span><span>
485+</span><a name="line-485"></a><span>
486+</span><a name="line-486"></a><span class="hs-comment">-- | Identity matrix.</span><span>
487+</span><a name="line-487"></a><span class="hs-identifier">identity</span><span> </span><span class="hs-glyph">::</span><span> </span><span class="hs-special">(</span><span class="hs-identifier hs-type">Num</span><span> </span><a href="#local-6989586621679038661"><span class="hs-identifier hs-type">e</span></a><span class="hs-special">,</span><span> </span><a href="Matrix.Internal.html#FromLists"><span class="hs-identifier hs-type">FromLists</span></a><span> </span><a href="#local-6989586621679038661"><span class="hs-identifier hs-type">e</span></a><span> </span><a href="#local-6989586621679038662"><span class="hs-identifier hs-type">cols</span></a><span> </span><a href="#local-6989586621679038662"><span class="hs-identifier hs-type">cols</span></a><span class="hs-special">,</span><span> </span><span class="hs-identifier hs-type">KnownNat</span><span> </span><span class="hs-special">(</span><a href="Matrix.Internal.html#Count"><span class="hs-identifier hs-type">Count</span></a><span> </span><a href="#local-6989586621679038662"><span class="hs-identifier hs-type">cols</span></a><span class="hs-special">)</span><span class="hs-special">)</span><span> </span><span class="hs-glyph">=&gt;</span><span> </span><a href="Matrix.Internal.html#Matrix"><span class="hs-identifier hs-type">Matrix</span></a><span> </span><a href="#local-6989586621679038661"><span class="hs-identifier hs-type">e</span></a><span> </span><a href="#local-6989586621679038662"><span class="hs-identifier hs-type">cols</span></a><span> </span><a href="#local-6989586621679038662"><span class="hs-identifier hs-type">cols</span></a><span>
488+</span><a name="line-488"></a><a name="identity"><a href="Matrix.Internal.html#identity"><span class="hs-identifier">identity</span></a></a><span> </span><span class="hs-glyph">=</span><span> </span><a href="Matrix.Internal.html#matrixBuilder"><span class="hs-identifier hs-var">matrixBuilder</span></a><span> </span><span class="hs-special">(</span><span class="hs-identifier hs-var">bool</span><span> </span><span class="hs-number">0</span><span> </span><span class="hs-number">1</span><span> </span><span class="hs-operator hs-var">.</span><span> </span><span class="hs-identifier hs-var">uncurry</span><span> </span><span class="hs-special">(</span><span class="hs-operator hs-var">==</span><span class="hs-special">)</span><span class="hs-special">)</span><span>
489+</span><a name="line-489"></a><span>
490+</span><a name="line-490"></a><span class="hs-comment">-- Matrix composition (MMM)</span><span>
491+</span><a name="line-491"></a><span>
492+</span><a name="line-492"></a><span class="hs-comment">-- | Matrix composition. Equivalent to matrix-matrix multiplication.</span><span>
493+</span><a name="line-493"></a><span class="hs-comment">--</span><span>
494+</span><a name="line-494"></a><span class="hs-comment">-- This definition takes advantage of divide-and-conquer and fusion laws</span><span>
495+</span><a name="line-495"></a><span class="hs-comment">-- from LAoP.</span><span>
496+</span><a name="line-496"></a><span class="hs-identifier">comp</span><span> </span><span class="hs-glyph">::</span><span> </span><span class="hs-special">(</span><span class="hs-identifier hs-type">Num</span><span> </span><a href="#local-6989586621679038657"><span class="hs-identifier hs-type">e</span></a><span class="hs-special">)</span><span> </span><span class="hs-glyph">=&gt;</span><span> </span><a href="Matrix.Internal.html#Matrix"><span class="hs-identifier hs-type">Matrix</span></a><span> </span><a href="#local-6989586621679038657"><span class="hs-identifier hs-type">e</span></a><span> </span><a href="#local-6989586621679038658"><span class="hs-identifier hs-type">cr</span></a><span> </span><a href="#local-6989586621679038659"><span class="hs-identifier hs-type">rows</span></a><span> </span><span class="hs-glyph">-&gt;</span><span> </span><a href="Matrix.Internal.html#Matrix"><span class="hs-identifier hs-type">Matrix</span></a><span> </span><a href="#local-6989586621679038657"><span class="hs-identifier hs-type">e</span></a><span> </span><a href="#local-6989586621679038660"><span class="hs-identifier hs-type">cols</span></a><span> </span><a href="#local-6989586621679038658"><span class="hs-identifier hs-type">cr</span></a><span> </span><span class="hs-glyph">-&gt;</span><span> </span><a href="Matrix.Internal.html#Matrix"><span class="hs-identifier hs-type">Matrix</span></a><span> </span><a href="#local-6989586621679038657"><span class="hs-identifier hs-type">e</span></a><span> </span><a href="#local-6989586621679038660"><span class="hs-identifier hs-type">cols</span></a><span> </span><a href="#local-6989586621679038659"><span class="hs-identifier hs-type">rows</span></a><span>
497+</span><a name="line-497"></a><a name="comp"><a href="Matrix.Internal.html#comp"><span class="hs-identifier">comp</span></a></a><span> </span><a href="Matrix.Internal.html#Empty"><span class="hs-identifier hs-var">Empty</span></a><span> </span><a href="Matrix.Internal.html#Empty"><span class="hs-identifier hs-var">Empty</span></a><span> </span><span class="hs-glyph">=</span><span> </span><a href="Matrix.Internal.html#Empty"><span class="hs-identifier hs-var">Empty</span></a><span>
498+</span><a name="line-498"></a><span class="hs-identifier">comp</span><span> </span><span class="hs-special">(</span><a href="Matrix.Internal.html#One"><span class="hs-identifier hs-var">One</span></a><span> </span><a name="local-6989586621679038946"><a href="#local-6989586621679038946"><span class="hs-identifier">a</span></a></a><span class="hs-special">)</span><span> </span><span class="hs-special">(</span><a href="Matrix.Internal.html#One"><span class="hs-identifier hs-var">One</span></a><span> </span><a name="local-6989586621679038947"><a href="#local-6989586621679038947"><span class="hs-identifier">b</span></a></a><span class="hs-special">)</span><span> </span><span class="hs-glyph">=</span><span> </span><a href="Matrix.Internal.html#One"><span class="hs-identifier hs-var">One</span></a><span> </span><span class="hs-special">(</span><a href="#local-6989586621679038946"><span class="hs-identifier hs-var">a</span></a><span> </span><span class="hs-operator hs-var">*</span><span> </span><a href="#local-6989586621679038947"><span class="hs-identifier hs-var">b</span></a><span class="hs-special">)</span><span>
499+</span><a name="line-499"></a><span class="hs-identifier">comp</span><span> </span><span class="hs-special">(</span><a href="Matrix.Internal.html#Junc"><span class="hs-identifier hs-var">Junc</span></a><span> </span><a name="local-6989586621679038948"><a href="#local-6989586621679038948"><span class="hs-identifier">a</span></a></a><span> </span><a name="local-6989586621679038949"><a href="#local-6989586621679038949"><span class="hs-identifier">b</span></a></a><span class="hs-special">)</span><span> </span><span class="hs-special">(</span><a href="Matrix.Internal.html#Split"><span class="hs-identifier hs-var">Split</span></a><span> </span><a name="local-6989586621679038950"><a href="#local-6989586621679038950"><span class="hs-identifier">c</span></a></a><span> </span><a name="local-6989586621679038951"><a href="#local-6989586621679038951"><span class="hs-identifier">d</span></a></a><span class="hs-special">)</span><span> </span><span class="hs-glyph">=</span><span> </span><a href="Matrix.Internal.html#comp"><span class="hs-identifier hs-var">comp</span></a><span> </span><a href="#local-6989586621679038948"><span class="hs-identifier hs-var">a</span></a><span> </span><a href="#local-6989586621679038950"><span class="hs-identifier hs-var">c</span></a><span> </span><span class="hs-operator hs-var">+</span><span> </span><a href="Matrix.Internal.html#comp"><span class="hs-identifier hs-var">comp</span></a><span> </span><a href="#local-6989586621679038949"><span class="hs-identifier hs-var">b</span></a><span> </span><a href="#local-6989586621679038951"><span class="hs-identifier hs-var">d</span></a><span> </span><span class="hs-comment">-- Divide-and-conquer law</span><span>
500+</span><a name="line-500"></a><span class="hs-identifier">comp</span><span> </span><span class="hs-special">(</span><a href="Matrix.Internal.html#Split"><span class="hs-identifier hs-var">Split</span></a><span> </span><a name="local-6989586621679038952"><a href="#local-6989586621679038952"><span class="hs-identifier">a</span></a></a><span> </span><a name="local-6989586621679038953"><a href="#local-6989586621679038953"><span class="hs-identifier">b</span></a></a><span class="hs-special">)</span><span> </span><a name="local-6989586621679038954"><a href="#local-6989586621679038954"><span class="hs-identifier">c</span></a></a><span> </span><span class="hs-glyph">=</span><span> </span><a href="Matrix.Internal.html#Split"><span class="hs-identifier hs-var">Split</span></a><span> </span><span class="hs-special">(</span><a href="Matrix.Internal.html#comp"><span class="hs-identifier hs-var">comp</span></a><span> </span><a href="#local-6989586621679038952"><span class="hs-identifier hs-var">a</span></a><span> </span><a href="#local-6989586621679038954"><span class="hs-identifier hs-var">c</span></a><span class="hs-special">)</span><span> </span><span class="hs-special">(</span><a href="Matrix.Internal.html#comp"><span class="hs-identifier hs-var">comp</span></a><span> </span><a href="#local-6989586621679038953"><span class="hs-identifier hs-var">b</span></a><span> </span><a href="#local-6989586621679038954"><span class="hs-identifier hs-var">c</span></a><span class="hs-special">)</span><span> </span><span class="hs-comment">-- Split fusion law</span><span>
501+</span><a name="line-501"></a><span class="hs-identifier">comp</span><span> </span><a name="local-6989586621679038955"><a href="#local-6989586621679038955"><span class="hs-identifier">c</span></a></a><span> </span><span class="hs-special">(</span><a href="Matrix.Internal.html#Junc"><span class="hs-identifier hs-var">Junc</span></a><span> </span><a name="local-6989586621679038956"><a href="#local-6989586621679038956"><span class="hs-identifier">a</span></a></a><span> </span><a name="local-6989586621679038957"><a href="#local-6989586621679038957"><span class="hs-identifier">b</span></a></a><span class="hs-special">)</span><span> </span><span class="hs-glyph">=</span><span> </span><a href="Matrix.Internal.html#Junc"><span class="hs-identifier hs-var">Junc</span></a><span> </span><span class="hs-special">(</span><a href="Matrix.Internal.html#comp"><span class="hs-identifier hs-var">comp</span></a><span> </span><a href="#local-6989586621679038955"><span class="hs-identifier hs-var">c</span></a><span> </span><a href="#local-6989586621679038956"><span class="hs-identifier hs-var">a</span></a><span class="hs-special">)</span><span> </span><span class="hs-special">(</span><a href="Matrix.Internal.html#comp"><span class="hs-identifier hs-var">comp</span></a><span> </span><a href="#local-6989586621679038955"><span class="hs-identifier hs-var">c</span></a><span> </span><a href="#local-6989586621679038957"><span class="hs-identifier hs-var">b</span></a><span class="hs-special">)</span><span> </span><span class="hs-comment">-- Junc fusion law</span><span>
502+</span><a name="line-502"></a><span>
503+</span><a name="line-503"></a><span class="hs-comment">-- Projections</span><span>
504+</span><a name="line-504"></a><span>
505+</span><a name="line-505"></a><span class="hs-comment">-- | Biproduct first component projection</span><span>
506+</span><a name="line-506"></a><span class="hs-identifier">p1</span><span> </span><span class="hs-glyph">::</span><span> </span><span class="hs-keyword">forall</span><span> </span><a name="local-6989586621679038654"><a href="#local-6989586621679038654"><span class="hs-identifier">e</span></a></a><span> </span><a name="local-6989586621679038655"><a href="#local-6989586621679038655"><span class="hs-identifier">m</span></a></a><span> </span><a name="local-6989586621679038656"><a href="#local-6989586621679038656"><span class="hs-identifier">n</span></a></a><span class="hs-operator">.</span><span> </span><span class="hs-special">(</span><span class="hs-identifier hs-type">Num</span><span> </span><a href="#local-6989586621679038654"><span class="hs-identifier hs-type">e</span></a><span class="hs-special">,</span><span> </span><span class="hs-identifier hs-type">KnownNat</span><span> </span><span class="hs-special">(</span><a href="Matrix.Internal.html#Count"><span class="hs-identifier hs-type">Count</span></a><span> </span><a href="#local-6989586621679038656"><span class="hs-identifier hs-type">n</span></a><span class="hs-special">)</span><span class="hs-special">,</span><span> </span><span class="hs-identifier hs-type">KnownNat</span><span> </span><span class="hs-special">(</span><a href="Matrix.Internal.html#Count"><span class="hs-identifier hs-type">Count</span></a><span> </span><a href="#local-6989586621679038655"><span class="hs-identifier hs-type">m</span></a><span class="hs-special">)</span><span class="hs-special">,</span><span> </span><a href="Matrix.Internal.html#FromLists"><span class="hs-identifier hs-type">FromLists</span></a><span> </span><a href="#local-6989586621679038654"><span class="hs-identifier hs-type">e</span></a><span> </span><a href="#local-6989586621679038656"><span class="hs-identifier hs-type">n</span></a><span> </span><a href="#local-6989586621679038655"><span class="hs-identifier hs-type">m</span></a><span class="hs-special">,</span><span> </span><a href="Matrix.Internal.html#FromLists"><span class="hs-identifier hs-type">FromLists</span></a><span> </span><a href="#local-6989586621679038654"><span class="hs-identifier hs-type">e</span></a><span> </span><a href="#local-6989586621679038655"><span class="hs-identifier hs-type">m</span></a><span> </span><a href="#local-6989586621679038655"><span class="hs-identifier hs-type">m</span></a><span class="hs-special">)</span><span> </span><span class="hs-glyph">=&gt;</span><span> </span><a href="Matrix.Internal.html#Matrix"><span class="hs-identifier hs-type">Matrix</span></a><span> </span><a href="#local-6989586621679038654"><span class="hs-identifier hs-type">e</span></a><span> </span><span class="hs-special">(</span><span class="hs-identifier hs-type">Either</span><span> </span><a href="#local-6989586621679038655"><span class="hs-identifier hs-type">m</span></a><span> </span><a href="#local-6989586621679038656"><span class="hs-identifier hs-type">n</span></a><span class="hs-special">)</span><span> </span><a href="#local-6989586621679038655"><span class="hs-identifier hs-type">m</span></a><span>
507+</span><a name="line-507"></a><a name="p1"><a href="Matrix.Internal.html#p1"><span class="hs-identifier">p1</span></a></a><span> </span><span class="hs-glyph">=</span><span>
508+</span><a name="line-508"></a><span> </span><span class="hs-keyword">let</span><span> </span><a name="local-6989586621679038958"><a href="#local-6989586621679038958"><span class="hs-identifier">iden</span></a></a><span> </span><span class="hs-glyph">=</span><span> </span><a href="Matrix.Internal.html#identity"><span class="hs-identifier hs-var">identity</span></a><span> </span><span class="hs-glyph">::</span><span> </span><a href="Matrix.Internal.html#Matrix"><span class="hs-identifier hs-type">Matrix</span></a><span> </span><a href="#local-6989586621679038654"><span class="hs-identifier hs-type">e</span></a><span> </span><a href="#local-6989586621679038655"><span class="hs-identifier hs-type">m</span></a><span> </span><a href="#local-6989586621679038655"><span class="hs-identifier hs-type">m</span></a><span>
509+</span><a name="line-509"></a><span> </span><a name="local-6989586621679038959"><a href="#local-6989586621679038959"><span class="hs-identifier">zero</span></a></a><span> </span><span class="hs-glyph">=</span><span> </span><a href="Matrix.Internal.html#zeros"><span class="hs-identifier hs-var">zeros</span></a><span> </span><span class="hs-glyph">::</span><span> </span><a href="Matrix.Internal.html#Matrix"><span class="hs-identifier hs-type">Matrix</span></a><span> </span><a href="#local-6989586621679038654"><span class="hs-identifier hs-type">e</span></a><span> </span><a href="#local-6989586621679038656"><span class="hs-identifier hs-type">n</span></a><span> </span><a href="#local-6989586621679038655"><span class="hs-identifier hs-type">m</span></a><span>
510+</span><a name="line-510"></a><span> </span><span class="hs-keyword">in</span><span> </span><a href="Matrix.Internal.html#junc"><span class="hs-identifier hs-var">junc</span></a><span> </span><a href="#local-6989586621679038958"><span class="hs-identifier hs-var">iden</span></a><span> </span><a href="#local-6989586621679038959"><span class="hs-identifier hs-var">zero</span></a><span>
511+</span><a name="line-511"></a><span>
512+</span><a name="line-512"></a><span class="hs-comment">-- | Biproduct second component projection</span><span>
513+</span><a name="line-513"></a><span class="hs-identifier">p2</span><span> </span><span class="hs-glyph">::</span><span> </span><span class="hs-keyword">forall</span><span> </span><a name="local-6989586621679038651"><a href="#local-6989586621679038651"><span class="hs-identifier">e</span></a></a><span> </span><a name="local-6989586621679038652"><a href="#local-6989586621679038652"><span class="hs-identifier">m</span></a></a><span> </span><a name="local-6989586621679038653"><a href="#local-6989586621679038653"><span class="hs-identifier">n</span></a></a><span class="hs-operator">.</span><span> </span><span class="hs-special">(</span><span class="hs-identifier hs-type">Num</span><span> </span><a href="#local-6989586621679038651"><span class="hs-identifier hs-type">e</span></a><span class="hs-special">,</span><span> </span><span class="hs-identifier hs-type">KnownNat</span><span> </span><span class="hs-special">(</span><a href="Matrix.Internal.html#Count"><span class="hs-identifier hs-type">Count</span></a><span> </span><a href="#local-6989586621679038653"><span class="hs-identifier hs-type">n</span></a><span class="hs-special">)</span><span class="hs-special">,</span><span> </span><span class="hs-identifier hs-type">KnownNat</span><span> </span><span class="hs-special">(</span><a href="Matrix.Internal.html#Count"><span class="hs-identifier hs-type">Count</span></a><span> </span><a href="#local-6989586621679038652"><span class="hs-identifier hs-type">m</span></a><span class="hs-special">)</span><span class="hs-special">,</span><span> </span><a href="Matrix.Internal.html#FromLists"><span class="hs-identifier hs-type">FromLists</span></a><span> </span><a href="#local-6989586621679038651"><span class="hs-identifier hs-type">e</span></a><span> </span><a href="#local-6989586621679038652"><span class="hs-identifier hs-type">m</span></a><span> </span><a href="#local-6989586621679038653"><span class="hs-identifier hs-type">n</span></a><span class="hs-special">,</span><span> </span><a href="Matrix.Internal.html#FromLists"><span class="hs-identifier hs-type">FromLists</span></a><span> </span><a href="#local-6989586621679038651"><span class="hs-identifier hs-type">e</span></a><span> </span><a href="#local-6989586621679038653"><span class="hs-identifier hs-type">n</span></a><span> </span><a href="#local-6989586621679038653"><span class="hs-identifier hs-type">n</span></a><span class="hs-special">)</span><span> </span><span class="hs-glyph">=&gt;</span><span> </span><a href="Matrix.Internal.html#Matrix"><span class="hs-identifier hs-type">Matrix</span></a><span> </span><a href="#local-6989586621679038651"><span class="hs-identifier hs-type">e</span></a><span> </span><span class="hs-special">(</span><span class="hs-identifier hs-type">Either</span><span> </span><a href="#local-6989586621679038652"><span class="hs-identifier hs-type">m</span></a><span> </span><a href="#local-6989586621679038653"><span class="hs-identifier hs-type">n</span></a><span class="hs-special">)</span><span> </span><a href="#local-6989586621679038653"><span class="hs-identifier hs-type">n</span></a><span>
514+</span><a name="line-514"></a><a name="p2"><a href="Matrix.Internal.html#p2"><span class="hs-identifier">p2</span></a></a><span> </span><span class="hs-glyph">=</span><span>
515+</span><a name="line-515"></a><span> </span><span class="hs-keyword">let</span><span> </span><a name="local-6989586621679038960"><a href="#local-6989586621679038960"><span class="hs-identifier">iden</span></a></a><span> </span><span class="hs-glyph">=</span><span> </span><a href="Matrix.Internal.html#identity"><span class="hs-identifier hs-var">identity</span></a><span> </span><span class="hs-glyph">::</span><span> </span><a href="Matrix.Internal.html#Matrix"><span class="hs-identifier hs-type">Matrix</span></a><span> </span><a href="#local-6989586621679038651"><span class="hs-identifier hs-type">e</span></a><span> </span><a href="#local-6989586621679038653"><span class="hs-identifier hs-type">n</span></a><span> </span><a href="#local-6989586621679038653"><span class="hs-identifier hs-type">n</span></a><span>
516+</span><a name="line-516"></a><span> </span><a name="local-6989586621679038961"><a href="#local-6989586621679038961"><span class="hs-identifier">zero</span></a></a><span> </span><span class="hs-glyph">=</span><span> </span><a href="Matrix.Internal.html#zeros"><span class="hs-identifier hs-var">zeros</span></a><span> </span><span class="hs-glyph">::</span><span> </span><a href="Matrix.Internal.html#Matrix"><span class="hs-identifier hs-type">Matrix</span></a><span> </span><a href="#local-6989586621679038651"><span class="hs-identifier hs-type">e</span></a><span> </span><a href="#local-6989586621679038652"><span class="hs-identifier hs-type">m</span></a><span> </span><a href="#local-6989586621679038653"><span class="hs-identifier hs-type">n</span></a><span>
517+</span><a name="line-517"></a><span> </span><span class="hs-keyword">in</span><span> </span><a href="Matrix.Internal.html#junc"><span class="hs-identifier hs-var">junc</span></a><span> </span><a href="#local-6989586621679038961"><span class="hs-identifier hs-var">zero</span></a><span> </span><a href="#local-6989586621679038960"><span class="hs-identifier hs-var">iden</span></a><span>
518+</span><a name="line-518"></a><span>
519+</span><a name="line-519"></a><span class="hs-comment">-- Injections</span><span>
520+</span><a name="line-520"></a><span>
521+</span><a name="line-521"></a><span class="hs-comment">-- | Biproduct first component injection</span><span>
522+</span><a name="line-522"></a><span class="hs-identifier">i1</span><span> </span><span class="hs-glyph">::</span><span> </span><span class="hs-special">(</span><span class="hs-identifier hs-type">Num</span><span> </span><a href="#local-6989586621679038648"><span class="hs-identifier hs-type">e</span></a><span class="hs-special">,</span><span> </span><span class="hs-identifier hs-type">KnownNat</span><span> </span><span class="hs-special">(</span><a href="Matrix.Internal.html#Count"><span class="hs-identifier hs-type">Count</span></a><span> </span><a href="#local-6989586621679038649"><span class="hs-identifier hs-type">n</span></a><span class="hs-special">)</span><span class="hs-special">,</span><span> </span><span class="hs-identifier hs-type">KnownNat</span><span> </span><span class="hs-special">(</span><a href="Matrix.Internal.html#Count"><span class="hs-identifier hs-type">Count</span></a><span> </span><a href="#local-6989586621679038650"><span class="hs-identifier hs-type">m</span></a><span class="hs-special">)</span><span class="hs-special">,</span><span> </span><a href="Matrix.Internal.html#FromLists"><span class="hs-identifier hs-type">FromLists</span></a><span> </span><a href="#local-6989586621679038648"><span class="hs-identifier hs-type">e</span></a><span> </span><a href="#local-6989586621679038649"><span class="hs-identifier hs-type">n</span></a><span> </span><a href="#local-6989586621679038650"><span class="hs-identifier hs-type">m</span></a><span class="hs-special">,</span><span> </span><a href="Matrix.Internal.html#FromLists"><span class="hs-identifier hs-type">FromLists</span></a><span> </span><a href="#local-6989586621679038648"><span class="hs-identifier hs-type">e</span></a><span> </span><a href="#local-6989586621679038650"><span class="hs-identifier hs-type">m</span></a><span> </span><a href="#local-6989586621679038650"><span class="hs-identifier hs-type">m</span></a><span class="hs-special">)</span><span> </span><span class="hs-glyph">=&gt;</span><span> </span><a href="Matrix.Internal.html#Matrix"><span class="hs-identifier hs-type">Matrix</span></a><span> </span><a href="#local-6989586621679038648"><span class="hs-identifier hs-type">e</span></a><span> </span><a href="#local-6989586621679038650"><span class="hs-identifier hs-type">m</span></a><span> </span><span class="hs-special">(</span><span class="hs-identifier hs-type">Either</span><span> </span><a href="#local-6989586621679038650"><span class="hs-identifier hs-type">m</span></a><span> </span><a href="#local-6989586621679038649"><span class="hs-identifier hs-type">n</span></a><span class="hs-special">)</span><span>
523+</span><a name="line-523"></a><a name="i1"><a href="Matrix.Internal.html#i1"><span class="hs-identifier">i1</span></a></a><span> </span><span class="hs-glyph">=</span><span> </span><a href="Matrix.Internal.html#tr"><span class="hs-identifier hs-var">tr</span></a><span> </span><a href="Matrix.Internal.html#p1"><span class="hs-identifier hs-var">p1</span></a><span>
524+</span><a name="line-524"></a><span>
525+</span><a name="line-525"></a><span class="hs-comment">-- | Biproduct second component injection</span><span>
526+</span><a name="line-526"></a><span class="hs-identifier">i2</span><span> </span><span class="hs-glyph">::</span><span> </span><span class="hs-special">(</span><span class="hs-identifier hs-type">Num</span><span> </span><a href="#local-6989586621679038645"><span class="hs-identifier hs-type">e</span></a><span class="hs-special">,</span><span> </span><span class="hs-identifier hs-type">KnownNat</span><span> </span><span class="hs-special">(</span><a href="Matrix.Internal.html#Count"><span class="hs-identifier hs-type">Count</span></a><span> </span><a href="#local-6989586621679038646"><span class="hs-identifier hs-type">n</span></a><span class="hs-special">)</span><span class="hs-special">,</span><span> </span><span class="hs-identifier hs-type">KnownNat</span><span> </span><span class="hs-special">(</span><a href="Matrix.Internal.html#Count"><span class="hs-identifier hs-type">Count</span></a><span> </span><a href="#local-6989586621679038647"><span class="hs-identifier hs-type">m</span></a><span class="hs-special">)</span><span class="hs-special">,</span><span> </span><a href="Matrix.Internal.html#FromLists"><span class="hs-identifier hs-type">FromLists</span></a><span> </span><a href="#local-6989586621679038645"><span class="hs-identifier hs-type">e</span></a><span> </span><a href="#local-6989586621679038647"><span class="hs-identifier hs-type">m</span></a><span> </span><a href="#local-6989586621679038646"><span class="hs-identifier hs-type">n</span></a><span class="hs-special">,</span><span> </span><a href="Matrix.Internal.html#FromLists"><span class="hs-identifier hs-type">FromLists</span></a><span> </span><a href="#local-6989586621679038645"><span class="hs-identifier hs-type">e</span></a><span> </span><a href="#local-6989586621679038646"><span class="hs-identifier hs-type">n</span></a><span> </span><a href="#local-6989586621679038646"><span class="hs-identifier hs-type">n</span></a><span class="hs-special">)</span><span> </span><span class="hs-glyph">=&gt;</span><span> </span><a href="Matrix.Internal.html#Matrix"><span class="hs-identifier hs-type">Matrix</span></a><span> </span><a href="#local-6989586621679038645"><span class="hs-identifier hs-type">e</span></a><span> </span><a href="#local-6989586621679038646"><span class="hs-identifier hs-type">n</span></a><span> </span><span class="hs-special">(</span><span class="hs-identifier hs-type">Either</span><span> </span><a href="#local-6989586621679038647"><span class="hs-identifier hs-type">m</span></a><span> </span><a href="#local-6989586621679038646"><span class="hs-identifier hs-type">n</span></a><span class="hs-special">)</span><span>
527+</span><a name="line-527"></a><a name="i2"><a href="Matrix.Internal.html#i2"><span class="hs-identifier">i2</span></a></a><span> </span><span class="hs-glyph">=</span><span> </span><a href="Matrix.Internal.html#tr"><span class="hs-identifier hs-var">tr</span></a><span> </span><a href="Matrix.Internal.html#p2"><span class="hs-identifier hs-var">p2</span></a><span>
528+</span><a name="line-528"></a><span>
529+</span><a name="line-529"></a><span class="hs-comment">-- Dimensions</span><span>
530+</span><a name="line-530"></a><span>
531+</span><a name="line-531"></a><span class="hs-comment">-- | Obtain the number of rows.</span><span>
532+</span><a name="line-532"></a><span class="hs-comment">--</span><span>
533+</span><a name="line-533"></a><span class="hs-comment">-- NOTE: The 'KnownNat' constaint is needed in order to obtain the</span><span>
534+</span><a name="line-534"></a><span class="hs-comment">-- dimensions in constant time.</span><span>
535+</span><a name="line-535"></a><span class="hs-comment">--</span><span>
536+</span><a name="line-536"></a><span class="hs-comment">-- TODO: A 'rows' function that does not need the 'KnownNat' constraint in</span><span>
537+</span><a name="line-537"></a><span class="hs-comment">-- exchange for performance.</span><span>
538+</span><a name="line-538"></a><span class="hs-identifier">rows</span><span> </span><span class="hs-glyph">::</span><span> </span><span class="hs-keyword">forall</span><span> </span><a name="local-6989586621679038642"><a href="#local-6989586621679038642"><span class="hs-identifier">e</span></a></a><span> </span><a name="local-6989586621679038643"><a href="#local-6989586621679038643"><span class="hs-identifier">cols</span></a></a><span> </span><a name="local-6989586621679038644"><a href="#local-6989586621679038644"><span class="hs-identifier">rows</span></a></a><span class="hs-operator">.</span><span> </span><span class="hs-special">(</span><span class="hs-identifier hs-type">KnownNat</span><span> </span><span class="hs-special">(</span><a href="Matrix.Internal.html#Count"><span class="hs-identifier hs-type">Count</span></a><span> </span><a href="#local-6989586621679038644"><span class="hs-identifier hs-type">rows</span></a><span class="hs-special">)</span><span class="hs-special">)</span><span> </span><span class="hs-glyph">=&gt;</span><span> </span><a href="Matrix.Internal.html#Matrix"><span class="hs-identifier hs-type">Matrix</span></a><span> </span><a href="#local-6989586621679038642"><span class="hs-identifier hs-type">e</span></a><span> </span><a href="#local-6989586621679038643"><span class="hs-identifier hs-type">cols</span></a><span> </span><a href="#local-6989586621679038644"><span class="hs-identifier hs-type">rows</span></a><span> </span><span class="hs-glyph">-&gt;</span><span> </span><span class="hs-identifier hs-type">Int</span><span>
539+</span><a name="line-539"></a><a name="rows"><a href="Matrix.Internal.html#rows"><span class="hs-identifier">rows</span></a></a><span> </span><span class="hs-identifier">_</span><span> </span><span class="hs-glyph">=</span><span> </span><span class="hs-identifier hs-var">fromInteger</span><span> </span><span class="hs-operator hs-var">$</span><span> </span><span class="hs-identifier hs-var">natVal</span><span> </span><span class="hs-special">(</span><span class="hs-identifier hs-var">Proxy</span><span> </span><span class="hs-glyph">::</span><span> </span><span class="hs-identifier hs-type">Proxy</span><span> </span><span class="hs-special">(</span><a href="Matrix.Internal.html#Count"><span class="hs-identifier hs-type">Count</span></a><span> </span><a href="#local-6989586621679038644"><span class="hs-identifier hs-type">rows</span></a><span class="hs-special">)</span><span class="hs-special">)</span><span>
540+</span><a name="line-540"></a><span>
541+</span><a name="line-541"></a><span class="hs-comment">-- | Obtain the number of columns.</span><span>
542+</span><a name="line-542"></a><span class="hs-comment">-- </span><span>
543+</span><a name="line-543"></a><span class="hs-comment">-- NOTE: The 'KnownNat' constaint is needed in order to obtain the</span><span>
544+</span><a name="line-544"></a><span class="hs-comment">-- dimensions in constant time.</span><span>
545+</span><a name="line-545"></a><span class="hs-comment">--</span><span>
546+</span><a name="line-546"></a><span class="hs-comment">-- TODO: A 'columns' function that does not need the 'KnownNat' constraint in</span><span>
547+</span><a name="line-547"></a><span class="hs-comment">-- exchange for performance.</span><span>
548+</span><a name="line-548"></a><span class="hs-identifier">columns</span><span> </span><span class="hs-glyph">::</span><span> </span><span class="hs-keyword">forall</span><span> </span><a name="local-6989586621679038639"><a href="#local-6989586621679038639"><span class="hs-identifier">e</span></a></a><span> </span><a name="local-6989586621679038640"><a href="#local-6989586621679038640"><span class="hs-identifier">cols</span></a></a><span> </span><a name="local-6989586621679038641"><a href="#local-6989586621679038641"><span class="hs-identifier">rows</span></a></a><span class="hs-operator">.</span><span> </span><span class="hs-special">(</span><span class="hs-identifier hs-type">KnownNat</span><span> </span><span class="hs-special">(</span><a href="Matrix.Internal.html#Count"><span class="hs-identifier hs-type">Count</span></a><span> </span><a href="#local-6989586621679038640"><span class="hs-identifier hs-type">cols</span></a><span class="hs-special">)</span><span class="hs-special">)</span><span> </span><span class="hs-glyph">=&gt;</span><span> </span><a href="Matrix.Internal.html#Matrix"><span class="hs-identifier hs-type">Matrix</span></a><span> </span><a href="#local-6989586621679038639"><span class="hs-identifier hs-type">e</span></a><span> </span><a href="#local-6989586621679038640"><span class="hs-identifier hs-type">cols</span></a><span> </span><a href="#local-6989586621679038641"><span class="hs-identifier hs-type">rows</span></a><span> </span><span class="hs-glyph">-&gt;</span><span> </span><span class="hs-identifier hs-type">Int</span><span>
549+</span><a name="line-549"></a><a name="columns"><a href="Matrix.Internal.html#columns"><span class="hs-identifier">columns</span></a></a><span> </span><span class="hs-identifier">_</span><span> </span><span class="hs-glyph">=</span><span> </span><span class="hs-identifier hs-var">fromInteger</span><span> </span><span class="hs-operator hs-var">$</span><span> </span><span class="hs-identifier hs-var">natVal</span><span> </span><span class="hs-special">(</span><span class="hs-identifier hs-var">Proxy</span><span> </span><span class="hs-glyph">::</span><span> </span><span class="hs-identifier hs-type">Proxy</span><span> </span><span class="hs-special">(</span><a href="Matrix.Internal.html#Count"><span class="hs-identifier hs-type">Count</span></a><span> </span><a href="#local-6989586621679038640"><span class="hs-identifier hs-type">cols</span></a><span class="hs-special">)</span><span class="hs-special">)</span><span>
550+</span><a name="line-550"></a><span>
551+</span><a name="line-551"></a><span class="hs-comment">-- Coproduct Bifunctor</span><span>
552+</span><a name="line-552"></a><span>
553+</span><a name="line-553"></a><span class="hs-keyword">infixl</span><span> </span><span class="hs-number">5</span><span> </span><a href="Matrix.Internal.html#-%7C-"><span class="hs-operator hs-var">-|-</span></a><span>
554+</span><a name="line-554"></a><span>
555+</span><a name="line-555"></a><span class="hs-comment">-- | Matrix coproduct functor also known as matrix direct sum.</span><span>
556+</span><a name="line-556"></a><span class="hs-special">(</span><span class="hs-operator">-|-</span><span class="hs-special">)</span><span> </span><span class="hs-glyph">::</span><span>
557+</span><a name="line-557"></a><span> </span><span class="hs-keyword">forall</span><span> </span><a name="local-6989586621679038634"><a href="#local-6989586621679038634"><span class="hs-identifier">e</span></a></a><span> </span><a name="local-6989586621679038635"><a href="#local-6989586621679038635"><span class="hs-identifier">n</span></a></a><span> </span><a name="local-6989586621679038636"><a href="#local-6989586621679038636"><span class="hs-identifier">k</span></a></a><span> </span><a name="local-6989586621679038637"><a href="#local-6989586621679038637"><span class="hs-identifier">m</span></a></a><span> </span><a name="local-6989586621679038638"><a href="#local-6989586621679038638"><span class="hs-identifier">j</span></a></a><span class="hs-operator">.</span><span>
558+</span><a name="line-558"></a><span> </span><span class="hs-special">(</span><span> </span><span class="hs-identifier hs-type">Num</span><span> </span><a href="#local-6989586621679038634"><span class="hs-identifier hs-type">e</span></a><span class="hs-special">,</span><span>
559+</span><a name="line-559"></a><span> </span><span class="hs-identifier hs-type">KnownNat</span><span> </span><span class="hs-special">(</span><a href="Matrix.Internal.html#Count"><span class="hs-identifier hs-type">Count</span></a><span> </span><a href="#local-6989586621679038638"><span class="hs-identifier hs-type">j</span></a><span class="hs-special">)</span><span class="hs-special">,</span><span>
560+</span><a name="line-560"></a><span> </span><span class="hs-identifier hs-type">KnownNat</span><span> </span><span class="hs-special">(</span><a href="Matrix.Internal.html#Count"><span class="hs-identifier hs-type">Count</span></a><span> </span><a href="#local-6989586621679038636"><span class="hs-identifier hs-type">k</span></a><span class="hs-special">)</span><span class="hs-special">,</span><span>
561+</span><a name="line-561"></a><span> </span><a href="Matrix.Internal.html#FromLists"><span class="hs-identifier hs-type">FromLists</span></a><span> </span><a href="#local-6989586621679038634"><span class="hs-identifier hs-type">e</span></a><span> </span><a href="#local-6989586621679038636"><span class="hs-identifier hs-type">k</span></a><span> </span><a href="#local-6989586621679038636"><span class="hs-identifier hs-type">k</span></a><span class="hs-special">,</span><span>
562+</span><a name="line-562"></a><span> </span><a href="Matrix.Internal.html#FromLists"><span class="hs-identifier hs-type">FromLists</span></a><span> </span><a href="#local-6989586621679038634"><span class="hs-identifier hs-type">e</span></a><span> </span><a href="#local-6989586621679038638"><span class="hs-identifier hs-type">j</span></a><span> </span><a href="#local-6989586621679038636"><span class="hs-identifier hs-type">k</span></a><span class="hs-special">,</span><span>
563+</span><a name="line-563"></a><span> </span><a href="Matrix.Internal.html#FromLists"><span class="hs-identifier hs-type">FromLists</span></a><span> </span><a href="#local-6989586621679038634"><span class="hs-identifier hs-type">e</span></a><span> </span><a href="#local-6989586621679038636"><span class="hs-identifier hs-type">k</span></a><span> </span><a href="#local-6989586621679038638"><span class="hs-identifier hs-type">j</span></a><span class="hs-special">,</span><span>
564+</span><a name="line-564"></a><span> </span><a href="Matrix.Internal.html#FromLists"><span class="hs-identifier hs-type">FromLists</span></a><span> </span><a href="#local-6989586621679038634"><span class="hs-identifier hs-type">e</span></a><span> </span><a href="#local-6989586621679038638"><span class="hs-identifier hs-type">j</span></a><span> </span><a href="#local-6989586621679038638"><span class="hs-identifier hs-type">j</span></a><span>
565+</span><a name="line-565"></a><span> </span><span class="hs-special">)</span><span> </span><span class="hs-glyph">=&gt;</span><span>
566+</span><a name="line-566"></a><span> </span><a href="Matrix.Internal.html#Matrix"><span class="hs-identifier hs-type">Matrix</span></a><span> </span><a href="#local-6989586621679038634"><span class="hs-identifier hs-type">e</span></a><span> </span><a href="#local-6989586621679038635"><span class="hs-identifier hs-type">n</span></a><span> </span><a href="#local-6989586621679038636"><span class="hs-identifier hs-type">k</span></a><span> </span><span class="hs-glyph">-&gt;</span><span>
567+</span><a name="line-567"></a><span> </span><a href="Matrix.Internal.html#Matrix"><span class="hs-identifier hs-type">Matrix</span></a><span> </span><a href="#local-6989586621679038634"><span class="hs-identifier hs-type">e</span></a><span> </span><a href="#local-6989586621679038637"><span class="hs-identifier hs-type">m</span></a><span> </span><a href="#local-6989586621679038638"><span class="hs-identifier hs-type">j</span></a><span> </span><span class="hs-glyph">-&gt;</span><span>
568+</span><a name="line-568"></a><span> </span><a href="Matrix.Internal.html#Matrix"><span class="hs-identifier hs-type">Matrix</span></a><span> </span><a href="#local-6989586621679038634"><span class="hs-identifier hs-type">e</span></a><span> </span><span class="hs-special">(</span><span class="hs-identifier hs-type">Either</span><span> </span><a href="#local-6989586621679038635"><span class="hs-identifier hs-type">n</span></a><span> </span><a href="#local-6989586621679038637"><span class="hs-identifier hs-type">m</span></a><span class="hs-special">)</span><span> </span><span class="hs-special">(</span><span class="hs-identifier hs-type">Either</span><span> </span><a href="#local-6989586621679038636"><span class="hs-identifier hs-type">k</span></a><span> </span><a href="#local-6989586621679038638"><span class="hs-identifier hs-type">j</span></a><span class="hs-special">)</span><span>
569+</span><a name="line-569"></a><span class="hs-special">(</span><a name="-%7C-"><a href="Matrix.Internal.html#-%7C-"><span class="hs-operator">-|-</span></a></a><span class="hs-special">)</span><span> </span><a name="local-6989586621679038962"><a href="#local-6989586621679038962"><span class="hs-identifier">a</span></a></a><span> </span><a name="local-6989586621679038963"><a href="#local-6989586621679038963"><span class="hs-identifier">b</span></a></a><span> </span><span class="hs-glyph">=</span><span> </span><a href="Matrix.Internal.html#Junc"><span class="hs-identifier hs-var">Junc</span></a><span> </span><span class="hs-special">(</span><a href="Matrix.Internal.html#i1"><span class="hs-identifier hs-var">i1</span></a><span> </span><span class="hs-operator hs-var">.</span><span> </span><a href="#local-6989586621679038962"><span class="hs-identifier hs-var">a</span></a><span class="hs-special">)</span><span> </span><span class="hs-special">(</span><a href="Matrix.Internal.html#i2"><span class="hs-identifier hs-var">i2</span></a><span> </span><span class="hs-operator hs-var">.</span><span> </span><a href="#local-6989586621679038963"><span class="hs-identifier hs-var">b</span></a><span class="hs-special">)</span><span>
570+</span><a name="line-570"></a><span>
571+</span><a name="line-571"></a><span class="hs-comment">-- Khatri Rao Product and projections</span><span>
572+</span><a name="line-572"></a><span>
573+</span><a name="line-573"></a><span class="hs-comment">-- | Khatri Rao product first component projection matrix.</span><span>
574+</span><a name="line-574"></a><span class="hs-identifier">kp1</span><span> </span><span class="hs-glyph">::</span><span>
575+</span><a name="line-575"></a><span> </span><span class="hs-keyword">forall</span><span> </span><a name="local-6989586621679038631"><a href="#local-6989586621679038631"><span class="hs-identifier">e</span></a></a><span> </span><a name="local-6989586621679038632"><a href="#local-6989586621679038632"><span class="hs-identifier">m</span></a></a><span> </span><a name="local-6989586621679038633"><a href="#local-6989586621679038633"><span class="hs-identifier">k</span></a></a><span> </span><span class="hs-operator">.</span><span>
576+</span><a name="line-576"></a><span> </span><span class="hs-special">(</span><span> </span><span class="hs-identifier hs-type">Num</span><span> </span><a href="#local-6989586621679038631"><span class="hs-identifier hs-type">e</span></a><span class="hs-special">,</span><span>
577+</span><a name="line-577"></a><span> </span><span class="hs-identifier hs-type">KnownNat</span><span> </span><span class="hs-special">(</span><a href="Matrix.Internal.html#Count"><span class="hs-identifier hs-type">Count</span></a><span> </span><a href="#local-6989586621679038633"><span class="hs-identifier hs-type">k</span></a><span class="hs-special">)</span><span class="hs-special">,</span><span>
578+</span><a name="line-578"></a><span> </span><a href="Matrix.Internal.html#FromLists"><span class="hs-identifier hs-type">FromLists</span></a><span> </span><a href="#local-6989586621679038631"><span class="hs-identifier hs-type">e</span></a><span> </span><span class="hs-special">(</span><a href="Matrix.Internal.html#FromNat"><span class="hs-identifier hs-type">FromNat</span></a><span> </span><span class="hs-special">(</span><span class="hs-identifier hs-type">Count</span><span> </span><a href="#local-6989586621679038632"><span class="hs-identifier hs-type">m</span></a><span> </span><span class="hs-operator">*</span><span> </span><a href="Matrix.Internal.html#Count"><span class="hs-identifier hs-type">Count</span></a><span> </span><a href="#local-6989586621679038633"><span class="hs-identifier hs-type">k</span></a><span class="hs-special">)</span><span class="hs-special">)</span><span> </span><a href="#local-6989586621679038632"><span class="hs-identifier hs-type">m</span></a><span class="hs-special">,</span><span>
579+</span><a name="line-579"></a><span> </span><span class="hs-identifier hs-type">KnownNat</span><span> </span><span class="hs-special">(</span><a href="Matrix.Internal.html#Count"><span class="hs-identifier hs-type">Count</span></a><span> </span><a href="#local-6989586621679038632"><span class="hs-identifier hs-type">m</span></a><span class="hs-special">)</span><span class="hs-special">,</span><span>
580+</span><a name="line-580"></a><span> </span><span class="hs-identifier hs-type">KnownNat</span><span> </span><span class="hs-special">(</span><a href="Matrix.Internal.html#Count"><span class="hs-identifier hs-type">Count</span></a><span> </span><span class="hs-special">(</span><a href="Matrix.Internal.html#Normalize"><span class="hs-identifier hs-type">Normalize</span></a><span> </span><span class="hs-special">(</span><a href="#local-6989586621679038632"><span class="hs-identifier hs-type">m</span></a><span class="hs-special">,</span><span> </span><a href="#local-6989586621679038633"><span class="hs-identifier hs-type">k</span></a><span class="hs-special">)</span><span class="hs-special">)</span><span class="hs-special">)</span><span>
581+</span><a name="line-581"></a><span> </span><span class="hs-special">)</span><span> </span><span class="hs-glyph">=&gt;</span><span> </span><a href="Matrix.Internal.html#Matrix"><span class="hs-identifier hs-type">Matrix</span></a><span> </span><a href="#local-6989586621679038631"><span class="hs-identifier hs-type">e</span></a><span> </span><span class="hs-special">(</span><a href="Matrix.Internal.html#Normalize"><span class="hs-identifier hs-type">Normalize</span></a><span> </span><span class="hs-special">(</span><a href="#local-6989586621679038632"><span class="hs-identifier hs-type">m</span></a><span class="hs-special">,</span><span> </span><a href="#local-6989586621679038633"><span class="hs-identifier hs-type">k</span></a><span class="hs-special">)</span><span class="hs-special">)</span><span> </span><a href="#local-6989586621679038632"><span class="hs-identifier hs-type">m</span></a><span>
582+</span><a name="line-582"></a><a name="kp1"><a href="Matrix.Internal.html#kp1"><span class="hs-identifier">kp1</span></a></a><span> </span><span class="hs-glyph">=</span><span> </span><a href="Matrix.Internal.html#matrixBuilder"><span class="hs-identifier hs-var">matrixBuilder</span></a><span> </span><a href="#local-6989586621679038965"><span class="hs-identifier hs-var">f</span></a><span>
583+</span><a name="line-583"></a><span> </span><span class="hs-keyword">where</span><span>
584+</span><a name="line-584"></a><span> </span><a name="local-6989586621679038964"><a href="#local-6989586621679038964"><span class="hs-identifier">offset</span></a></a><span> </span><span class="hs-glyph">=</span><span> </span><span class="hs-identifier hs-var">fromInteger</span><span> </span><span class="hs-special">(</span><span class="hs-identifier hs-var">natVal</span><span> </span><span class="hs-special">(</span><span class="hs-identifier hs-var">Proxy</span><span> </span><span class="hs-glyph">::</span><span> </span><span class="hs-identifier hs-type">Proxy</span><span> </span><span class="hs-special">(</span><a href="Matrix.Internal.html#Count"><span class="hs-identifier hs-type">Count</span></a><span> </span><a href="#local-6989586621679038633"><span class="hs-identifier hs-type">k</span></a><span class="hs-special">)</span><span class="hs-special">)</span><span class="hs-special">)</span><span>
585+</span><a name="line-585"></a><span> </span><a name="local-6989586621679038965"><a href="#local-6989586621679038965"><span class="hs-identifier">f</span></a></a><span> </span><span class="hs-special">(</span><a name="local-6989586621679038966"><a href="#local-6989586621679038966"><span class="hs-identifier">x</span></a></a><span class="hs-special">,</span><span> </span><a name="local-6989586621679038967"><a href="#local-6989586621679038967"><span class="hs-identifier">y</span></a></a><span class="hs-special">)</span><span>
586+</span><a name="line-586"></a><span> </span><span class="hs-glyph">|</span><span> </span><a href="#local-6989586621679038967"><span class="hs-identifier hs-var">y</span></a><span> </span><span class="hs-operator hs-var">&gt;=</span><span> </span><span class="hs-special">(</span><a href="#local-6989586621679038966"><span class="hs-identifier hs-var">x</span></a><span> </span><span class="hs-operator hs-var">*</span><span> </span><a href="#local-6989586621679038964"><span class="hs-identifier hs-var">offset</span></a><span class="hs-special">)</span><span> </span><span class="hs-operator hs-var">&amp;&amp;</span><span> </span><a href="#local-6989586621679038967"><span class="hs-identifier hs-var">y</span></a><span> </span><span class="hs-operator hs-var">&lt;=</span><span> </span><span class="hs-special">(</span><a href="#local-6989586621679038966"><span class="hs-identifier hs-var">x</span></a><span> </span><span class="hs-operator hs-var">*</span><span> </span><a href="#local-6989586621679038964"><span class="hs-identifier hs-var">offset</span></a><span> </span><span class="hs-operator hs-var">+</span><span> </span><a href="#local-6989586621679038964"><span class="hs-identifier hs-var">offset</span></a><span> </span><span class="hs-glyph">-</span><span> </span><span class="hs-number">1</span><span class="hs-special">)</span><span> </span><span class="hs-glyph">=</span><span> </span><span class="hs-number">1</span><span>
587+</span><a name="line-587"></a><span> </span><span class="hs-glyph">|</span><span> </span><span class="hs-identifier hs-var">otherwise</span><span> </span><span class="hs-glyph">=</span><span> </span><span class="hs-number">0</span><span>
588+</span><a name="line-588"></a><span>
589+</span><a name="line-589"></a><span class="hs-comment">-- | Khatri Rao product second component projection matrix.</span><span>
590+</span><a name="line-590"></a><span class="hs-identifier">kp2</span><span> </span><span class="hs-glyph">::</span><span>
591+</span><a name="line-591"></a><span> </span><span class="hs-keyword">forall</span><span> </span><a name="local-6989586621679038628"><a href="#local-6989586621679038628"><span class="hs-identifier">e</span></a></a><span> </span><a name="local-6989586621679038629"><a href="#local-6989586621679038629"><span class="hs-identifier">m</span></a></a><span> </span><a name="local-6989586621679038630"><a href="#local-6989586621679038630"><span class="hs-identifier">k</span></a></a><span> </span><span class="hs-operator">.</span><span>
592+</span><a name="line-592"></a><span> </span><span class="hs-special">(</span><span> </span><span class="hs-identifier hs-type">Num</span><span> </span><a href="#local-6989586621679038628"><span class="hs-identifier hs-type">e</span></a><span class="hs-special">,</span><span>
593+</span><a name="line-593"></a><span> </span><span class="hs-identifier hs-type">KnownNat</span><span> </span><span class="hs-special">(</span><a href="Matrix.Internal.html#Count"><span class="hs-identifier hs-type">Count</span></a><span> </span><a href="#local-6989586621679038630"><span class="hs-identifier hs-type">k</span></a><span class="hs-special">)</span><span class="hs-special">,</span><span>
594+</span><a name="line-594"></a><span> </span><a href="Matrix.Internal.html#FromLists"><span class="hs-identifier hs-type">FromLists</span></a><span> </span><a href="#local-6989586621679038628"><span class="hs-identifier hs-type">e</span></a><span> </span><span class="hs-special">(</span><a href="Matrix.Internal.html#FromNat"><span class="hs-identifier hs-type">FromNat</span></a><span> </span><span class="hs-special">(</span><span class="hs-identifier hs-type">Count</span><span> </span><a href="#local-6989586621679038629"><span class="hs-identifier hs-type">m</span></a><span> </span><span class="hs-operator">*</span><span> </span><a href="Matrix.Internal.html#Count"><span class="hs-identifier hs-type">Count</span></a><span> </span><a href="#local-6989586621679038630"><span class="hs-identifier hs-type">k</span></a><span class="hs-special">)</span><span class="hs-special">)</span><span> </span><a href="#local-6989586621679038630"><span class="hs-identifier hs-type">k</span></a><span class="hs-special">,</span><span>
595+</span><a name="line-595"></a><span> </span><span class="hs-identifier hs-type">KnownNat</span><span> </span><span class="hs-special">(</span><a href="Matrix.Internal.html#Count"><span class="hs-identifier hs-type">Count</span></a><span> </span><a href="#local-6989586621679038629"><span class="hs-identifier hs-type">m</span></a><span class="hs-special">)</span><span class="hs-special">,</span><span>
596+</span><a name="line-596"></a><span> </span><span class="hs-identifier hs-type">KnownNat</span><span> </span><span class="hs-special">(</span><a href="Matrix.Internal.html#Count"><span class="hs-identifier hs-type">Count</span></a><span> </span><span class="hs-special">(</span><a href="Matrix.Internal.html#Normalize"><span class="hs-identifier hs-type">Normalize</span></a><span> </span><span class="hs-special">(</span><a href="#local-6989586621679038629"><span class="hs-identifier hs-type">m</span></a><span class="hs-special">,</span><span> </span><a href="#local-6989586621679038630"><span class="hs-identifier hs-type">k</span></a><span class="hs-special">)</span><span class="hs-special">)</span><span class="hs-special">)</span><span>
597+</span><a name="line-597"></a><span> </span><span class="hs-special">)</span><span> </span><span class="hs-glyph">=&gt;</span><span> </span><a href="Matrix.Internal.html#Matrix"><span class="hs-identifier hs-type">Matrix</span></a><span> </span><a href="#local-6989586621679038628"><span class="hs-identifier hs-type">e</span></a><span> </span><span class="hs-special">(</span><a href="Matrix.Internal.html#Normalize"><span class="hs-identifier hs-type">Normalize</span></a><span> </span><span class="hs-special">(</span><a href="#local-6989586621679038629"><span class="hs-identifier hs-type">m</span></a><span class="hs-special">,</span><span> </span><a href="#local-6989586621679038630"><span class="hs-identifier hs-type">k</span></a><span class="hs-special">)</span><span class="hs-special">)</span><span> </span><a href="#local-6989586621679038630"><span class="hs-identifier hs-type">k</span></a><span>
598+</span><a name="line-598"></a><a name="kp2"><a href="Matrix.Internal.html#kp2"><span class="hs-identifier">kp2</span></a></a><span> </span><span class="hs-glyph">=</span><span> </span><a href="Matrix.Internal.html#matrixBuilder"><span class="hs-identifier hs-var">matrixBuilder</span></a><span> </span><a href="#local-6989586621679038969"><span class="hs-identifier hs-var">f</span></a><span>
599+</span><a name="line-599"></a><span> </span><span class="hs-keyword">where</span><span>
600+</span><a name="line-600"></a><span> </span><a name="local-6989586621679038968"><a href="#local-6989586621679038968"><span class="hs-identifier">offset</span></a></a><span> </span><span class="hs-glyph">=</span><span> </span><span class="hs-identifier hs-var">fromInteger</span><span> </span><span class="hs-special">(</span><span class="hs-identifier hs-var">natVal</span><span> </span><span class="hs-special">(</span><span class="hs-identifier hs-var">Proxy</span><span> </span><span class="hs-glyph">::</span><span> </span><span class="hs-identifier hs-type">Proxy</span><span> </span><span class="hs-special">(</span><a href="Matrix.Internal.html#Count"><span class="hs-identifier hs-type">Count</span></a><span> </span><a href="#local-6989586621679038630"><span class="hs-identifier hs-type">k</span></a><span class="hs-special">)</span><span class="hs-special">)</span><span class="hs-special">)</span><span>
601+</span><a name="line-601"></a><span> </span><a name="local-6989586621679038969"><a href="#local-6989586621679038969"><span class="hs-identifier">f</span></a></a><span> </span><span class="hs-special">(</span><a name="local-6989586621679038970"><a href="#local-6989586621679038970"><span class="hs-identifier">x</span></a></a><span class="hs-special">,</span><span> </span><a name="local-6989586621679038971"><a href="#local-6989586621679038971"><span class="hs-identifier">y</span></a></a><span class="hs-special">)</span><span>
602+</span><a name="line-602"></a><span> </span><span class="hs-glyph">|</span><span> </span><a href="#local-6989586621679038970"><span class="hs-identifier hs-var">x</span></a><span> </span><span class="hs-operator hs-var">==</span><span> </span><a href="#local-6989586621679038971"><span class="hs-identifier hs-var">y</span></a><span> </span><span class="hs-operator hs-var">||</span><span> </span><span class="hs-identifier hs-var">mod</span><span> </span><span class="hs-special">(</span><a href="#local-6989586621679038971"><span class="hs-identifier hs-var">y</span></a><span> </span><span class="hs-glyph">-</span><span> </span><a href="#local-6989586621679038970"><span class="hs-identifier hs-var">x</span></a><span class="hs-special">)</span><span> </span><a href="#local-6989586621679038968"><span class="hs-identifier hs-var">offset</span></a><span> </span><span class="hs-operator hs-var">==</span><span> </span><span class="hs-number">0</span><span> </span><span class="hs-glyph">=</span><span> </span><span class="hs-number">1</span><span>
603+</span><a name="line-603"></a><span> </span><span class="hs-glyph">|</span><span> </span><span class="hs-identifier hs-var">otherwise</span><span> </span><span class="hs-glyph">=</span><span> </span><span class="hs-number">0</span><span>
604+</span><a name="line-604"></a><span>
605+</span><a name="line-605"></a><span class="hs-comment">-- | Khatri Rao Matrix product also known as matrix pairing.</span><span>
606+</span><a name="line-606"></a><span class="hs-comment">--</span><span>
607+</span><a name="line-607"></a><span class="hs-comment">-- NOTE: That this is not a true categorical product, see for instance:</span><span>
608+</span><a name="line-608"></a><span class="hs-comment">-- </span><span>
609+</span><a name="line-609"></a><span class="hs-comment">-- @</span><span>
610+</span><a name="line-610"></a><span class="hs-comment">-- | kp1 . khatri a b == a </span><span>
611+</span><a name="line-611"></a><span class="hs-comment">-- khatri a b ==&gt; |</span><span>
612+</span><a name="line-612"></a><span class="hs-comment">-- | kp2 . khatri a b == b</span><span>
613+</span><a name="line-613"></a><span class="hs-comment">-- @</span><span>
614+</span><a name="line-614"></a><span class="hs-comment">--</span><span>
615+</span><a name="line-615"></a><span class="hs-comment">-- __Emphasis__ on the implication symbol.</span><span>
616+</span><a name="line-616"></a><span class="hs-identifier">khatri</span><span> </span><span class="hs-glyph">::</span><span>
617+</span><a name="line-617"></a><span> </span><span class="hs-keyword">forall</span><span> </span><a name="local-6989586621679038624"><a href="#local-6989586621679038624"><span class="hs-identifier">e</span></a></a><span> </span><a name="local-6989586621679038625"><a href="#local-6989586621679038625"><span class="hs-identifier">cols</span></a></a><span> </span><a name="local-6989586621679038626"><a href="#local-6989586621679038626"><span class="hs-identifier">a</span></a></a><span> </span><a name="local-6989586621679038627"><a href="#local-6989586621679038627"><span class="hs-identifier">b</span></a></a><span class="hs-operator">.</span><span>
618+</span><a name="line-618"></a><span> </span><span class="hs-special">(</span><span> </span><span class="hs-identifier hs-type">Num</span><span> </span><a href="#local-6989586621679038624"><span class="hs-identifier hs-type">e</span></a><span class="hs-special">,</span><span>
619+</span><a name="line-619"></a><span> </span><span class="hs-identifier hs-type">KnownNat</span><span> </span><span class="hs-special">(</span><a href="Matrix.Internal.html#Count"><span class="hs-identifier hs-type">Count</span></a><span> </span><a href="#local-6989586621679038626"><span class="hs-identifier hs-type">a</span></a><span class="hs-special">)</span><span class="hs-special">,</span><span>
620+</span><a name="line-620"></a><span> </span><span class="hs-identifier hs-type">KnownNat</span><span> </span><span class="hs-special">(</span><a href="Matrix.Internal.html#Count"><span class="hs-identifier hs-type">Count</span></a><span> </span><a href="#local-6989586621679038627"><span class="hs-identifier hs-type">b</span></a><span class="hs-special">)</span><span class="hs-special">,</span><span>
621+</span><a name="line-621"></a><span> </span><span class="hs-identifier hs-type">KnownNat</span><span> </span><span class="hs-special">(</span><a href="Matrix.Internal.html#Count"><span class="hs-identifier hs-type">Count</span></a><span> </span><span class="hs-special">(</span><a href="Matrix.Internal.html#Normalize"><span class="hs-identifier hs-type">Normalize</span></a><span> </span><span class="hs-special">(</span><a href="#local-6989586621679038626"><span class="hs-identifier hs-type">a</span></a><span class="hs-special">,</span><span> </span><a href="#local-6989586621679038627"><span class="hs-identifier hs-type">b</span></a><span class="hs-special">)</span><span class="hs-special">)</span><span class="hs-special">)</span><span class="hs-special">,</span><span>
622+</span><a name="line-622"></a><span> </span><a href="Matrix.Internal.html#FromLists"><span class="hs-identifier hs-type">FromLists</span></a><span> </span><a href="#local-6989586621679038624"><span class="hs-identifier hs-type">e</span></a><span> </span><span class="hs-special">(</span><a href="Matrix.Internal.html#Normalize"><span class="hs-identifier hs-type">Normalize</span></a><span> </span><span class="hs-special">(</span><a href="#local-6989586621679038626"><span class="hs-identifier hs-type">a</span></a><span class="hs-special">,</span><span> </span><a href="#local-6989586621679038627"><span class="hs-identifier hs-type">b</span></a><span class="hs-special">)</span><span class="hs-special">)</span><span> </span><a href="#local-6989586621679038626"><span class="hs-identifier hs-type">a</span></a><span class="hs-special">,</span><span>
623+</span><a name="line-623"></a><span> </span><a href="Matrix.Internal.html#FromLists"><span class="hs-identifier hs-type">FromLists</span></a><span> </span><a href="#local-6989586621679038624"><span class="hs-identifier hs-type">e</span></a><span> </span><span class="hs-special">(</span><a href="Matrix.Internal.html#Normalize"><span class="hs-identifier hs-type">Normalize</span></a><span> </span><span class="hs-special">(</span><a href="#local-6989586621679038626"><span class="hs-identifier hs-type">a</span></a><span class="hs-special">,</span><span> </span><a href="#local-6989586621679038627"><span class="hs-identifier hs-type">b</span></a><span class="hs-special">)</span><span class="hs-special">)</span><span> </span><a href="#local-6989586621679038627"><span class="hs-identifier hs-type">b</span></a><span>
624+</span><a name="line-624"></a><span> </span><span class="hs-special">)</span><span> </span><span class="hs-glyph">=&gt;</span><span> </span><a href="Matrix.Internal.html#Matrix"><span class="hs-identifier hs-type">Matrix</span></a><span> </span><a href="#local-6989586621679038624"><span class="hs-identifier hs-type">e</span></a><span> </span><a href="#local-6989586621679038625"><span class="hs-identifier hs-type">cols</span></a><span> </span><a href="#local-6989586621679038626"><span class="hs-identifier hs-type">a</span></a><span> </span><span class="hs-glyph">-&gt;</span><span> </span><a href="Matrix.Internal.html#Matrix"><span class="hs-identifier hs-type">Matrix</span></a><span> </span><a href="#local-6989586621679038624"><span class="hs-identifier hs-type">e</span></a><span> </span><a href="#local-6989586621679038625"><span class="hs-identifier hs-type">cols</span></a><span> </span><a href="#local-6989586621679038627"><span class="hs-identifier hs-type">b</span></a><span> </span><span class="hs-glyph">-&gt;</span><span> </span><a href="Matrix.Internal.html#Matrix"><span class="hs-identifier hs-type">Matrix</span></a><span> </span><a href="#local-6989586621679038624"><span class="hs-identifier hs-type">e</span></a><span> </span><a href="#local-6989586621679038625"><span class="hs-identifier hs-type">cols</span></a><span> </span><span class="hs-special">(</span><a href="Matrix.Internal.html#Normalize"><span class="hs-identifier hs-type">Normalize</span></a><span> </span><span class="hs-special">(</span><a href="#local-6989586621679038626"><span class="hs-identifier hs-type">a</span></a><span class="hs-special">,</span><span> </span><a href="#local-6989586621679038627"><span class="hs-identifier hs-type">b</span></a><span class="hs-special">)</span><span class="hs-special">)</span><span>
625+</span><a name="line-625"></a><a name="khatri"><a href="Matrix.Internal.html#khatri"><span class="hs-identifier">khatri</span></a></a><span> </span><a name="local-6989586621679038972"><a href="#local-6989586621679038972"><span class="hs-identifier">a</span></a></a><span> </span><a name="local-6989586621679038973"><a href="#local-6989586621679038973"><span class="hs-identifier">b</span></a></a><span> </span><span class="hs-glyph">=</span><span>
626+</span><a name="line-626"></a><span> </span><span class="hs-keyword">let</span><span> </span><a name="local-6989586621679038974"><a href="#local-6989586621679038974"><span class="hs-identifier">kp1'</span></a></a><span> </span><span class="hs-glyph">=</span><span> </span><a href="Matrix.Internal.html#kp1"><span class="hs-identifier hs-var">kp1</span></a><span> </span><span class="hs-glyph">@</span><a href="#local-6989586621679038624"><span class="hs-identifier hs-type">e</span></a><span> </span><span class="hs-glyph">@</span><a href="#local-6989586621679038626"><span class="hs-identifier hs-type">a</span></a><span> </span><span class="hs-glyph">@</span><a href="#local-6989586621679038627"><span class="hs-identifier hs-type">b</span></a><span>
627+</span><a name="line-627"></a><span> </span><a name="local-6989586621679038975"><a href="#local-6989586621679038975"><span class="hs-identifier">kp2'</span></a></a><span> </span><span class="hs-glyph">=</span><span> </span><a href="Matrix.Internal.html#kp2"><span class="hs-identifier hs-var">kp2</span></a><span> </span><span class="hs-glyph">@</span><a href="#local-6989586621679038624"><span class="hs-identifier hs-type">e</span></a><span> </span><span class="hs-glyph">@</span><a href="#local-6989586621679038626"><span class="hs-identifier hs-type">a</span></a><span> </span><span class="hs-glyph">@</span><a href="#local-6989586621679038627"><span class="hs-identifier hs-type">b</span></a><span>
628+</span><a name="line-628"></a><span> </span><span class="hs-keyword">in</span><span> </span><span class="hs-special">(</span><a href="Matrix.Internal.html#tr"><span class="hs-identifier hs-var">tr</span></a><span> </span><a href="#local-6989586621679038974"><span class="hs-identifier hs-var">kp1'</span></a><span class="hs-special">)</span><span> </span><span class="hs-operator hs-var">.</span><span> </span><a href="#local-6989586621679038972"><span class="hs-identifier hs-var">a</span></a><span> </span><span class="hs-operator hs-var">*</span><span> </span><span class="hs-special">(</span><a href="Matrix.Internal.html#tr"><span class="hs-identifier hs-var">tr</span></a><span> </span><a href="#local-6989586621679038975"><span class="hs-identifier hs-var">kp2'</span></a><span class="hs-special">)</span><span> </span><span class="hs-operator hs-var">.</span><span> </span><a href="#local-6989586621679038973"><span class="hs-identifier hs-var">b</span></a><span>
629+</span><a name="line-629"></a><span>
630+</span><a name="line-630"></a><span class="hs-comment">-- Product Bifunctor (Kronecker)</span><span>
631+</span><a name="line-631"></a><span>
632+</span><a name="line-632"></a><span class="hs-keyword">infixl</span><span> </span><span class="hs-number">4</span><span> </span><a href="Matrix.Internal.html#%3E%3C"><span class="hs-operator hs-var">&gt;&lt;</span></a><span>
633+</span><a name="line-633"></a><span>
634+</span><a name="line-634"></a><span class="hs-comment">-- | Matrix product functor also known as kronecker product</span><span>
635+</span><a name="line-635"></a><span class="hs-special">(</span><span class="hs-operator">&gt;&lt;</span><span class="hs-special">)</span><span> </span><span class="hs-glyph">::</span><span>
636+</span><a name="line-636"></a><span> </span><span class="hs-keyword">forall</span><span> </span><a name="local-6989586621679038619"><a href="#local-6989586621679038619"><span class="hs-identifier">e</span></a></a><span> </span><a name="local-6989586621679038620"><a href="#local-6989586621679038620"><span class="hs-identifier">m</span></a></a><span> </span><a name="local-6989586621679038621"><a href="#local-6989586621679038621"><span class="hs-identifier">p</span></a></a><span> </span><a name="local-6989586621679038622"><a href="#local-6989586621679038622"><span class="hs-identifier">n</span></a></a><span> </span><a name="local-6989586621679038623"><a href="#local-6989586621679038623"><span class="hs-identifier">q</span></a></a><span class="hs-operator">.</span><span>
637+</span><a name="line-637"></a><span> </span><span class="hs-special">(</span><span> </span><span class="hs-identifier hs-type">Num</span><span> </span><a href="#local-6989586621679038619"><span class="hs-identifier hs-type">e</span></a><span class="hs-special">,</span><span>
638+</span><a name="line-638"></a><span> </span><span class="hs-identifier hs-type">KnownNat</span><span> </span><span class="hs-special">(</span><a href="Matrix.Internal.html#Count"><span class="hs-identifier hs-type">Count</span></a><span> </span><a href="#local-6989586621679038620"><span class="hs-identifier hs-type">m</span></a><span class="hs-special">)</span><span class="hs-special">,</span><span>
639+</span><a name="line-639"></a><span> </span><span class="hs-identifier hs-type">KnownNat</span><span> </span><span class="hs-special">(</span><a href="Matrix.Internal.html#Count"><span class="hs-identifier hs-type">Count</span></a><span> </span><a href="#local-6989586621679038622"><span class="hs-identifier hs-type">n</span></a><span class="hs-special">)</span><span class="hs-special">,</span><span>
640+</span><a name="line-640"></a><span> </span><span class="hs-identifier hs-type">KnownNat</span><span> </span><span class="hs-special">(</span><a href="Matrix.Internal.html#Count"><span class="hs-identifier hs-type">Count</span></a><span> </span><a href="#local-6989586621679038621"><span class="hs-identifier hs-type">p</span></a><span class="hs-special">)</span><span class="hs-special">,</span><span>
641+</span><a name="line-641"></a><span> </span><span class="hs-identifier hs-type">KnownNat</span><span> </span><span class="hs-special">(</span><a href="Matrix.Internal.html#Count"><span class="hs-identifier hs-type">Count</span></a><span> </span><a href="#local-6989586621679038623"><span class="hs-identifier hs-type">q</span></a><span class="hs-special">)</span><span class="hs-special">,</span><span>
642+</span><a name="line-642"></a><span> </span><span class="hs-identifier hs-type">KnownNat</span><span> </span><span class="hs-special">(</span><a href="Matrix.Internal.html#Count"><span class="hs-identifier hs-type">Count</span></a><span> </span><span class="hs-special">(</span><a href="Matrix.Internal.html#Normalize"><span class="hs-identifier hs-type">Normalize</span></a><span> </span><span class="hs-special">(</span><a href="#local-6989586621679038620"><span class="hs-identifier hs-type">m</span></a><span class="hs-special">,</span><span> </span><a href="#local-6989586621679038622"><span class="hs-identifier hs-type">n</span></a><span class="hs-special">)</span><span class="hs-special">)</span><span class="hs-special">)</span><span class="hs-special">,</span><span>
643+</span><a name="line-643"></a><span> </span><a href="Matrix.Internal.html#FromLists"><span class="hs-identifier hs-type">FromLists</span></a><span> </span><a href="#local-6989586621679038619"><span class="hs-identifier hs-type">e</span></a><span> </span><span class="hs-special">(</span><a href="Matrix.Internal.html#Normalize"><span class="hs-identifier hs-type">Normalize</span></a><span> </span><span class="hs-special">(</span><a href="#local-6989586621679038620"><span class="hs-identifier hs-type">m</span></a><span class="hs-special">,</span><span> </span><a href="#local-6989586621679038622"><span class="hs-identifier hs-type">n</span></a><span class="hs-special">)</span><span class="hs-special">)</span><span> </span><a href="#local-6989586621679038620"><span class="hs-identifier hs-type">m</span></a><span class="hs-special">,</span><span>
644+</span><a name="line-644"></a><span> </span><a href="Matrix.Internal.html#FromLists"><span class="hs-identifier hs-type">FromLists</span></a><span> </span><a href="#local-6989586621679038619"><span class="hs-identifier hs-type">e</span></a><span> </span><span class="hs-special">(</span><a href="Matrix.Internal.html#Normalize"><span class="hs-identifier hs-type">Normalize</span></a><span> </span><span class="hs-special">(</span><a href="#local-6989586621679038620"><span class="hs-identifier hs-type">m</span></a><span class="hs-special">,</span><span> </span><a href="#local-6989586621679038622"><span class="hs-identifier hs-type">n</span></a><span class="hs-special">)</span><span class="hs-special">)</span><span> </span><a href="#local-6989586621679038622"><span class="hs-identifier hs-type">n</span></a><span class="hs-special">,</span><span>
645+</span><a name="line-645"></a><span> </span><span class="hs-identifier hs-type">KnownNat</span><span> </span><span class="hs-special">(</span><a href="Matrix.Internal.html#Count"><span class="hs-identifier hs-type">Count</span></a><span> </span><span class="hs-special">(</span><a href="Matrix.Internal.html#Normalize"><span class="hs-identifier hs-type">Normalize</span></a><span> </span><span class="hs-special">(</span><a href="#local-6989586621679038621"><span class="hs-identifier hs-type">p</span></a><span class="hs-special">,</span><span> </span><a href="#local-6989586621679038623"><span class="hs-identifier hs-type">q</span></a><span class="hs-special">)</span><span class="hs-special">)</span><span class="hs-special">)</span><span class="hs-special">,</span><span>
646+</span><a name="line-646"></a><span> </span><a href="Matrix.Internal.html#FromLists"><span class="hs-identifier hs-type">FromLists</span></a><span> </span><a href="#local-6989586621679038619"><span class="hs-identifier hs-type">e</span></a><span> </span><span class="hs-special">(</span><a href="Matrix.Internal.html#Normalize"><span class="hs-identifier hs-type">Normalize</span></a><span> </span><span class="hs-special">(</span><a href="#local-6989586621679038621"><span class="hs-identifier hs-type">p</span></a><span class="hs-special">,</span><span> </span><a href="#local-6989586621679038623"><span class="hs-identifier hs-type">q</span></a><span class="hs-special">)</span><span class="hs-special">)</span><span> </span><a href="#local-6989586621679038621"><span class="hs-identifier hs-type">p</span></a><span class="hs-special">,</span><span>
647+</span><a name="line-647"></a><span> </span><a href="Matrix.Internal.html#FromLists"><span class="hs-identifier hs-type">FromLists</span></a><span> </span><a href="#local-6989586621679038619"><span class="hs-identifier hs-type">e</span></a><span> </span><span class="hs-special">(</span><a href="Matrix.Internal.html#Normalize"><span class="hs-identifier hs-type">Normalize</span></a><span> </span><span class="hs-special">(</span><a href="#local-6989586621679038621"><span class="hs-identifier hs-type">p</span></a><span class="hs-special">,</span><span> </span><a href="#local-6989586621679038623"><span class="hs-identifier hs-type">q</span></a><span class="hs-special">)</span><span class="hs-special">)</span><span> </span><a href="#local-6989586621679038623"><span class="hs-identifier hs-type">q</span></a><span>
648+</span><a name="line-648"></a><span> </span><span class="hs-special">)</span><span>
649+</span><a name="line-649"></a><span> </span><span class="hs-glyph">=&gt;</span><span> </span><a href="Matrix.Internal.html#Matrix"><span class="hs-identifier hs-type">Matrix</span></a><span> </span><a href="#local-6989586621679038619"><span class="hs-identifier hs-type">e</span></a><span> </span><a href="#local-6989586621679038620"><span class="hs-identifier hs-type">m</span></a><span> </span><a href="#local-6989586621679038621"><span class="hs-identifier hs-type">p</span></a><span> </span><span class="hs-glyph">-&gt;</span><span> </span><a href="Matrix.Internal.html#Matrix"><span class="hs-identifier hs-type">Matrix</span></a><span> </span><a href="#local-6989586621679038619"><span class="hs-identifier hs-type">e</span></a><span> </span><a href="#local-6989586621679038622"><span class="hs-identifier hs-type">n</span></a><span> </span><a href="#local-6989586621679038623"><span class="hs-identifier hs-type">q</span></a><span> </span><span class="hs-glyph">-&gt;</span><span> </span><a href="Matrix.Internal.html#Matrix"><span class="hs-identifier hs-type">Matrix</span></a><span> </span><a href="#local-6989586621679038619"><span class="hs-identifier hs-type">e</span></a><span> </span><span class="hs-special">(</span><a href="Matrix.Internal.html#Normalize"><span class="hs-identifier hs-type">Normalize</span></a><span> </span><span class="hs-special">(</span><a href="#local-6989586621679038620"><span class="hs-identifier hs-type">m</span></a><span class="hs-special">,</span><span> </span><a href="#local-6989586621679038622"><span class="hs-identifier hs-type">n</span></a><span class="hs-special">)</span><span class="hs-special">)</span><span> </span><span class="hs-special">(</span><a href="Matrix.Internal.html#Normalize"><span class="hs-identifier hs-type">Normalize</span></a><span> </span><span class="hs-special">(</span><a href="#local-6989586621679038621"><span class="hs-identifier hs-type">p</span></a><span class="hs-special">,</span><span> </span><a href="#local-6989586621679038623"><span class="hs-identifier hs-type">q</span></a><span class="hs-special">)</span><span class="hs-special">)</span><span>
650+</span><a name="line-650"></a><span class="hs-special">(</span><a name="%3E%3C"><a href="Matrix.Internal.html#%3E%3C"><span class="hs-operator">&gt;&lt;</span></a></a><span class="hs-special">)</span><span> </span><a name="local-6989586621679038976"><a href="#local-6989586621679038976"><span class="hs-identifier">a</span></a></a><span> </span><a name="local-6989586621679038977"><a href="#local-6989586621679038977"><span class="hs-identifier">b</span></a></a><span> </span><span class="hs-glyph">=</span><span>
651+</span><a name="line-651"></a><span> </span><span class="hs-keyword">let</span><span> </span><a name="local-6989586621679038978"><a href="#local-6989586621679038978"><span class="hs-identifier">kp1'</span></a></a><span> </span><span class="hs-glyph">=</span><span> </span><a href="Matrix.Internal.html#kp1"><span class="hs-identifier hs-var">kp1</span></a><span> </span><span class="hs-glyph">@</span><a href="#local-6989586621679038619"><span class="hs-identifier hs-type">e</span></a><span> </span><span class="hs-glyph">@</span><a href="#local-6989586621679038620"><span class="hs-identifier hs-type">m</span></a><span> </span><span class="hs-glyph">@</span><a href="#local-6989586621679038622"><span class="hs-identifier hs-type">n</span></a><span>
652+</span><a name="line-652"></a><span> </span><a name="local-6989586621679038979"><a href="#local-6989586621679038979"><span class="hs-identifier">kp2'</span></a></a><span> </span><span class="hs-glyph">=</span><span> </span><a href="Matrix.Internal.html#kp2"><span class="hs-identifier hs-var">kp2</span></a><span> </span><span class="hs-glyph">@</span><a href="#local-6989586621679038619"><span class="hs-identifier hs-type">e</span></a><span> </span><span class="hs-glyph">@</span><a href="#local-6989586621679038620"><span class="hs-identifier hs-type">m</span></a><span> </span><span class="hs-glyph">@</span><a href="#local-6989586621679038622"><span class="hs-identifier hs-type">n</span></a><span>
653+</span><a name="line-653"></a><span> </span><span class="hs-keyword">in</span><span> </span><a href="Matrix.Internal.html#khatri"><span class="hs-identifier hs-var">khatri</span></a><span> </span><span class="hs-special">(</span><a href="#local-6989586621679038976"><span class="hs-identifier hs-var">a</span></a><span> </span><span class="hs-operator hs-var">.</span><span> </span><a href="#local-6989586621679038978"><span class="hs-identifier hs-var">kp1'</span></a><span class="hs-special">)</span><span> </span><span class="hs-special">(</span><a href="#local-6989586621679038977"><span class="hs-identifier hs-var">b</span></a><span> </span><span class="hs-operator hs-var">.</span><span> </span><a href="#local-6989586621679038979"><span class="hs-identifier hs-var">kp2'</span></a><span class="hs-special">)</span><span>
654+</span><a name="line-654"></a><span>
655+</span><a name="line-655"></a><span class="hs-comment">-- Matrix abide Junc Split</span><span>
656+</span><a name="line-656"></a><span>
657+</span><a name="line-657"></a><span class="hs-comment">-- | Matrix &quot;abiding&quot; followin the 'Junc'-'Split' abide law.</span><span>
658+</span><a name="line-658"></a><span class="hs-comment">-- </span><span>
659+</span><a name="line-659"></a><span class="hs-comment">-- Law:</span><span>
660+</span><a name="line-660"></a><span class="hs-comment">--</span><span>
661+</span><a name="line-661"></a><span class="hs-comment">-- @</span><span>
662+</span><a name="line-662"></a><span class="hs-comment">-- 'Junc' ('Split' a c) ('Split' b d) == 'Split' ('Junc' a b) ('Junc' c d)</span><span>
663+</span><a name="line-663"></a><span class="hs-comment">-- @</span><span>
664+</span><a name="line-664"></a><span class="hs-identifier">abideJS</span><span> </span><span class="hs-glyph">::</span><span> </span><a href="Matrix.Internal.html#Matrix"><span class="hs-identifier hs-type">Matrix</span></a><span> </span><a href="#local-6989586621679038616"><span class="hs-identifier hs-type">e</span></a><span> </span><a href="#local-6989586621679038617"><span class="hs-identifier hs-type">cols</span></a><span> </span><a href="#local-6989586621679038618"><span class="hs-identifier hs-type">rows</span></a><span> </span><span class="hs-glyph">-&gt;</span><span> </span><a href="Matrix.Internal.html#Matrix"><span class="hs-identifier hs-type">Matrix</span></a><span> </span><a href="#local-6989586621679038616"><span class="hs-identifier hs-type">e</span></a><span> </span><a href="#local-6989586621679038617"><span class="hs-identifier hs-type">cols</span></a><span> </span><a href="#local-6989586621679038618"><span class="hs-identifier hs-type">rows</span></a><span>
665+</span><a name="line-665"></a><a name="abideJS"><a href="Matrix.Internal.html#abideJS"><span class="hs-identifier">abideJS</span></a></a><span> </span><span class="hs-special">(</span><a href="Matrix.Internal.html#Junc"><span class="hs-identifier hs-var">Junc</span></a><span> </span><span class="hs-special">(</span><a href="Matrix.Internal.html#Split"><span class="hs-identifier hs-var">Split</span></a><span> </span><a name="local-6989586621679038980"><a href="#local-6989586621679038980"><span class="hs-identifier">a</span></a></a><span> </span><a name="local-6989586621679038981"><a href="#local-6989586621679038981"><span class="hs-identifier">c</span></a></a><span class="hs-special">)</span><span> </span><span class="hs-special">(</span><a href="Matrix.Internal.html#Split"><span class="hs-identifier hs-var">Split</span></a><span> </span><a name="local-6989586621679038982"><a href="#local-6989586621679038982"><span class="hs-identifier">b</span></a></a><span> </span><a name="local-6989586621679038983"><a href="#local-6989586621679038983"><span class="hs-identifier">d</span></a></a><span class="hs-special">)</span><span class="hs-special">)</span><span> </span><span class="hs-glyph">=</span><span> </span><a href="Matrix.Internal.html#Split"><span class="hs-identifier hs-var">Split</span></a><span> </span><span class="hs-special">(</span><a href="Matrix.Internal.html#Junc"><span class="hs-identifier hs-var">Junc</span></a><span> </span><span class="hs-special">(</span><a href="Matrix.Internal.html#abideJS"><span class="hs-identifier hs-var">abideJS</span></a><span> </span><a href="#local-6989586621679038980"><span class="hs-identifier hs-var">a</span></a><span class="hs-special">)</span><span> </span><span class="hs-special">(</span><a href="Matrix.Internal.html#abideJS"><span class="hs-identifier hs-var">abideJS</span></a><span> </span><a href="#local-6989586621679038982"><span class="hs-identifier hs-var">b</span></a><span class="hs-special">)</span><span class="hs-special">)</span><span> </span><span class="hs-special">(</span><a href="Matrix.Internal.html#Junc"><span class="hs-identifier hs-var">Junc</span></a><span> </span><span class="hs-special">(</span><a href="Matrix.Internal.html#abideJS"><span class="hs-identifier hs-var">abideJS</span></a><span> </span><a href="#local-6989586621679038981"><span class="hs-identifier hs-var">c</span></a><span class="hs-special">)</span><span> </span><span class="hs-special">(</span><a href="Matrix.Internal.html#abideJS"><span class="hs-identifier hs-var">abideJS</span></a><span> </span><a href="#local-6989586621679038983"><span class="hs-identifier hs-var">d</span></a><span class="hs-special">)</span><span class="hs-special">)</span><span> </span><span class="hs-comment">-- Junc-Split abide law</span><span>
666+</span><a name="line-666"></a><span class="hs-identifier">abideJS</span><span> </span><a href="Matrix.Internal.html#Empty"><span class="hs-identifier hs-var">Empty</span></a><span> </span><span class="hs-glyph">=</span><span> </span><a href="Matrix.Internal.html#Empty"><span class="hs-identifier hs-var">Empty</span></a><span>
667+</span><a name="line-667"></a><span class="hs-identifier">abideJS</span><span> </span><span class="hs-special">(</span><a href="Matrix.Internal.html#One"><span class="hs-identifier hs-var">One</span></a><span> </span><a name="local-6989586621679038984"><a href="#local-6989586621679038984"><span class="hs-identifier">e</span></a></a><span class="hs-special">)</span><span> </span><span class="hs-glyph">=</span><span> </span><a href="Matrix.Internal.html#One"><span class="hs-identifier hs-var">One</span></a><span> </span><a href="#local-6989586621679038984"><span class="hs-identifier hs-var">e</span></a><span>
668+</span><a name="line-668"></a><span class="hs-identifier">abideJS</span><span> </span><span class="hs-special">(</span><a href="Matrix.Internal.html#Junc"><span class="hs-identifier hs-var">Junc</span></a><span> </span><a name="local-6989586621679038985"><a href="#local-6989586621679038985"><span class="hs-identifier">a</span></a></a><span> </span><a name="local-6989586621679038986"><a href="#local-6989586621679038986"><span class="hs-identifier">b</span></a></a><span class="hs-special">)</span><span> </span><span class="hs-glyph">=</span><span> </span><a href="Matrix.Internal.html#Junc"><span class="hs-identifier hs-var">Junc</span></a><span> </span><span class="hs-special">(</span><a href="Matrix.Internal.html#abideJS"><span class="hs-identifier hs-var">abideJS</span></a><span> </span><a href="#local-6989586621679038985"><span class="hs-identifier hs-var">a</span></a><span class="hs-special">)</span><span> </span><span class="hs-special">(</span><a href="Matrix.Internal.html#abideJS"><span class="hs-identifier hs-var">abideJS</span></a><span> </span><a href="#local-6989586621679038986"><span class="hs-identifier hs-var">b</span></a><span class="hs-special">)</span><span>
669+</span><a name="line-669"></a><span class="hs-identifier">abideJS</span><span> </span><span class="hs-special">(</span><a href="Matrix.Internal.html#Split"><span class="hs-identifier hs-var">Split</span></a><span> </span><a name="local-6989586621679038987"><a href="#local-6989586621679038987"><span class="hs-identifier">a</span></a></a><span> </span><a name="local-6989586621679038988"><a href="#local-6989586621679038988"><span class="hs-identifier">b</span></a></a><span class="hs-special">)</span><span> </span><span class="hs-glyph">=</span><span> </span><a href="Matrix.Internal.html#Split"><span class="hs-identifier hs-var">Split</span></a><span> </span><span class="hs-special">(</span><a href="Matrix.Internal.html#abideJS"><span class="hs-identifier hs-var">abideJS</span></a><span> </span><a href="#local-6989586621679038987"><span class="hs-identifier hs-var">a</span></a><span class="hs-special">)</span><span> </span><span class="hs-special">(</span><a href="Matrix.Internal.html#abideJS"><span class="hs-identifier hs-var">abideJS</span></a><span> </span><a href="#local-6989586621679038988"><span class="hs-identifier hs-var">b</span></a><span class="hs-special">)</span><span>
670+</span><a name="line-670"></a><span>
671+</span><a name="line-671"></a><span class="hs-comment">-- Matrix abide Split Junc</span><span>
672+</span><a name="line-672"></a><span>
673+</span><a name="line-673"></a><span class="hs-comment">-- | Matrix &quot;abiding&quot; followin the 'Split'-'Junc' abide law.</span><span>
674+</span><a name="line-674"></a><span class="hs-comment">-- </span><span>
675+</span><a name="line-675"></a><span class="hs-comment">-- @</span><span>
676+</span><a name="line-676"></a><span class="hs-comment">-- 'Split' ('Junc' a b) ('Junc' c d) == 'Junc' ('Split' a c) ('Split' b d)</span><span>
677+</span><a name="line-677"></a><span class="hs-comment">-- @</span><span>
678+</span><a name="line-678"></a><span class="hs-identifier">abideSJ</span><span> </span><span class="hs-glyph">::</span><span> </span><a href="Matrix.Internal.html#Matrix"><span class="hs-identifier hs-type">Matrix</span></a><span> </span><a href="#local-6989586621679038613"><span class="hs-identifier hs-type">e</span></a><span> </span><a href="#local-6989586621679038614"><span class="hs-identifier hs-type">cols</span></a><span> </span><a href="#local-6989586621679038615"><span class="hs-identifier hs-type">rows</span></a><span> </span><span class="hs-glyph">-&gt;</span><span> </span><a href="Matrix.Internal.html#Matrix"><span class="hs-identifier hs-type">Matrix</span></a><span> </span><a href="#local-6989586621679038613"><span class="hs-identifier hs-type">e</span></a><span> </span><a href="#local-6989586621679038614"><span class="hs-identifier hs-type">cols</span></a><span> </span><a href="#local-6989586621679038615"><span class="hs-identifier hs-type">rows</span></a><span>
679+</span><a name="line-679"></a><a name="abideSJ"><a href="Matrix.Internal.html#abideSJ"><span class="hs-identifier">abideSJ</span></a></a><span> </span><span class="hs-special">(</span><a href="Matrix.Internal.html#Split"><span class="hs-identifier hs-var">Split</span></a><span> </span><span class="hs-special">(</span><a href="Matrix.Internal.html#Junc"><span class="hs-identifier hs-var">Junc</span></a><span> </span><a name="local-6989586621679038989"><a href="#local-6989586621679038989"><span class="hs-identifier">a</span></a></a><span> </span><a name="local-6989586621679038990"><a href="#local-6989586621679038990"><span class="hs-identifier">b</span></a></a><span class="hs-special">)</span><span> </span><span class="hs-special">(</span><a href="Matrix.Internal.html#Junc"><span class="hs-identifier hs-var">Junc</span></a><span> </span><a name="local-6989586621679038991"><a href="#local-6989586621679038991"><span class="hs-identifier">c</span></a></a><span> </span><a name="local-6989586621679038992"><a href="#local-6989586621679038992"><span class="hs-identifier">d</span></a></a><span class="hs-special">)</span><span class="hs-special">)</span><span> </span><span class="hs-glyph">=</span><span> </span><a href="Matrix.Internal.html#Junc"><span class="hs-identifier hs-var">Junc</span></a><span> </span><span class="hs-special">(</span><a href="Matrix.Internal.html#Split"><span class="hs-identifier hs-var">Split</span></a><span> </span><span class="hs-special">(</span><a href="Matrix.Internal.html#abideSJ"><span class="hs-identifier hs-var">abideSJ</span></a><span> </span><a href="#local-6989586621679038989"><span class="hs-identifier hs-var">a</span></a><span class="hs-special">)</span><span> </span><span class="hs-special">(</span><a href="Matrix.Internal.html#abideSJ"><span class="hs-identifier hs-var">abideSJ</span></a><span> </span><a href="#local-6989586621679038991"><span class="hs-identifier hs-var">c</span></a><span class="hs-special">)</span><span class="hs-special">)</span><span> </span><span class="hs-special">(</span><a href="Matrix.Internal.html#Split"><span class="hs-identifier hs-var">Split</span></a><span> </span><span class="hs-special">(</span><a href="Matrix.Internal.html#abideSJ"><span class="hs-identifier hs-var">abideSJ</span></a><span> </span><a href="#local-6989586621679038990"><span class="hs-identifier hs-var">b</span></a><span class="hs-special">)</span><span> </span><span class="hs-special">(</span><a href="Matrix.Internal.html#abideSJ"><span class="hs-identifier hs-var">abideSJ</span></a><span> </span><a href="#local-6989586621679038992"><span class="hs-identifier hs-var">d</span></a><span class="hs-special">)</span><span class="hs-special">)</span><span> </span><span class="hs-comment">-- Split-Junc abide law</span><span>
680+</span><a name="line-680"></a><span class="hs-identifier">abideSJ</span><span> </span><a href="Matrix.Internal.html#Empty"><span class="hs-identifier hs-var">Empty</span></a><span> </span><span class="hs-glyph">=</span><span> </span><a href="Matrix.Internal.html#Empty"><span class="hs-identifier hs-var">Empty</span></a><span>
681+</span><a name="line-681"></a><span class="hs-identifier">abideSJ</span><span> </span><span class="hs-special">(</span><a href="Matrix.Internal.html#One"><span class="hs-identifier hs-var">One</span></a><span> </span><a name="local-6989586621679038993"><a href="#local-6989586621679038993"><span class="hs-identifier">e</span></a></a><span class="hs-special">)</span><span> </span><span class="hs-glyph">=</span><span> </span><a href="Matrix.Internal.html#One"><span class="hs-identifier hs-var">One</span></a><span> </span><a href="#local-6989586621679038993"><span class="hs-identifier hs-var">e</span></a><span>
682+</span><a name="line-682"></a><span class="hs-identifier">abideSJ</span><span> </span><span class="hs-special">(</span><a href="Matrix.Internal.html#Junc"><span class="hs-identifier hs-var">Junc</span></a><span> </span><a name="local-6989586621679038994"><a href="#local-6989586621679038994"><span class="hs-identifier">a</span></a></a><span> </span><a name="local-6989586621679038995"><a href="#local-6989586621679038995"><span class="hs-identifier">b</span></a></a><span class="hs-special">)</span><span> </span><span class="hs-glyph">=</span><span> </span><a href="Matrix.Internal.html#Junc"><span class="hs-identifier hs-var">Junc</span></a><span> </span><span class="hs-special">(</span><a href="Matrix.Internal.html#abideSJ"><span class="hs-identifier hs-var">abideSJ</span></a><span> </span><a href="#local-6989586621679038994"><span class="hs-identifier hs-var">a</span></a><span class="hs-special">)</span><span> </span><span class="hs-special">(</span><a href="Matrix.Internal.html#abideSJ"><span class="hs-identifier hs-var">abideSJ</span></a><span> </span><a href="#local-6989586621679038995"><span class="hs-identifier hs-var">b</span></a><span class="hs-special">)</span><span>
683+</span><a name="line-683"></a><span class="hs-identifier">abideSJ</span><span> </span><span class="hs-special">(</span><a href="Matrix.Internal.html#Split"><span class="hs-identifier hs-var">Split</span></a><span> </span><a name="local-6989586621679038996"><a href="#local-6989586621679038996"><span class="hs-identifier">a</span></a></a><span> </span><a name="local-6989586621679038997"><a href="#local-6989586621679038997"><span class="hs-identifier">b</span></a></a><span class="hs-special">)</span><span> </span><span class="hs-glyph">=</span><span> </span><a href="Matrix.Internal.html#Split"><span class="hs-identifier hs-var">Split</span></a><span> </span><span class="hs-special">(</span><a href="Matrix.Internal.html#abideSJ"><span class="hs-identifier hs-var">abideSJ</span></a><span> </span><a href="#local-6989586621679038996"><span class="hs-identifier hs-var">a</span></a><span class="hs-special">)</span><span> </span><span class="hs-special">(</span><a href="Matrix.Internal.html#abideSJ"><span class="hs-identifier hs-var">abideSJ</span></a><span> </span><a href="#local-6989586621679038997"><span class="hs-identifier hs-var">b</span></a><span class="hs-special">)</span><span>
684+</span><a name="line-684"></a><span>
685+</span><a name="line-685"></a><span class="hs-comment">-- Matrix transposition</span><span>
686+</span><a name="line-686"></a><span>
687+</span><a name="line-687"></a><span class="hs-comment">-- | Matrix transposition.</span><span>
688+</span><a name="line-688"></a><span class="hs-identifier">tr</span><span> </span><span class="hs-glyph">::</span><span> </span><a href="Matrix.Internal.html#Matrix"><span class="hs-identifier hs-type">Matrix</span></a><span> </span><a href="#local-6989586621679038610"><span class="hs-identifier hs-type">e</span></a><span> </span><a href="#local-6989586621679038611"><span class="hs-identifier hs-type">cols</span></a><span> </span><a href="#local-6989586621679038612"><span class="hs-identifier hs-type">rows</span></a><span> </span><span class="hs-glyph">-&gt;</span><span> </span><a href="Matrix.Internal.html#Matrix"><span class="hs-identifier hs-type">Matrix</span></a><span> </span><a href="#local-6989586621679038610"><span class="hs-identifier hs-type">e</span></a><span> </span><a href="#local-6989586621679038612"><span class="hs-identifier hs-type">rows</span></a><span> </span><a href="#local-6989586621679038611"><span class="hs-identifier hs-type">cols</span></a><span>
689+</span><a name="line-689"></a><a name="tr"><a href="Matrix.Internal.html#tr"><span class="hs-identifier">tr</span></a></a><span> </span><a href="Matrix.Internal.html#Empty"><span class="hs-identifier hs-var">Empty</span></a><span> </span><span class="hs-glyph">=</span><span> </span><a href="Matrix.Internal.html#Empty"><span class="hs-identifier hs-var">Empty</span></a><span>
690+</span><a name="line-690"></a><span class="hs-identifier">tr</span><span> </span><span class="hs-special">(</span><a href="Matrix.Internal.html#One"><span class="hs-identifier hs-var">One</span></a><span> </span><a name="local-6989586621679038998"><a href="#local-6989586621679038998"><span class="hs-identifier">e</span></a></a><span class="hs-special">)</span><span> </span><span class="hs-glyph">=</span><span> </span><a href="Matrix.Internal.html#One"><span class="hs-identifier hs-var">One</span></a><span> </span><a href="#local-6989586621679038998"><span class="hs-identifier hs-var">e</span></a><span>
691+</span><a name="line-691"></a><span class="hs-identifier">tr</span><span> </span><span class="hs-special">(</span><a href="Matrix.Internal.html#Junc"><span class="hs-identifier hs-var">Junc</span></a><span> </span><a name="local-6989586621679038999"><a href="#local-6989586621679038999"><span class="hs-identifier">a</span></a></a><span> </span><a name="local-6989586621679039000"><a href="#local-6989586621679039000"><span class="hs-identifier">b</span></a></a><span class="hs-special">)</span><span> </span><span class="hs-glyph">=</span><span> </span><a href="Matrix.Internal.html#Split"><span class="hs-identifier hs-var">Split</span></a><span> </span><span class="hs-special">(</span><a href="Matrix.Internal.html#tr"><span class="hs-identifier hs-var">tr</span></a><span> </span><a href="#local-6989586621679038999"><span class="hs-identifier hs-var">a</span></a><span class="hs-special">)</span><span> </span><span class="hs-special">(</span><a href="Matrix.Internal.html#tr"><span class="hs-identifier hs-var">tr</span></a><span> </span><a href="#local-6989586621679039000"><span class="hs-identifier hs-var">b</span></a><span class="hs-special">)</span><span>
692+</span><a name="line-692"></a><span class="hs-identifier">tr</span><span> </span><span class="hs-special">(</span><a href="Matrix.Internal.html#Split"><span class="hs-identifier hs-var">Split</span></a><span> </span><a name="local-6989586621679039001"><a href="#local-6989586621679039001"><span class="hs-identifier">a</span></a></a><span> </span><a name="local-6989586621679039002"><a href="#local-6989586621679039002"><span class="hs-identifier">b</span></a></a><span class="hs-special">)</span><span> </span><span class="hs-glyph">=</span><span> </span><a href="Matrix.Internal.html#Junc"><span class="hs-identifier hs-var">Junc</span></a><span> </span><span class="hs-special">(</span><a href="Matrix.Internal.html#tr"><span class="hs-identifier hs-var">tr</span></a><span> </span><a href="#local-6989586621679039001"><span class="hs-identifier hs-var">a</span></a><span class="hs-special">)</span><span> </span><span class="hs-special">(</span><a href="Matrix.Internal.html#tr"><span class="hs-identifier hs-var">tr</span></a><span> </span><a href="#local-6989586621679039002"><span class="hs-identifier hs-var">b</span></a><span class="hs-special">)</span><span>
693+</span><a name="line-693"></a><span>
694+</span><a name="line-694"></a><span class="hs-comment">-- Selective 'select' operator</span><span>
695+</span><a name="line-695"></a><span>
696+</span><a name="line-696"></a><span class="hs-comment">-- | Selective functors 'select' operator equivalent inspired by the</span><span>
697+</span><a name="line-697"></a><span class="hs-comment">-- ArrowMonad solution presented in the paper.</span><span>
698+</span><a name="line-698"></a><span class="hs-identifier">select</span><span> </span><span class="hs-glyph">::</span><span> </span><span class="hs-special">(</span><span class="hs-identifier hs-type">Num</span><span> </span><a href="#local-6989586621679038606"><span class="hs-identifier hs-type">e</span></a><span class="hs-special">,</span><span> </span><a href="Matrix.Internal.html#FromLists"><span class="hs-identifier hs-type">FromLists</span></a><span> </span><a href="#local-6989586621679038606"><span class="hs-identifier hs-type">e</span></a><span> </span><a href="#local-6989586621679038607"><span class="hs-identifier hs-type">b</span></a><span> </span><a href="#local-6989586621679038607"><span class="hs-identifier hs-type">b</span></a><span class="hs-special">,</span><span> </span><span class="hs-identifier hs-type">KnownNat</span><span> </span><span class="hs-special">(</span><a href="Matrix.Internal.html#Count"><span class="hs-identifier hs-type">Count</span></a><span> </span><a href="#local-6989586621679038607"><span class="hs-identifier hs-type">b</span></a><span class="hs-special">)</span><span class="hs-special">)</span><span> </span><span class="hs-glyph">=&gt;</span><span> </span><a href="Matrix.Internal.html#Matrix"><span class="hs-identifier hs-type">Matrix</span></a><span> </span><a href="#local-6989586621679038606"><span class="hs-identifier hs-type">e</span></a><span> </span><a href="#local-6989586621679038608"><span class="hs-identifier hs-type">cols</span></a><span> </span><span class="hs-special">(</span><span class="hs-identifier hs-type">Either</span><span> </span><a href="#local-6989586621679038609"><span class="hs-identifier hs-type">a</span></a><span> </span><a href="#local-6989586621679038607"><span class="hs-identifier hs-type">b</span></a><span class="hs-special">)</span><span> </span><span class="hs-glyph">-&gt;</span><span> </span><a href="Matrix.Internal.html#Matrix"><span class="hs-identifier hs-type">Matrix</span></a><span> </span><a href="#local-6989586621679038606"><span class="hs-identifier hs-type">e</span></a><span> </span><a href="#local-6989586621679038609"><span class="hs-identifier hs-type">a</span></a><span> </span><a href="#local-6989586621679038607"><span class="hs-identifier hs-type">b</span></a><span> </span><span class="hs-glyph">-&gt;</span><span> </span><a href="Matrix.Internal.html#Matrix"><span class="hs-identifier hs-type">Matrix</span></a><span> </span><a href="#local-6989586621679038606"><span class="hs-identifier hs-type">e</span></a><span> </span><a href="#local-6989586621679038608"><span class="hs-identifier hs-type">cols</span></a><span> </span><a href="#local-6989586621679038607"><span class="hs-identifier hs-type">b</span></a><span>
699+</span><a name="line-699"></a><a name="select"><a href="Matrix.Internal.html#select"><span class="hs-identifier">select</span></a></a><span> </span><a name="local-6989586621679039003"><a href="#local-6989586621679039003"><span class="hs-identifier">m</span></a></a><span> </span><a name="local-6989586621679039004"><a href="#local-6989586621679039004"><span class="hs-identifier">y</span></a></a><span> </span><span class="hs-glyph">=</span><span> </span><a href="Matrix.Internal.html#junc"><span class="hs-identifier hs-var">junc</span></a><span> </span><a href="#local-6989586621679039004"><span class="hs-identifier hs-var">y</span></a><span> </span><a href="Matrix.Internal.html#identity"><span class="hs-identifier hs-var">identity</span></a><span> </span><span class="hs-operator hs-var">.</span><span> </span><a href="#local-6989586621679039003"><span class="hs-identifier hs-var">m</span></a><span>
700+</span><a name="line-700"></a><span>
701+</span><a name="line-701"></a><span class="hs-comment">-- McCarthy's Conditional</span><span>
702+</span><a name="line-702"></a><span>
703+</span><a name="line-703"></a><span class="hs-comment">-- | McCarthy's Conditional expresses probabilistic choice.</span><span>
704+</span><a name="line-704"></a><span class="hs-identifier">cond</span><span> </span><span class="hs-glyph">::</span><span>
705+</span><a name="line-705"></a><span> </span><span class="hs-special">(</span><span> </span><span class="hs-identifier hs-type">cols</span><span> </span><span class="hs-glyph">~</span><span> </span><a href="Matrix.Internal.html#FromNat"><span class="hs-identifier hs-type">FromNat</span></a><span> </span><span class="hs-special">(</span><a href="Matrix.Internal.html#Count"><span class="hs-identifier hs-type">Count</span></a><span> </span><a href="#local-6989586621679038602"><span class="hs-identifier hs-type">cols</span></a><span class="hs-special">)</span><span class="hs-special">,</span><span>
706+</span><a name="line-706"></a><span> </span><span class="hs-identifier hs-type">KnownNat</span><span> </span><span class="hs-special">(</span><a href="Matrix.Internal.html#Count"><span class="hs-identifier hs-type">Count</span></a><span> </span><a href="#local-6989586621679038602"><span class="hs-identifier hs-type">cols</span></a><span class="hs-special">)</span><span class="hs-special">,</span><span>
707+</span><a name="line-707"></a><span> </span><a href="Matrix.Internal.html#FromLists"><span class="hs-identifier hs-type">FromLists</span></a><span> </span><a href="#local-6989586621679038603"><span class="hs-identifier hs-type">e</span></a><span> </span><span class="hs-special">(</span><span class="hs-special">)</span><span> </span><a href="#local-6989586621679038602"><span class="hs-identifier hs-type">cols</span></a><span class="hs-special">,</span><span>
708+</span><a name="line-708"></a><span> </span><a href="Matrix.Internal.html#FromLists"><span class="hs-identifier hs-type">FromLists</span></a><span> </span><a href="#local-6989586621679038603"><span class="hs-identifier hs-type">e</span></a><span> </span><a href="#local-6989586621679038602"><span class="hs-identifier hs-type">cols</span></a><span> </span><span class="hs-special">(</span><span class="hs-special">)</span><span class="hs-special">,</span><span>
709+</span><a name="line-709"></a><span> </span><a href="Matrix.Internal.html#FromLists"><span class="hs-identifier hs-type">FromLists</span></a><span> </span><a href="#local-6989586621679038603"><span class="hs-identifier hs-type">e</span></a><span> </span><a href="#local-6989586621679038602"><span class="hs-identifier hs-type">cols</span></a><span> </span><a href="#local-6989586621679038602"><span class="hs-identifier hs-type">cols</span></a><span class="hs-special">,</span><span>
710+</span><a name="line-710"></a><span> </span><span class="hs-identifier hs-type">Bounded</span><span> </span><a href="#local-6989586621679038604"><span class="hs-identifier hs-type">a</span></a><span class="hs-special">,</span><span>
711+</span><a name="line-711"></a><span> </span><span class="hs-identifier hs-type">Enum</span><span> </span><a href="#local-6989586621679038604"><span class="hs-identifier hs-type">a</span></a><span class="hs-special">,</span><span>
712+</span><a name="line-712"></a><span> </span><span class="hs-identifier hs-type">Num</span><span> </span><a href="#local-6989586621679038603"><span class="hs-identifier hs-type">e</span></a><span class="hs-special">,</span><span>
713+</span><a name="line-713"></a><span> </span><span class="hs-identifier hs-type">Ord</span><span> </span><a href="#local-6989586621679038603"><span class="hs-identifier hs-type">e</span></a><span>
714+</span><a name="line-714"></a><span> </span><span class="hs-special">)</span><span>
715+</span><a name="line-715"></a><span> </span><span class="hs-glyph">=&gt;</span><span>
716+</span><a name="line-716"></a><span> </span><span class="hs-special">(</span><a href="#local-6989586621679038604"><span class="hs-identifier hs-type">a</span></a><span> </span><span class="hs-glyph">-&gt;</span><span> </span><span class="hs-identifier hs-type">Bool</span><span class="hs-special">)</span><span> </span><span class="hs-glyph">-&gt;</span><span> </span><a href="Matrix.Internal.html#Matrix"><span class="hs-identifier hs-type">Matrix</span></a><span> </span><a href="#local-6989586621679038603"><span class="hs-identifier hs-type">e</span></a><span> </span><a href="#local-6989586621679038602"><span class="hs-identifier hs-type">cols</span></a><span> </span><a href="#local-6989586621679038605"><span class="hs-identifier hs-type">rows</span></a><span> </span><span class="hs-glyph">-&gt;</span><span> </span><a href="Matrix.Internal.html#Matrix"><span class="hs-identifier hs-type">Matrix</span></a><span> </span><a href="#local-6989586621679038603"><span class="hs-identifier hs-type">e</span></a><span> </span><a href="#local-6989586621679038602"><span class="hs-identifier hs-type">cols</span></a><span> </span><a href="#local-6989586621679038605"><span class="hs-identifier hs-type">rows</span></a><span> </span><span class="hs-glyph">-&gt;</span><span> </span><a href="Matrix.Internal.html#Matrix"><span class="hs-identifier hs-type">Matrix</span></a><span> </span><a href="#local-6989586621679038603"><span class="hs-identifier hs-type">e</span></a><span> </span><a href="#local-6989586621679038602"><span class="hs-identifier hs-type">cols</span></a><span> </span><a href="#local-6989586621679038605"><span class="hs-identifier hs-type">rows</span></a><span>
717+</span><a name="line-717"></a><a name="cond"><a href="Matrix.Internal.html#cond"><span class="hs-identifier">cond</span></a></a><span> </span><a name="local-6989586621679039005"><a href="#local-6989586621679039005"><span class="hs-identifier">p</span></a></a><span> </span><a name="local-6989586621679039006"><a href="#local-6989586621679039006"><span class="hs-identifier">f</span></a></a><span> </span><a name="local-6989586621679039007"><a href="#local-6989586621679039007"><span class="hs-identifier">g</span></a></a><span> </span><span class="hs-glyph">=</span><span> </span><a href="Matrix.Internal.html#junc"><span class="hs-identifier hs-var">junc</span></a><span> </span><a href="#local-6989586621679039006"><span class="hs-identifier hs-var">f</span></a><span> </span><a href="#local-6989586621679039007"><span class="hs-identifier hs-var">g</span></a><span> </span><span class="hs-operator hs-var">.</span><span> </span><a href="Matrix.Internal.html#grd"><span class="hs-identifier hs-var">grd</span></a><span> </span><a href="#local-6989586621679039005"><span class="hs-identifier hs-var">p</span></a><span>
718+</span><a name="line-718"></a><span>
719+</span><a name="line-719"></a><span class="hs-identifier">grd</span><span> </span><span class="hs-glyph">::</span><span>
720+</span><a name="line-720"></a><span> </span><span class="hs-special">(</span><span> </span><span class="hs-identifier hs-type">q</span><span> </span><span class="hs-glyph">~</span><span> </span><a href="Matrix.Internal.html#FromNat"><span class="hs-identifier hs-type">FromNat</span></a><span> </span><span class="hs-special">(</span><a href="Matrix.Internal.html#Count"><span class="hs-identifier hs-type">Count</span></a><span> </span><a href="#local-6989586621679038599"><span class="hs-identifier hs-type">q</span></a><span class="hs-special">)</span><span class="hs-special">,</span><span>
721+</span><a name="line-721"></a><span> </span><span class="hs-identifier hs-type">KnownNat</span><span> </span><span class="hs-special">(</span><a href="Matrix.Internal.html#Count"><span class="hs-identifier hs-type">Count</span></a><span> </span><a href="#local-6989586621679038599"><span class="hs-identifier hs-type">q</span></a><span class="hs-special">)</span><span class="hs-special">,</span><span>
722+</span><a name="line-722"></a><span> </span><a href="Matrix.Internal.html#FromLists"><span class="hs-identifier hs-type">FromLists</span></a><span> </span><a href="#local-6989586621679038600"><span class="hs-identifier hs-type">e</span></a><span> </span><span class="hs-special">(</span><span class="hs-special">)</span><span> </span><a href="#local-6989586621679038599"><span class="hs-identifier hs-type">q</span></a><span class="hs-special">,</span><span>
723+</span><a name="line-723"></a><span> </span><a href="Matrix.Internal.html#FromLists"><span class="hs-identifier hs-type">FromLists</span></a><span> </span><a href="#local-6989586621679038600"><span class="hs-identifier hs-type">e</span></a><span> </span><a href="#local-6989586621679038599"><span class="hs-identifier hs-type">q</span></a><span> </span><span class="hs-special">(</span><span class="hs-special">)</span><span class="hs-special">,</span><span>
724+</span><a name="line-724"></a><span> </span><a href="Matrix.Internal.html#FromLists"><span class="hs-identifier hs-type">FromLists</span></a><span> </span><a href="#local-6989586621679038600"><span class="hs-identifier hs-type">e</span></a><span> </span><a href="#local-6989586621679038599"><span class="hs-identifier hs-type">q</span></a><span> </span><a href="#local-6989586621679038599"><span class="hs-identifier hs-type">q</span></a><span class="hs-special">,</span><span>
725+</span><a name="line-725"></a><span> </span><span class="hs-identifier hs-type">Bounded</span><span> </span><a href="#local-6989586621679038601"><span class="hs-identifier hs-type">a</span></a><span class="hs-special">,</span><span>
726+</span><a name="line-726"></a><span> </span><span class="hs-identifier hs-type">Enum</span><span> </span><a href="#local-6989586621679038601"><span class="hs-identifier hs-type">a</span></a><span class="hs-special">,</span><span>
727+</span><a name="line-727"></a><span> </span><span class="hs-identifier hs-type">Num</span><span> </span><a href="#local-6989586621679038600"><span class="hs-identifier hs-type">e</span></a><span class="hs-special">,</span><span>
728+</span><a name="line-728"></a><span> </span><span class="hs-identifier hs-type">Ord</span><span> </span><a href="#local-6989586621679038600"><span class="hs-identifier hs-type">e</span></a><span>
729+</span><a name="line-729"></a><span> </span><span class="hs-special">)</span><span>
730+</span><a name="line-730"></a><span> </span><span class="hs-glyph">=&gt;</span><span>
731+</span><a name="line-731"></a><span> </span><span class="hs-special">(</span><a href="#local-6989586621679038601"><span class="hs-identifier hs-type">a</span></a><span> </span><span class="hs-glyph">-&gt;</span><span> </span><span class="hs-identifier hs-type">Bool</span><span class="hs-special">)</span><span> </span><span class="hs-glyph">-&gt;</span><span> </span><a href="Matrix.Internal.html#Matrix"><span class="hs-identifier hs-type">Matrix</span></a><span> </span><a href="#local-6989586621679038600"><span class="hs-identifier hs-type">e</span></a><span> </span><a href="#local-6989586621679038599"><span class="hs-identifier hs-type">q</span></a><span> </span><span class="hs-special">(</span><span class="hs-identifier hs-type">Either</span><span> </span><a href="#local-6989586621679038599"><span class="hs-identifier hs-type">q</span></a><span> </span><a href="#local-6989586621679038599"><span class="hs-identifier hs-type">q</span></a><span class="hs-special">)</span><span>
732+</span><a name="line-732"></a><a name="grd"><a href="Matrix.Internal.html#grd"><span class="hs-identifier">grd</span></a></a><span> </span><a name="local-6989586621679039008"><a href="#local-6989586621679039008"><span class="hs-identifier">f</span></a></a><span> </span><span class="hs-glyph">=</span><span> </span><a href="Matrix.Internal.html#split"><span class="hs-identifier hs-var">split</span></a><span> </span><span class="hs-special">(</span><a href="Matrix.Internal.html#corr"><span class="hs-identifier hs-var">corr</span></a><span> </span><a href="#local-6989586621679039008"><span class="hs-identifier hs-var">f</span></a><span class="hs-special">)</span><span> </span><span class="hs-special">(</span><a href="Matrix.Internal.html#corr"><span class="hs-identifier hs-var">corr</span></a><span> </span><span class="hs-special">(</span><span class="hs-identifier hs-var">not</span><span> </span><span class="hs-operator hs-var">.</span><span> </span><a href="#local-6989586621679039008"><span class="hs-identifier hs-var">f</span></a><span class="hs-special">)</span><span class="hs-special">)</span><span>
733+</span><a name="line-733"></a><span>
734+</span><a name="line-734"></a><span class="hs-identifier">corr</span><span> </span><span class="hs-glyph">::</span><span>
735+</span><a name="line-735"></a><span> </span><span class="hs-keyword">forall</span><span> </span><a name="local-6989586621679038596"><a href="#local-6989586621679038596"><span class="hs-identifier">e</span></a></a><span> </span><a name="local-6989586621679038597"><a href="#local-6989586621679038597"><span class="hs-identifier">a</span></a></a><span> </span><a name="local-6989586621679038598"><a href="#local-6989586621679038598"><span class="hs-identifier">q</span></a></a><span> </span><span class="hs-operator">.</span><span>
736+</span><a name="line-736"></a><span> </span><span class="hs-special">(</span><span> </span><span class="hs-identifier hs-type">q</span><span> </span><span class="hs-glyph">~</span><span> </span><a href="Matrix.Internal.html#FromNat"><span class="hs-identifier hs-type">FromNat</span></a><span> </span><span class="hs-special">(</span><a href="Matrix.Internal.html#Count"><span class="hs-identifier hs-type">Count</span></a><span> </span><a href="#local-6989586621679038598"><span class="hs-identifier hs-type">q</span></a><span class="hs-special">)</span><span class="hs-special">,</span><span>
737+</span><a name="line-737"></a><span> </span><span class="hs-identifier hs-type">KnownNat</span><span> </span><span class="hs-special">(</span><a href="Matrix.Internal.html#Count"><span class="hs-identifier hs-type">Count</span></a><span> </span><a href="#local-6989586621679038598"><span class="hs-identifier hs-type">q</span></a><span class="hs-special">)</span><span class="hs-special">,</span><span>
738+</span><a name="line-738"></a><span> </span><a href="Matrix.Internal.html#FromLists"><span class="hs-identifier hs-type">FromLists</span></a><span> </span><a href="#local-6989586621679038596"><span class="hs-identifier hs-type">e</span></a><span> </span><span class="hs-special">(</span><span class="hs-special">)</span><span> </span><a href="#local-6989586621679038598"><span class="hs-identifier hs-type">q</span></a><span class="hs-special">,</span><span>
739+</span><a name="line-739"></a><span> </span><a href="Matrix.Internal.html#FromLists"><span class="hs-identifier hs-type">FromLists</span></a><span> </span><a href="#local-6989586621679038596"><span class="hs-identifier hs-type">e</span></a><span> </span><a href="#local-6989586621679038598"><span class="hs-identifier hs-type">q</span></a><span> </span><span class="hs-special">(</span><span class="hs-special">)</span><span class="hs-special">,</span><span>
740+</span><a name="line-740"></a><span> </span><a href="Matrix.Internal.html#FromLists"><span class="hs-identifier hs-type">FromLists</span></a><span> </span><a href="#local-6989586621679038596"><span class="hs-identifier hs-type">e</span></a><span> </span><a href="#local-6989586621679038598"><span class="hs-identifier hs-type">q</span></a><span> </span><a href="#local-6989586621679038598"><span class="hs-identifier hs-type">q</span></a><span class="hs-special">,</span><span>
741+</span><a name="line-741"></a><span> </span><span class="hs-identifier hs-type">Bounded</span><span> </span><a href="#local-6989586621679038597"><span class="hs-identifier hs-type">a</span></a><span class="hs-special">,</span><span>
742+</span><a name="line-742"></a><span> </span><span class="hs-identifier hs-type">Enum</span><span> </span><a href="#local-6989586621679038597"><span class="hs-identifier hs-type">a</span></a><span class="hs-special">,</span><span>
743+</span><a name="line-743"></a><span> </span><span class="hs-identifier hs-type">Num</span><span> </span><a href="#local-6989586621679038596"><span class="hs-identifier hs-type">e</span></a><span class="hs-special">,</span><span>
744+</span><a name="line-744"></a><span> </span><span class="hs-identifier hs-type">Ord</span><span> </span><a href="#local-6989586621679038596"><span class="hs-identifier hs-type">e</span></a><span>
745+</span><a name="line-745"></a><span> </span><span class="hs-special">)</span><span>
746+</span><a name="line-746"></a><span> </span><span class="hs-glyph">=&gt;</span><span> </span><span class="hs-special">(</span><a href="#local-6989586621679038597"><span class="hs-identifier hs-type">a</span></a><span> </span><span class="hs-glyph">-&gt;</span><span> </span><span class="hs-identifier hs-type">Bool</span><span class="hs-special">)</span><span> </span><span class="hs-glyph">-&gt;</span><span> </span><a href="Matrix.Internal.html#Matrix"><span class="hs-identifier hs-type">Matrix</span></a><span> </span><a href="#local-6989586621679038596"><span class="hs-identifier hs-type">e</span></a><span> </span><a href="#local-6989586621679038598"><span class="hs-identifier hs-type">q</span></a><span> </span><a href="#local-6989586621679038598"><span class="hs-identifier hs-type">q</span></a><span>
747+</span><a name="line-747"></a><a name="corr"><a href="Matrix.Internal.html#corr"><span class="hs-identifier">corr</span></a></a><span> </span><a name="local-6989586621679039009"><a href="#local-6989586621679039009"><span class="hs-identifier">p</span></a></a><span> </span><span class="hs-glyph">=</span><span> </span><span class="hs-keyword">let</span><span> </span><a name="local-6989586621679039010"><a href="#local-6989586621679039010"><span class="hs-identifier">f</span></a></a><span> </span><span class="hs-glyph">=</span><span> </span><a href="Matrix.Internal.html#fromF"><span class="hs-identifier hs-var">fromF</span></a><span> </span><a href="#local-6989586621679039009"><span class="hs-identifier hs-var">p</span></a><span> </span><span class="hs-glyph">::</span><span> </span><a href="Matrix.Internal.html#Matrix"><span class="hs-identifier hs-type">Matrix</span></a><span> </span><a href="#local-6989586621679038596"><span class="hs-identifier hs-type">e</span></a><span> </span><a href="#local-6989586621679038598"><span class="hs-identifier hs-type">q</span></a><span> </span><span class="hs-special">(</span><span class="hs-special">)</span><span>
748+</span><a name="line-748"></a><span> </span><span class="hs-keyword">in</span><span> </span><a href="Matrix.Internal.html#khatri"><span class="hs-identifier hs-var">khatri</span></a><span> </span><a href="#local-6989586621679039010"><span class="hs-identifier hs-var">f</span></a><span> </span><span class="hs-special">(</span><a href="Matrix.Internal.html#identity"><span class="hs-identifier hs-var">identity</span></a><span> </span><span class="hs-glyph">::</span><span> </span><a href="Matrix.Internal.html#Matrix"><span class="hs-identifier hs-type">Matrix</span></a><span> </span><a href="#local-6989586621679038596"><span class="hs-identifier hs-type">e</span></a><span> </span><a href="#local-6989586621679038598"><span class="hs-identifier hs-type">q</span></a><span> </span><a href="#local-6989586621679038598"><span class="hs-identifier hs-type">q</span></a><span class="hs-special">)</span><span>
749+</span><a name="line-749"></a><span>
750+</span><a name="line-750"></a><span class="hs-comment">-- Pretty print</span><span>
751+</span><a name="line-751"></a><span>
752+</span><a name="line-752"></a><span class="hs-identifier">prettyAux</span><span> </span><span class="hs-glyph">::</span><span> </span><span class="hs-identifier hs-type">Show</span><span> </span><a href="#local-6989586621679038595"><span class="hs-identifier hs-type">e</span></a><span> </span><span class="hs-glyph">=&gt;</span><span> </span><span class="hs-special">[</span><span class="hs-special">[</span><a href="#local-6989586621679038595"><span class="hs-identifier hs-type">e</span></a><span class="hs-special">]</span><span class="hs-special">]</span><span> </span><span class="hs-glyph">-&gt;</span><span> </span><span class="hs-special">[</span><span class="hs-special">[</span><a href="#local-6989586621679038595"><span class="hs-identifier hs-type">e</span></a><span class="hs-special">]</span><span class="hs-special">]</span><span> </span><span class="hs-glyph">-&gt;</span><span> </span><span class="hs-identifier hs-type">String</span><span>
753+</span><a name="line-753"></a><a name="prettyAux"><a href="Matrix.Internal.html#prettyAux"><span class="hs-identifier">prettyAux</span></a></a><span> </span><span class="hs-special">[</span><span class="hs-special">]</span><span> </span><span class="hs-identifier">_</span><span> </span><span class="hs-glyph">=</span><span> </span><span class="hs-string">&quot;&quot;</span><span>
754+</span><a name="line-754"></a><span class="hs-identifier">prettyAux</span><span> </span><span class="hs-special">[</span><span class="hs-special">[</span><a name="local-6989586621679039011"><a href="#local-6989586621679039011"><span class="hs-identifier">e</span></a></a><span class="hs-special">]</span><span class="hs-special">]</span><span> </span><a name="local-6989586621679039012"><a href="#local-6989586621679039012"><span class="hs-identifier">m</span></a></a><span> </span><span class="hs-glyph">=</span><span> </span><span class="hs-string">&quot;&#9474; &quot;</span><span> </span><span class="hs-operator hs-var">++</span><span> </span><a href="#local-6989586621679039015"><span class="hs-identifier hs-var">fill</span></a><span> </span><span class="hs-special">(</span><span class="hs-identifier hs-var">show</span><span> </span><a href="#local-6989586621679039011"><span class="hs-identifier hs-var">e</span></a><span class="hs-special">)</span><span> </span><span class="hs-operator hs-var">++</span><span> </span><span class="hs-string">&quot; &#9474;\n&quot;</span><span>
755+</span><a name="line-755"></a><span> </span><span class="hs-keyword">where</span><span>
756+</span><a name="line-756"></a><span> </span><a name="local-6989586621679039013"><a href="#local-6989586621679039013"><span class="hs-identifier">v</span></a></a><span> </span><span class="hs-glyph">=</span><span> </span><span class="hs-identifier hs-var">fmap</span><span> </span><span class="hs-identifier hs-var">show</span><span> </span><a href="#local-6989586621679039012"><span class="hs-identifier hs-var">m</span></a><span>
757+</span><a name="line-757"></a><span> </span><a name="local-6989586621679039014"><a href="#local-6989586621679039014"><span class="hs-identifier">widest</span></a></a><span> </span><span class="hs-glyph">=</span><span> </span><span class="hs-identifier hs-var">maximum</span><span> </span><span class="hs-operator hs-var">$</span><span> </span><span class="hs-identifier hs-var">fmap</span><span> </span><span class="hs-identifier hs-var">length</span><span> </span><a href="#local-6989586621679039013"><span class="hs-identifier hs-var">v</span></a><span>
758+</span><a name="line-758"></a><span> </span><a name="local-6989586621679039015"><a href="#local-6989586621679039015"><span class="hs-identifier">fill</span></a></a><span> </span><a name="local-6989586621679039016"><a href="#local-6989586621679039016"><span class="hs-identifier">str</span></a></a><span> </span><span class="hs-glyph">=</span><span> </span><span class="hs-identifier hs-var">replicate</span><span> </span><span class="hs-special">(</span><a href="#local-6989586621679039014"><span class="hs-identifier hs-var">widest</span></a><span> </span><span class="hs-glyph">-</span><span> </span><span class="hs-identifier hs-var">length</span><span> </span><a href="#local-6989586621679039016"><span class="hs-identifier hs-var">str</span></a><span> </span><span class="hs-glyph">-</span><span> </span><span class="hs-number">2</span><span class="hs-special">)</span><span> </span><span class="hs-char">' '</span><span> </span><span class="hs-operator hs-var">++</span><span> </span><a href="#local-6989586621679039016"><span class="hs-identifier hs-var">str</span></a><span>
759+</span><a name="line-759"></a><span class="hs-identifier">prettyAux</span><span> </span><span class="hs-special">[</span><a name="local-6989586621679039017"><a href="#local-6989586621679039017"><span class="hs-identifier">h</span></a></a><span class="hs-special">]</span><span> </span><a name="local-6989586621679039018"><a href="#local-6989586621679039018"><span class="hs-identifier">m</span></a></a><span> </span><span class="hs-glyph">=</span><span> </span><span class="hs-string">&quot;&#9474; &quot;</span><span> </span><span class="hs-operator hs-var">++</span><span> </span><a href="#local-6989586621679039021"><span class="hs-identifier hs-var">fill</span></a><span> </span><span class="hs-special">(</span><span class="hs-identifier hs-var">unwords</span><span> </span><span class="hs-operator hs-var">$</span><span> </span><span class="hs-identifier hs-var">map</span><span> </span><span class="hs-identifier hs-var">show</span><span> </span><a href="#local-6989586621679039017"><span class="hs-identifier hs-var">h</span></a><span class="hs-special">)</span><span> </span><span class="hs-operator hs-var">++</span><span> </span><span class="hs-string">&quot; &#9474;\n&quot;</span><span>
760+</span><a name="line-760"></a><span> </span><span class="hs-keyword">where</span><span>
761+</span><a name="line-761"></a><span> </span><a name="local-6989586621679039019"><a href="#local-6989586621679039019"><span class="hs-identifier">v</span></a></a><span> </span><span class="hs-glyph">=</span><span> </span><span class="hs-identifier hs-var">fmap</span><span> </span><span class="hs-identifier hs-var">show</span><span> </span><a href="#local-6989586621679039018"><span class="hs-identifier hs-var">m</span></a><span>
762+</span><a name="line-762"></a><span> </span><a name="local-6989586621679039020"><a href="#local-6989586621679039020"><span class="hs-identifier">widest</span></a></a><span> </span><span class="hs-glyph">=</span><span> </span><span class="hs-identifier hs-var">maximum</span><span> </span><span class="hs-operator hs-var">$</span><span> </span><span class="hs-identifier hs-var">fmap</span><span> </span><span class="hs-identifier hs-var">length</span><span> </span><a href="#local-6989586621679039019"><span class="hs-identifier hs-var">v</span></a><span>
763+</span><a name="line-763"></a><span> </span><a name="local-6989586621679039021"><a href="#local-6989586621679039021"><span class="hs-identifier">fill</span></a></a><span> </span><a name="local-6989586621679039022"><a href="#local-6989586621679039022"><span class="hs-identifier">str</span></a></a><span> </span><span class="hs-glyph">=</span><span> </span><span class="hs-identifier hs-var">replicate</span><span> </span><span class="hs-special">(</span><a href="#local-6989586621679039020"><span class="hs-identifier hs-var">widest</span></a><span> </span><span class="hs-glyph">-</span><span> </span><span class="hs-identifier hs-var">length</span><span> </span><a href="#local-6989586621679039022"><span class="hs-identifier hs-var">str</span></a><span> </span><span class="hs-glyph">-</span><span> </span><span class="hs-number">2</span><span class="hs-special">)</span><span> </span><span class="hs-char">' '</span><span> </span><span class="hs-operator hs-var">++</span><span> </span><a href="#local-6989586621679039022"><span class="hs-identifier hs-var">str</span></a><span>
764+</span><a name="line-764"></a><span class="hs-identifier">prettyAux</span><span> </span><span class="hs-special">(</span><a name="local-6989586621679039023"><a href="#local-6989586621679039023"><span class="hs-identifier">h</span></a></a><span> </span><span class="hs-glyph">:</span><span> </span><a name="local-6989586621679039024"><a href="#local-6989586621679039024"><span class="hs-identifier">t</span></a></a><span class="hs-special">)</span><span> </span><a name="local-6989586621679039025"><a href="#local-6989586621679039025"><span class="hs-identifier">l</span></a></a><span> </span><span class="hs-glyph">=</span><span> </span><span class="hs-string">&quot;&#9474; &quot;</span><span> </span><span class="hs-operator hs-var">++</span><span> </span><a href="#local-6989586621679039028"><span class="hs-identifier hs-var">fill</span></a><span> </span><span class="hs-special">(</span><span class="hs-identifier hs-var">unwords</span><span> </span><span class="hs-operator hs-var">$</span><span> </span><span class="hs-identifier hs-var">map</span><span> </span><span class="hs-identifier hs-var">show</span><span> </span><a href="#local-6989586621679039023"><span class="hs-identifier hs-var">h</span></a><span class="hs-special">)</span><span> </span><span class="hs-operator hs-var">++</span><span> </span><span class="hs-string">&quot; &#9474;\n&quot;</span><span> </span><span class="hs-operator hs-var">++</span><span>
765+</span><a name="line-765"></a><span> </span><a href="Matrix.Internal.html#prettyAux"><span class="hs-identifier hs-var">prettyAux</span></a><span> </span><a href="#local-6989586621679039024"><span class="hs-identifier hs-var">t</span></a><span> </span><a href="#local-6989586621679039025"><span class="hs-identifier hs-var">l</span></a><span>
766+</span><a name="line-766"></a><span> </span><span class="hs-keyword">where</span><span>
767+</span><a name="line-767"></a><span> </span><a name="local-6989586621679039026"><a href="#local-6989586621679039026"><span class="hs-identifier">v</span></a></a><span> </span><span class="hs-glyph">=</span><span> </span><span class="hs-identifier hs-var">fmap</span><span> </span><span class="hs-identifier hs-var">show</span><span> </span><a href="#local-6989586621679039025"><span class="hs-identifier hs-var">l</span></a><span>
768+</span><a name="line-768"></a><span> </span><a name="local-6989586621679039027"><a href="#local-6989586621679039027"><span class="hs-identifier">widest</span></a></a><span> </span><span class="hs-glyph">=</span><span> </span><span class="hs-identifier hs-var">maximum</span><span> </span><span class="hs-operator hs-var">$</span><span> </span><span class="hs-identifier hs-var">fmap</span><span> </span><span class="hs-identifier hs-var">length</span><span> </span><a href="#local-6989586621679039026"><span class="hs-identifier hs-var">v</span></a><span>
769+</span><a name="line-769"></a><span> </span><a name="local-6989586621679039028"><a href="#local-6989586621679039028"><span class="hs-identifier">fill</span></a></a><span> </span><a name="local-6989586621679039029"><a href="#local-6989586621679039029"><span class="hs-identifier">str</span></a></a><span> </span><span class="hs-glyph">=</span><span> </span><span class="hs-identifier hs-var">replicate</span><span> </span><span class="hs-special">(</span><a href="#local-6989586621679039027"><span class="hs-identifier hs-var">widest</span></a><span> </span><span class="hs-glyph">-</span><span> </span><span class="hs-identifier hs-var">length</span><span> </span><a href="#local-6989586621679039029"><span class="hs-identifier hs-var">str</span></a><span> </span><span class="hs-glyph">-</span><span> </span><span class="hs-number">2</span><span class="hs-special">)</span><span> </span><span class="hs-char">' '</span><span> </span><span class="hs-operator hs-var">++</span><span> </span><a href="#local-6989586621679039029"><span class="hs-identifier hs-var">str</span></a><span>
770+</span><a name="line-770"></a><span>
771+</span><a name="line-771"></a><span class="hs-comment">-- | Matrix pretty printer</span><span>
772+</span><a name="line-772"></a><span class="hs-identifier">pretty</span><span> </span><span class="hs-glyph">::</span><span> </span><span class="hs-special">(</span><span class="hs-identifier hs-type">KnownNat</span><span> </span><span class="hs-special">(</span><a href="Matrix.Internal.html#Count"><span class="hs-identifier hs-type">Count</span></a><span> </span><a href="#local-6989586621679038592"><span class="hs-identifier hs-type">cols</span></a><span class="hs-special">)</span><span class="hs-special">,</span><span> </span><span class="hs-identifier hs-type">Show</span><span> </span><a href="#local-6989586621679038593"><span class="hs-identifier hs-type">e</span></a><span class="hs-special">)</span><span> </span><span class="hs-glyph">=&gt;</span><span> </span><a href="Matrix.Internal.html#Matrix"><span class="hs-identifier hs-type">Matrix</span></a><span> </span><a href="#local-6989586621679038593"><span class="hs-identifier hs-type">e</span></a><span> </span><a href="#local-6989586621679038592"><span class="hs-identifier hs-type">cols</span></a><span> </span><a href="#local-6989586621679038594"><span class="hs-identifier hs-type">rows</span></a><span> </span><span class="hs-glyph">-&gt;</span><span> </span><span class="hs-identifier hs-type">String</span><span>
773+</span><a name="line-773"></a><a name="pretty"><a href="Matrix.Internal.html#pretty"><span class="hs-identifier">pretty</span></a></a><span> </span><a name="local-6989586621679039030"><a href="#local-6989586621679039030"><span class="hs-identifier">m</span></a></a><span> </span><span class="hs-glyph">=</span><span> </span><span class="hs-string">&quot;&#9484; &quot;</span><span> </span><span class="hs-operator hs-var">++</span><span> </span><span class="hs-identifier hs-var">unwords</span><span> </span><span class="hs-special">(</span><span class="hs-identifier hs-var">replicate</span><span> </span><span class="hs-special">(</span><a href="Matrix.Internal.html#columns"><span class="hs-identifier hs-var">columns</span></a><span> </span><a href="#local-6989586621679039030"><span class="hs-identifier hs-var">m</span></a><span class="hs-special">)</span><span> </span><a href="#local-6989586621679039034"><span class="hs-identifier hs-var">blank</span></a><span class="hs-special">)</span><span> </span><span class="hs-operator hs-var">++</span><span> </span><span class="hs-string">&quot; &#9488;\n&quot;</span><span> </span><span class="hs-operator hs-var">++</span><span>
774+</span><a name="line-774"></a><span> </span><a href="Matrix.Internal.html#prettyAux"><span class="hs-identifier hs-var">prettyAux</span></a><span> </span><span class="hs-special">(</span><a href="Matrix.Internal.html#toLists"><span class="hs-identifier hs-var">toLists</span></a><span> </span><a href="#local-6989586621679039030"><span class="hs-identifier hs-var">m</span></a><span class="hs-special">)</span><span> </span><span class="hs-special">(</span><a href="Matrix.Internal.html#toLists"><span class="hs-identifier hs-var">toLists</span></a><span> </span><a href="#local-6989586621679039030"><span class="hs-identifier hs-var">m</span></a><span class="hs-special">)</span><span> </span><span class="hs-operator hs-var">++</span><span>
775+</span><a name="line-775"></a><span> </span><span class="hs-string">&quot;&#9492; &quot;</span><span> </span><span class="hs-operator hs-var">++</span><span> </span><span class="hs-identifier hs-var">unwords</span><span> </span><span class="hs-special">(</span><span class="hs-identifier hs-var">replicate</span><span> </span><span class="hs-special">(</span><a href="Matrix.Internal.html#columns"><span class="hs-identifier hs-var">columns</span></a><span> </span><a href="#local-6989586621679039030"><span class="hs-identifier hs-var">m</span></a><span class="hs-special">)</span><span> </span><a href="#local-6989586621679039034"><span class="hs-identifier hs-var">blank</span></a><span class="hs-special">)</span><span> </span><span class="hs-operator hs-var">++</span><span> </span><span class="hs-string">&quot; &#9496;&quot;</span><span>
776+</span><a name="line-776"></a><span> </span><span class="hs-keyword">where</span><span>
777+</span><a name="line-777"></a><span> </span><a name="local-6989586621679039031"><a href="#local-6989586621679039031"><span class="hs-identifier">v</span></a></a><span> </span><span class="hs-glyph">=</span><span> </span><span class="hs-identifier hs-var">fmap</span><span> </span><span class="hs-identifier hs-var">show</span><span> </span><span class="hs-special">(</span><a href="Matrix.Internal.html#toList"><span class="hs-identifier hs-var">toList</span></a><span> </span><a href="#local-6989586621679039030"><span class="hs-identifier hs-var">m</span></a><span class="hs-special">)</span><span>
778+</span><a name="line-778"></a><span> </span><a name="local-6989586621679039032"><a href="#local-6989586621679039032"><span class="hs-identifier">widest</span></a></a><span> </span><span class="hs-glyph">=</span><span> </span><span class="hs-identifier hs-var">maximum</span><span> </span><span class="hs-operator hs-var">$</span><span> </span><span class="hs-identifier hs-var">fmap</span><span> </span><span class="hs-identifier hs-var">length</span><span> </span><a href="#local-6989586621679039031"><span class="hs-identifier hs-var">v</span></a><span>
779+</span><a name="line-779"></a><span> </span><a name="local-6989586621679039033"><a href="#local-6989586621679039033"><span class="hs-identifier">fill</span></a></a><span> </span><a name="local-6989586621679039035"><a href="#local-6989586621679039035"><span class="hs-identifier">str</span></a></a><span> </span><span class="hs-glyph">=</span><span> </span><span class="hs-identifier hs-var">replicate</span><span> </span><span class="hs-special">(</span><a href="#local-6989586621679039032"><span class="hs-identifier hs-var">widest</span></a><span> </span><span class="hs-glyph">-</span><span> </span><span class="hs-identifier hs-var">length</span><span> </span><a href="#local-6989586621679039035"><span class="hs-identifier hs-var">str</span></a><span class="hs-special">)</span><span> </span><span class="hs-char">' '</span><span> </span><span class="hs-operator hs-var">++</span><span> </span><a href="#local-6989586621679039035"><span class="hs-identifier hs-var">str</span></a><span>
780+</span><a name="line-780"></a><span> </span><a name="local-6989586621679039034"><a href="#local-6989586621679039034"><span class="hs-identifier">blank</span></a></a><span> </span><span class="hs-glyph">=</span><span> </span><a href="#local-6989586621679039033"><span class="hs-identifier hs-var">fill</span></a><span> </span><span class="hs-string">&quot;&quot;</span><span>
781+</span><a name="line-781"></a><span>
782+</span><a name="line-782"></a><span class="hs-comment">-- | Matrix pretty printer</span><span>
783+</span><a name="line-783"></a><span class="hs-identifier">prettyPrint</span><span> </span><span class="hs-glyph">::</span><span> </span><span class="hs-special">(</span><span class="hs-identifier hs-type">KnownNat</span><span> </span><span class="hs-special">(</span><a href="Matrix.Internal.html#Count"><span class="hs-identifier hs-type">Count</span></a><span> </span><a href="#local-6989586621679038589"><span class="hs-identifier hs-type">cols</span></a><span class="hs-special">)</span><span class="hs-special">,</span><span> </span><span class="hs-identifier hs-type">Show</span><span> </span><a href="#local-6989586621679038590"><span class="hs-identifier hs-type">e</span></a><span class="hs-special">)</span><span> </span><span class="hs-glyph">=&gt;</span><span> </span><a href="Matrix.Internal.html#Matrix"><span class="hs-identifier hs-type">Matrix</span></a><span> </span><a href="#local-6989586621679038590"><span class="hs-identifier hs-type">e</span></a><span> </span><a href="#local-6989586621679038589"><span class="hs-identifier hs-type">cols</span></a><span> </span><a href="#local-6989586621679038591"><span class="hs-identifier hs-type">rows</span></a><span> </span><span class="hs-glyph">-&gt;</span><span> </span><span class="hs-identifier hs-type">IO</span><span> </span><span class="hs-special">(</span><span class="hs-special">)</span><span>
784+</span><a name="line-784"></a><a name="prettyPrint"><a href="Matrix.Internal.html#prettyPrint"><span class="hs-identifier">prettyPrint</span></a></a><span> </span><span class="hs-glyph">=</span><span> </span><span class="hs-identifier hs-var">putStrLn</span><span> </span><span class="hs-operator hs-var">.</span><span> </span><a href="Matrix.Internal.html#pretty"><span class="hs-identifier hs-var">pretty</span></a><span>
785+</span><a name="line-785"></a><span>
786+</span><a name="line-786"></a><span class="hs-comment">-- Relational operators functions</span><span>
787+</span><a name="line-787"></a><span>
788+</span><a name="line-788"></a><span class="hs-comment">-- | Helper conversion function</span><span>
789+</span><a name="line-789"></a><span class="hs-identifier">toBool</span><span> </span><span class="hs-glyph">::</span><span> </span><span class="hs-special">(</span><span class="hs-identifier hs-type">Num</span><span> </span><a href="#local-6989586621679038588"><span class="hs-identifier hs-type">e</span></a><span class="hs-special">,</span><span> </span><span class="hs-identifier hs-type">Eq</span><span> </span><a href="#local-6989586621679038588"><span class="hs-identifier hs-type">e</span></a><span class="hs-special">)</span><span> </span><span class="hs-glyph">=&gt;</span><span> </span><a href="#local-6989586621679038588"><span class="hs-identifier hs-type">e</span></a><span> </span><span class="hs-glyph">-&gt;</span><span> </span><span class="hs-identifier hs-type">Bool</span><span>
790+</span><a name="line-790"></a><a name="toBool"><a href="Matrix.Internal.html#toBool"><span class="hs-identifier">toBool</span></a></a><span> </span><a name="local-6989586621679039207"><a href="#local-6989586621679039207"><span class="hs-identifier">n</span></a></a><span>
791+</span><a name="line-791"></a><span> </span><span class="hs-glyph">|</span><span> </span><a href="#local-6989586621679039207"><span class="hs-identifier hs-var">n</span></a><span> </span><span class="hs-operator hs-var">==</span><span> </span><span class="hs-number">0</span><span> </span><span class="hs-glyph">=</span><span> </span><span class="hs-identifier hs-var">False</span><span>
792+</span><a name="line-792"></a><span> </span><span class="hs-glyph">|</span><span> </span><a href="#local-6989586621679039207"><span class="hs-identifier hs-var">n</span></a><span> </span><span class="hs-operator hs-var">==</span><span> </span><span class="hs-number">1</span><span> </span><span class="hs-glyph">=</span><span> </span><span class="hs-identifier hs-var">True</span><span>
793+</span><a name="line-793"></a><span>
794+</span><a name="line-794"></a><span class="hs-comment">-- | Helper conversion function</span><span>
795+</span><a name="line-795"></a><span class="hs-identifier">fromBool</span><span> </span><span class="hs-glyph">::</span><span> </span><span class="hs-identifier hs-type">Bool</span><span> </span><span class="hs-glyph">-&gt;</span><span> </span><a href="Utils.Internal.html#Natural"><span class="hs-identifier hs-type">Natural</span></a><span> </span><span class="hs-number">0</span><span> </span><span class="hs-number">1</span><span>
796+</span><a name="line-796"></a><a name="fromBool"><a href="Matrix.Internal.html#fromBool"><span class="hs-identifier">fromBool</span></a></a><span> </span><span class="hs-identifier hs-var">True</span><span> </span><span class="hs-glyph">=</span><span> </span><a href="Utils.Internal.html#nat"><span class="hs-identifier hs-var">nat</span></a><span> </span><span class="hs-number">1</span><span>
797+</span><a name="line-797"></a><span class="hs-identifier">fromBool</span><span> </span><span class="hs-identifier hs-var">False</span><span> </span><span class="hs-glyph">=</span><span> </span><a href="Utils.Internal.html#nat"><span class="hs-identifier hs-var">nat</span></a><span> </span><span class="hs-number">0</span><span>
798+</span><a name="line-798"></a><span>
799+</span><a name="line-799"></a><span class="hs-comment">-- | Relational addition</span><span>
800+</span><a name="line-800"></a><span class="hs-identifier">orM</span><span> </span><span class="hs-glyph">::</span><span> </span><a href="Matrix.Internal.html#Matrix"><span class="hs-identifier hs-type">Matrix</span></a><span> </span><span class="hs-special">(</span><a href="Utils.Internal.html#Natural"><span class="hs-identifier hs-type">Natural</span></a><span> </span><span class="hs-number">0</span><span> </span><span class="hs-number">1</span><span class="hs-special">)</span><span> </span><a href="#local-6989586621679038586"><span class="hs-identifier hs-type">cols</span></a><span> </span><a href="#local-6989586621679038587"><span class="hs-identifier hs-type">rows</span></a><span> </span><span class="hs-glyph">-&gt;</span><span> </span><a href="Matrix.Internal.html#Matrix"><span class="hs-identifier hs-type">Matrix</span></a><span> </span><span class="hs-special">(</span><a href="Utils.Internal.html#Natural"><span class="hs-identifier hs-type">Natural</span></a><span> </span><span class="hs-number">0</span><span> </span><span class="hs-number">1</span><span class="hs-special">)</span><span> </span><a href="#local-6989586621679038586"><span class="hs-identifier hs-type">cols</span></a><span> </span><a href="#local-6989586621679038587"><span class="hs-identifier hs-type">rows</span></a><span> </span><span class="hs-glyph">-&gt;</span><span> </span><a href="Matrix.Internal.html#Matrix"><span class="hs-identifier hs-type">Matrix</span></a><span> </span><span class="hs-special">(</span><a href="Utils.Internal.html#Natural"><span class="hs-identifier hs-type">Natural</span></a><span> </span><span class="hs-number">0</span><span> </span><span class="hs-number">1</span><span class="hs-special">)</span><span> </span><a href="#local-6989586621679038586"><span class="hs-identifier hs-type">cols</span></a><span> </span><a href="#local-6989586621679038587"><span class="hs-identifier hs-type">rows</span></a><span>
801+</span><a name="line-801"></a><a name="orM"><a href="Matrix.Internal.html#orM"><span class="hs-identifier">orM</span></a></a><span> </span><a href="Matrix.Internal.html#Empty"><span class="hs-identifier hs-var">Empty</span></a><span> </span><a href="Matrix.Internal.html#Empty"><span class="hs-identifier hs-var">Empty</span></a><span> </span><span class="hs-glyph">=</span><span> </span><a href="Matrix.Internal.html#Empty"><span class="hs-identifier hs-var">Empty</span></a><span>
802+</span><a name="line-802"></a><span class="hs-identifier">orM</span><span> </span><span class="hs-special">(</span><a href="Matrix.Internal.html#One"><span class="hs-identifier hs-var">One</span></a><span> </span><a name="local-6989586621679039208"><a href="#local-6989586621679039208"><span class="hs-identifier">a</span></a></a><span class="hs-special">)</span><span> </span><span class="hs-special">(</span><a href="Matrix.Internal.html#One"><span class="hs-identifier hs-var">One</span></a><span> </span><a name="local-6989586621679039209"><a href="#local-6989586621679039209"><span class="hs-identifier">b</span></a></a><span class="hs-special">)</span><span> </span><span class="hs-glyph">=</span><span> </span><a href="Matrix.Internal.html#One"><span class="hs-identifier hs-var">One</span></a><span> </span><span class="hs-special">(</span><a href="Matrix.Internal.html#fromBool"><span class="hs-identifier hs-var">fromBool</span></a><span> </span><span class="hs-special">(</span><a href="Matrix.Internal.html#toBool"><span class="hs-identifier hs-var">toBool</span></a><span> </span><a href="#local-6989586621679039208"><span class="hs-identifier hs-var">a</span></a><span> </span><span class="hs-operator hs-var">||</span><span> </span><a href="Matrix.Internal.html#toBool"><span class="hs-identifier hs-var">toBool</span></a><span> </span><a href="#local-6989586621679039209"><span class="hs-identifier hs-var">b</span></a><span class="hs-special">)</span><span class="hs-special">)</span><span>
803+</span><a name="line-803"></a><span class="hs-identifier">orM</span><span> </span><span class="hs-special">(</span><a href="Matrix.Internal.html#Junc"><span class="hs-identifier hs-var">Junc</span></a><span> </span><a name="local-6989586621679039210"><a href="#local-6989586621679039210"><span class="hs-identifier">a</span></a></a><span> </span><a name="local-6989586621679039211"><a href="#local-6989586621679039211"><span class="hs-identifier">b</span></a></a><span class="hs-special">)</span><span> </span><span class="hs-special">(</span><a href="Matrix.Internal.html#Junc"><span class="hs-identifier hs-var">Junc</span></a><span> </span><a name="local-6989586621679039212"><a href="#local-6989586621679039212"><span class="hs-identifier">c</span></a></a><span> </span><a name="local-6989586621679039213"><a href="#local-6989586621679039213"><span class="hs-identifier">d</span></a></a><span class="hs-special">)</span><span> </span><span class="hs-glyph">=</span><span> </span><a href="Matrix.Internal.html#Junc"><span class="hs-identifier hs-var">Junc</span></a><span> </span><span class="hs-special">(</span><a href="Matrix.Internal.html#orM"><span class="hs-identifier hs-var">orM</span></a><span> </span><a href="#local-6989586621679039210"><span class="hs-identifier hs-var">a</span></a><span> </span><a href="#local-6989586621679039212"><span class="hs-identifier hs-var">c</span></a><span class="hs-special">)</span><span> </span><span class="hs-special">(</span><a href="Matrix.Internal.html#orM"><span class="hs-identifier hs-var">orM</span></a><span> </span><a href="#local-6989586621679039211"><span class="hs-identifier hs-var">b</span></a><span> </span><a href="#local-6989586621679039213"><span class="hs-identifier hs-var">d</span></a><span class="hs-special">)</span><span>
804+</span><a name="line-804"></a><span class="hs-identifier">orM</span><span> </span><span class="hs-special">(</span><a href="Matrix.Internal.html#Split"><span class="hs-identifier hs-var">Split</span></a><span> </span><a name="local-6989586621679039214"><a href="#local-6989586621679039214"><span class="hs-identifier">a</span></a></a><span> </span><a name="local-6989586621679039215"><a href="#local-6989586621679039215"><span class="hs-identifier">b</span></a></a><span class="hs-special">)</span><span> </span><span class="hs-special">(</span><a href="Matrix.Internal.html#Split"><span class="hs-identifier hs-var">Split</span></a><span> </span><a name="local-6989586621679039216"><a href="#local-6989586621679039216"><span class="hs-identifier">c</span></a></a><span> </span><a name="local-6989586621679039217"><a href="#local-6989586621679039217"><span class="hs-identifier">d</span></a></a><span class="hs-special">)</span><span> </span><span class="hs-glyph">=</span><span> </span><a href="Matrix.Internal.html#Split"><span class="hs-identifier hs-var">Split</span></a><span> </span><span class="hs-special">(</span><a href="Matrix.Internal.html#orM"><span class="hs-identifier hs-var">orM</span></a><span> </span><a href="#local-6989586621679039214"><span class="hs-identifier hs-var">a</span></a><span> </span><a href="#local-6989586621679039216"><span class="hs-identifier hs-var">c</span></a><span class="hs-special">)</span><span> </span><span class="hs-special">(</span><a href="Matrix.Internal.html#orM"><span class="hs-identifier hs-var">orM</span></a><span> </span><a href="#local-6989586621679039215"><span class="hs-identifier hs-var">b</span></a><span> </span><a href="#local-6989586621679039217"><span class="hs-identifier hs-var">d</span></a><span class="hs-special">)</span><span>
805+</span><a name="line-805"></a><span class="hs-identifier">orM</span><span> </span><a name="local-6989586621679039218"><a href="#local-6989586621679039218"><span class="hs-identifier">x</span></a></a><span class="hs-glyph">@</span><span class="hs-special">(</span><a href="Matrix.Internal.html#Split"><span class="hs-identifier hs-var">Split</span></a><span> </span><span class="hs-identifier">_</span><span> </span><span class="hs-identifier">_</span><span class="hs-special">)</span><span> </span><a name="local-6989586621679039219"><a href="#local-6989586621679039219"><span class="hs-identifier">y</span></a></a><span class="hs-glyph">@</span><span class="hs-special">(</span><a href="Matrix.Internal.html#Junc"><span class="hs-identifier hs-var">Junc</span></a><span> </span><span class="hs-identifier">_</span><span> </span><span class="hs-identifier">_</span><span class="hs-special">)</span><span> </span><span class="hs-glyph">=</span><span> </span><a href="Matrix.Internal.html#orM"><span class="hs-identifier hs-var">orM</span></a><span> </span><a href="#local-6989586621679039218"><span class="hs-identifier hs-var">x</span></a><span> </span><span class="hs-special">(</span><a href="Matrix.Internal.html#abideJS"><span class="hs-identifier hs-var">abideJS</span></a><span> </span><a href="#local-6989586621679039219"><span class="hs-identifier hs-var">y</span></a><span class="hs-special">)</span><span>
806+</span><a name="line-806"></a><span class="hs-identifier">orM</span><span> </span><a name="local-6989586621679039220"><a href="#local-6989586621679039220"><span class="hs-identifier">x</span></a></a><span class="hs-glyph">@</span><span class="hs-special">(</span><a href="Matrix.Internal.html#Junc"><span class="hs-identifier hs-var">Junc</span></a><span> </span><span class="hs-identifier">_</span><span> </span><span class="hs-identifier">_</span><span class="hs-special">)</span><span> </span><a name="local-6989586621679039221"><a href="#local-6989586621679039221"><span class="hs-identifier">y</span></a></a><span class="hs-glyph">@</span><span class="hs-special">(</span><a href="Matrix.Internal.html#Split"><span class="hs-identifier hs-var">Split</span></a><span> </span><span class="hs-identifier">_</span><span> </span><span class="hs-identifier">_</span><span class="hs-special">)</span><span> </span><span class="hs-glyph">=</span><span> </span><a href="Matrix.Internal.html#orM"><span class="hs-identifier hs-var">orM</span></a><span> </span><span class="hs-special">(</span><a href="Matrix.Internal.html#abideJS"><span class="hs-identifier hs-var">abideJS</span></a><span> </span><a href="#local-6989586621679039220"><span class="hs-identifier hs-var">x</span></a><span class="hs-special">)</span><span> </span><a href="#local-6989586621679039221"><span class="hs-identifier hs-var">y</span></a><span>
807+</span><a name="line-807"></a><span>
808+</span><a name="line-808"></a><span class="hs-comment">-- | Relational multiplication</span><span>
809+</span><a name="line-809"></a><span class="hs-identifier">andM</span><span> </span><span class="hs-glyph">::</span><span> </span><a href="Matrix.Internal.html#Matrix"><span class="hs-identifier hs-type">Matrix</span></a><span> </span><span class="hs-special">(</span><a href="Utils.Internal.html#Natural"><span class="hs-identifier hs-type">Natural</span></a><span> </span><span class="hs-number">0</span><span> </span><span class="hs-number">1</span><span class="hs-special">)</span><span> </span><a href="#local-6989586621679038584"><span class="hs-identifier hs-type">cols</span></a><span> </span><a href="#local-6989586621679038585"><span class="hs-identifier hs-type">rows</span></a><span> </span><span class="hs-glyph">-&gt;</span><span> </span><a href="Matrix.Internal.html#Matrix"><span class="hs-identifier hs-type">Matrix</span></a><span> </span><span class="hs-special">(</span><a href="Utils.Internal.html#Natural"><span class="hs-identifier hs-type">Natural</span></a><span> </span><span class="hs-number">0</span><span> </span><span class="hs-number">1</span><span class="hs-special">)</span><span> </span><a href="#local-6989586621679038584"><span class="hs-identifier hs-type">cols</span></a><span> </span><a href="#local-6989586621679038585"><span class="hs-identifier hs-type">rows</span></a><span> </span><span class="hs-glyph">-&gt;</span><span> </span><a href="Matrix.Internal.html#Matrix"><span class="hs-identifier hs-type">Matrix</span></a><span> </span><span class="hs-special">(</span><a href="Utils.Internal.html#Natural"><span class="hs-identifier hs-type">Natural</span></a><span> </span><span class="hs-number">0</span><span> </span><span class="hs-number">1</span><span class="hs-special">)</span><span> </span><a href="#local-6989586621679038584"><span class="hs-identifier hs-type">cols</span></a><span> </span><a href="#local-6989586621679038585"><span class="hs-identifier hs-type">rows</span></a><span>
810+</span><a name="line-810"></a><a name="andM"><a href="Matrix.Internal.html#andM"><span class="hs-identifier">andM</span></a></a><span> </span><a href="Matrix.Internal.html#Empty"><span class="hs-identifier hs-var">Empty</span></a><span> </span><a href="Matrix.Internal.html#Empty"><span class="hs-identifier hs-var">Empty</span></a><span> </span><span class="hs-glyph">=</span><span> </span><a href="Matrix.Internal.html#Empty"><span class="hs-identifier hs-var">Empty</span></a><span>
811+</span><a name="line-811"></a><span class="hs-identifier">andM</span><span> </span><span class="hs-special">(</span><a href="Matrix.Internal.html#One"><span class="hs-identifier hs-var">One</span></a><span> </span><a name="local-6989586621679039222"><a href="#local-6989586621679039222"><span class="hs-identifier">a</span></a></a><span class="hs-special">)</span><span> </span><span class="hs-special">(</span><a href="Matrix.Internal.html#One"><span class="hs-identifier hs-var">One</span></a><span> </span><a name="local-6989586621679039223"><a href="#local-6989586621679039223"><span class="hs-identifier">b</span></a></a><span class="hs-special">)</span><span> </span><span class="hs-glyph">=</span><span> </span><a href="Matrix.Internal.html#One"><span class="hs-identifier hs-var">One</span></a><span> </span><span class="hs-special">(</span><a href="Matrix.Internal.html#fromBool"><span class="hs-identifier hs-var">fromBool</span></a><span> </span><span class="hs-special">(</span><a href="Matrix.Internal.html#toBool"><span class="hs-identifier hs-var">toBool</span></a><span> </span><a href="#local-6989586621679039222"><span class="hs-identifier hs-var">a</span></a><span> </span><span class="hs-operator hs-var">&amp;&amp;</span><span> </span><a href="Matrix.Internal.html#toBool"><span class="hs-identifier hs-var">toBool</span></a><span> </span><a href="#local-6989586621679039223"><span class="hs-identifier hs-var">b</span></a><span class="hs-special">)</span><span class="hs-special">)</span><span>
812+</span><a name="line-812"></a><span class="hs-identifier">andM</span><span> </span><span class="hs-special">(</span><a href="Matrix.Internal.html#Junc"><span class="hs-identifier hs-var">Junc</span></a><span> </span><a name="local-6989586621679039224"><a href="#local-6989586621679039224"><span class="hs-identifier">a</span></a></a><span> </span><a name="local-6989586621679039225"><a href="#local-6989586621679039225"><span class="hs-identifier">b</span></a></a><span class="hs-special">)</span><span> </span><span class="hs-special">(</span><a href="Matrix.Internal.html#Junc"><span class="hs-identifier hs-var">Junc</span></a><span> </span><a name="local-6989586621679039226"><a href="#local-6989586621679039226"><span class="hs-identifier">c</span></a></a><span> </span><a name="local-6989586621679039227"><a href="#local-6989586621679039227"><span class="hs-identifier">d</span></a></a><span class="hs-special">)</span><span> </span><span class="hs-glyph">=</span><span> </span><a href="Matrix.Internal.html#Junc"><span class="hs-identifier hs-var">Junc</span></a><span> </span><span class="hs-special">(</span><a href="Matrix.Internal.html#andM"><span class="hs-identifier hs-var">andM</span></a><span> </span><a href="#local-6989586621679039224"><span class="hs-identifier hs-var">a</span></a><span> </span><a href="#local-6989586621679039226"><span class="hs-identifier hs-var">c</span></a><span class="hs-special">)</span><span> </span><span class="hs-special">(</span><a href="Matrix.Internal.html#andM"><span class="hs-identifier hs-var">andM</span></a><span> </span><a href="#local-6989586621679039225"><span class="hs-identifier hs-var">b</span></a><span> </span><a href="#local-6989586621679039227"><span class="hs-identifier hs-var">d</span></a><span class="hs-special">)</span><span>
813+</span><a name="line-813"></a><span class="hs-identifier">andM</span><span> </span><span class="hs-special">(</span><a href="Matrix.Internal.html#Split"><span class="hs-identifier hs-var">Split</span></a><span> </span><a name="local-6989586621679039228"><a href="#local-6989586621679039228"><span class="hs-identifier">a</span></a></a><span> </span><a name="local-6989586621679039229"><a href="#local-6989586621679039229"><span class="hs-identifier">b</span></a></a><span class="hs-special">)</span><span> </span><span class="hs-special">(</span><a href="Matrix.Internal.html#Split"><span class="hs-identifier hs-var">Split</span></a><span> </span><a name="local-6989586621679039230"><a href="#local-6989586621679039230"><span class="hs-identifier">c</span></a></a><span> </span><a name="local-6989586621679039231"><a href="#local-6989586621679039231"><span class="hs-identifier">d</span></a></a><span class="hs-special">)</span><span> </span><span class="hs-glyph">=</span><span> </span><a href="Matrix.Internal.html#Split"><span class="hs-identifier hs-var">Split</span></a><span> </span><span class="hs-special">(</span><a href="Matrix.Internal.html#andM"><span class="hs-identifier hs-var">andM</span></a><span> </span><a href="#local-6989586621679039228"><span class="hs-identifier hs-var">a</span></a><span> </span><a href="#local-6989586621679039230"><span class="hs-identifier hs-var">c</span></a><span class="hs-special">)</span><span> </span><span class="hs-special">(</span><a href="Matrix.Internal.html#andM"><span class="hs-identifier hs-var">andM</span></a><span> </span><a href="#local-6989586621679039229"><span class="hs-identifier hs-var">b</span></a><span> </span><a href="#local-6989586621679039231"><span class="hs-identifier hs-var">d</span></a><span class="hs-special">)</span><span>
814+</span><a name="line-814"></a><span class="hs-identifier">andM</span><span> </span><a name="local-6989586621679039232"><a href="#local-6989586621679039232"><span class="hs-identifier">x</span></a></a><span class="hs-glyph">@</span><span class="hs-special">(</span><a href="Matrix.Internal.html#Split"><span class="hs-identifier hs-var">Split</span></a><span> </span><span class="hs-identifier">_</span><span> </span><span class="hs-identifier">_</span><span class="hs-special">)</span><span> </span><a name="local-6989586621679039233"><a href="#local-6989586621679039233"><span class="hs-identifier">y</span></a></a><span class="hs-glyph">@</span><span class="hs-special">(</span><a href="Matrix.Internal.html#Junc"><span class="hs-identifier hs-var">Junc</span></a><span> </span><span class="hs-identifier">_</span><span> </span><span class="hs-identifier">_</span><span class="hs-special">)</span><span> </span><span class="hs-glyph">=</span><span> </span><a href="Matrix.Internal.html#andM"><span class="hs-identifier hs-var">andM</span></a><span> </span><a href="#local-6989586621679039232"><span class="hs-identifier hs-var">x</span></a><span> </span><span class="hs-special">(</span><a href="Matrix.Internal.html#abideJS"><span class="hs-identifier hs-var">abideJS</span></a><span> </span><a href="#local-6989586621679039233"><span class="hs-identifier hs-var">y</span></a><span class="hs-special">)</span><span>
815+</span><a name="line-815"></a><span class="hs-identifier">andM</span><span> </span><a name="local-6989586621679039234"><a href="#local-6989586621679039234"><span class="hs-identifier">x</span></a></a><span class="hs-glyph">@</span><span class="hs-special">(</span><a href="Matrix.Internal.html#Junc"><span class="hs-identifier hs-var">Junc</span></a><span> </span><span class="hs-identifier">_</span><span> </span><span class="hs-identifier">_</span><span class="hs-special">)</span><span> </span><a name="local-6989586621679039235"><a href="#local-6989586621679039235"><span class="hs-identifier">y</span></a></a><span class="hs-glyph">@</span><span class="hs-special">(</span><a href="Matrix.Internal.html#Split"><span class="hs-identifier hs-var">Split</span></a><span> </span><span class="hs-identifier">_</span><span> </span><span class="hs-identifier">_</span><span class="hs-special">)</span><span> </span><span class="hs-glyph">=</span><span> </span><a href="Matrix.Internal.html#andM"><span class="hs-identifier hs-var">andM</span></a><span> </span><span class="hs-special">(</span><a href="Matrix.Internal.html#abideJS"><span class="hs-identifier hs-var">abideJS</span></a><span> </span><a href="#local-6989586621679039234"><span class="hs-identifier hs-var">x</span></a><span class="hs-special">)</span><span> </span><a href="#local-6989586621679039235"><span class="hs-identifier hs-var">y</span></a><span>
816+</span><a name="line-816"></a><span>
817+</span><a name="line-817"></a><span class="hs-comment">-- | Relational subtraction</span><span>
818+</span><a name="line-818"></a><span class="hs-identifier">subM</span><span> </span><span class="hs-glyph">::</span><span> </span><a href="Matrix.Internal.html#Matrix"><span class="hs-identifier hs-type">Matrix</span></a><span> </span><span class="hs-special">(</span><a href="Utils.Internal.html#Natural"><span class="hs-identifier hs-type">Natural</span></a><span> </span><span class="hs-number">0</span><span> </span><span class="hs-number">1</span><span class="hs-special">)</span><span> </span><a href="#local-6989586621679038582"><span class="hs-identifier hs-type">cols</span></a><span> </span><a href="#local-6989586621679038583"><span class="hs-identifier hs-type">rows</span></a><span> </span><span class="hs-glyph">-&gt;</span><span> </span><a href="Matrix.Internal.html#Matrix"><span class="hs-identifier hs-type">Matrix</span></a><span> </span><span class="hs-special">(</span><a href="Utils.Internal.html#Natural"><span class="hs-identifier hs-type">Natural</span></a><span> </span><span class="hs-number">0</span><span> </span><span class="hs-number">1</span><span class="hs-special">)</span><span> </span><a href="#local-6989586621679038582"><span class="hs-identifier hs-type">cols</span></a><span> </span><a href="#local-6989586621679038583"><span class="hs-identifier hs-type">rows</span></a><span> </span><span class="hs-glyph">-&gt;</span><span> </span><a href="Matrix.Internal.html#Matrix"><span class="hs-identifier hs-type">Matrix</span></a><span> </span><span class="hs-special">(</span><a href="Utils.Internal.html#Natural"><span class="hs-identifier hs-type">Natural</span></a><span> </span><span class="hs-number">0</span><span> </span><span class="hs-number">1</span><span class="hs-special">)</span><span> </span><a href="#local-6989586621679038582"><span class="hs-identifier hs-type">cols</span></a><span> </span><a href="#local-6989586621679038583"><span class="hs-identifier hs-type">rows</span></a><span>
819+</span><a name="line-819"></a><a name="subM"><a href="Matrix.Internal.html#subM"><span class="hs-identifier">subM</span></a></a><span> </span><a href="Matrix.Internal.html#Empty"><span class="hs-identifier hs-var">Empty</span></a><span> </span><a href="Matrix.Internal.html#Empty"><span class="hs-identifier hs-var">Empty</span></a><span> </span><span class="hs-glyph">=</span><span> </span><a href="Matrix.Internal.html#Empty"><span class="hs-identifier hs-var">Empty</span></a><span>
820+</span><a name="line-820"></a><span class="hs-identifier">subM</span><span> </span><span class="hs-special">(</span><a href="Matrix.Internal.html#One"><span class="hs-identifier hs-var">One</span></a><span> </span><a name="local-6989586621679039236"><a href="#local-6989586621679039236"><span class="hs-identifier">a</span></a></a><span class="hs-special">)</span><span> </span><span class="hs-special">(</span><a href="Matrix.Internal.html#One"><span class="hs-identifier hs-var">One</span></a><span> </span><a name="local-6989586621679039237"><a href="#local-6989586621679039237"><span class="hs-identifier">b</span></a></a><span class="hs-special">)</span><span> </span><span class="hs-glyph">=</span><span> </span><span class="hs-keyword">if</span><span> </span><a href="#local-6989586621679039236"><span class="hs-identifier hs-var">a</span></a><span> </span><span class="hs-glyph">-</span><span> </span><a href="#local-6989586621679039237"><span class="hs-identifier hs-var">b</span></a><span> </span><span class="hs-operator hs-var">&lt;</span><span> </span><a href="Utils.Internal.html#nat"><span class="hs-identifier hs-var">nat</span></a><span> </span><span class="hs-number">0</span><span> </span><span class="hs-keyword">then</span><span> </span><a href="Matrix.Internal.html#One"><span class="hs-identifier hs-var">One</span></a><span> </span><span class="hs-special">(</span><a href="Utils.Internal.html#nat"><span class="hs-identifier hs-var">nat</span></a><span> </span><span class="hs-number">0</span><span class="hs-special">)</span><span> </span><span class="hs-keyword">else</span><span> </span><a href="Matrix.Internal.html#One"><span class="hs-identifier hs-var">One</span></a><span> </span><span class="hs-special">(</span><a href="#local-6989586621679039236"><span class="hs-identifier hs-var">a</span></a><span> </span><span class="hs-glyph">-</span><span> </span><a href="#local-6989586621679039237"><span class="hs-identifier hs-var">b</span></a><span class="hs-special">)</span><span>
821+</span><a name="line-821"></a><span class="hs-identifier">subM</span><span> </span><span class="hs-special">(</span><a href="Matrix.Internal.html#Junc"><span class="hs-identifier hs-var">Junc</span></a><span> </span><a name="local-6989586621679039238"><a href="#local-6989586621679039238"><span class="hs-identifier">a</span></a></a><span> </span><a name="local-6989586621679039239"><a href="#local-6989586621679039239"><span class="hs-identifier">b</span></a></a><span class="hs-special">)</span><span> </span><span class="hs-special">(</span><a href="Matrix.Internal.html#Junc"><span class="hs-identifier hs-var">Junc</span></a><span> </span><a name="local-6989586621679039240"><a href="#local-6989586621679039240"><span class="hs-identifier">c</span></a></a><span> </span><a name="local-6989586621679039241"><a href="#local-6989586621679039241"><span class="hs-identifier">d</span></a></a><span class="hs-special">)</span><span> </span><span class="hs-glyph">=</span><span> </span><a href="Matrix.Internal.html#Junc"><span class="hs-identifier hs-var">Junc</span></a><span> </span><span class="hs-special">(</span><a href="Matrix.Internal.html#subM"><span class="hs-identifier hs-var">subM</span></a><span> </span><a href="#local-6989586621679039238"><span class="hs-identifier hs-var">a</span></a><span> </span><a href="#local-6989586621679039240"><span class="hs-identifier hs-var">c</span></a><span class="hs-special">)</span><span> </span><span class="hs-special">(</span><a href="Matrix.Internal.html#subM"><span class="hs-identifier hs-var">subM</span></a><span> </span><a href="#local-6989586621679039239"><span class="hs-identifier hs-var">b</span></a><span> </span><a href="#local-6989586621679039241"><span class="hs-identifier hs-var">d</span></a><span class="hs-special">)</span><span>
822+</span><a name="line-822"></a><span class="hs-identifier">subM</span><span> </span><span class="hs-special">(</span><a href="Matrix.Internal.html#Split"><span class="hs-identifier hs-var">Split</span></a><span> </span><a name="local-6989586621679039242"><a href="#local-6989586621679039242"><span class="hs-identifier">a</span></a></a><span> </span><a name="local-6989586621679039243"><a href="#local-6989586621679039243"><span class="hs-identifier">b</span></a></a><span class="hs-special">)</span><span> </span><span class="hs-special">(</span><a href="Matrix.Internal.html#Split"><span class="hs-identifier hs-var">Split</span></a><span> </span><a name="local-6989586621679039244"><a href="#local-6989586621679039244"><span class="hs-identifier">c</span></a></a><span> </span><a name="local-6989586621679039245"><a href="#local-6989586621679039245"><span class="hs-identifier">d</span></a></a><span class="hs-special">)</span><span> </span><span class="hs-glyph">=</span><span> </span><a href="Matrix.Internal.html#Split"><span class="hs-identifier hs-var">Split</span></a><span> </span><span class="hs-special">(</span><a href="Matrix.Internal.html#subM"><span class="hs-identifier hs-var">subM</span></a><span> </span><a href="#local-6989586621679039242"><span class="hs-identifier hs-var">a</span></a><span> </span><a href="#local-6989586621679039244"><span class="hs-identifier hs-var">c</span></a><span class="hs-special">)</span><span> </span><span class="hs-special">(</span><a href="Matrix.Internal.html#subM"><span class="hs-identifier hs-var">subM</span></a><span> </span><a href="#local-6989586621679039243"><span class="hs-identifier hs-var">b</span></a><span> </span><a href="#local-6989586621679039245"><span class="hs-identifier hs-var">d</span></a><span class="hs-special">)</span><span>
823+</span><a name="line-823"></a><span class="hs-identifier">subM</span><span> </span><a name="local-6989586621679039246"><a href="#local-6989586621679039246"><span class="hs-identifier">x</span></a></a><span class="hs-glyph">@</span><span class="hs-special">(</span><a href="Matrix.Internal.html#Split"><span class="hs-identifier hs-var">Split</span></a><span> </span><span class="hs-identifier">_</span><span> </span><span class="hs-identifier">_</span><span class="hs-special">)</span><span> </span><a name="local-6989586621679039247"><a href="#local-6989586621679039247"><span class="hs-identifier">y</span></a></a><span class="hs-glyph">@</span><span class="hs-special">(</span><a href="Matrix.Internal.html#Junc"><span class="hs-identifier hs-var">Junc</span></a><span> </span><span class="hs-identifier">_</span><span> </span><span class="hs-identifier">_</span><span class="hs-special">)</span><span> </span><span class="hs-glyph">=</span><span> </span><a href="Matrix.Internal.html#subM"><span class="hs-identifier hs-var">subM</span></a><span> </span><a href="#local-6989586621679039246"><span class="hs-identifier hs-var">x</span></a><span> </span><span class="hs-special">(</span><a href="Matrix.Internal.html#abideJS"><span class="hs-identifier hs-var">abideJS</span></a><span> </span><a href="#local-6989586621679039247"><span class="hs-identifier hs-var">y</span></a><span class="hs-special">)</span><span>
824+</span><a name="line-824"></a><span class="hs-identifier">subM</span><span> </span><a name="local-6989586621679039248"><a href="#local-6989586621679039248"><span class="hs-identifier">x</span></a></a><span class="hs-glyph">@</span><span class="hs-special">(</span><a href="Matrix.Internal.html#Junc"><span class="hs-identifier hs-var">Junc</span></a><span> </span><span class="hs-identifier">_</span><span> </span><span class="hs-identifier">_</span><span class="hs-special">)</span><span> </span><a name="local-6989586621679039249"><a href="#local-6989586621679039249"><span class="hs-identifier">y</span></a></a><span class="hs-glyph">@</span><span class="hs-special">(</span><a href="Matrix.Internal.html#Split"><span class="hs-identifier hs-var">Split</span></a><span> </span><span class="hs-identifier">_</span><span> </span><span class="hs-identifier">_</span><span class="hs-special">)</span><span> </span><span class="hs-glyph">=</span><span> </span><a href="Matrix.Internal.html#subM"><span class="hs-identifier hs-var">subM</span></a><span> </span><span class="hs-special">(</span><a href="Matrix.Internal.html#abideJS"><span class="hs-identifier hs-var">abideJS</span></a><span> </span><a href="#local-6989586621679039248"><span class="hs-identifier hs-var">x</span></a><span class="hs-special">)</span><span> </span><a href="#local-6989586621679039249"><span class="hs-identifier hs-var">y</span></a><span>
825+</span><a name="line-825"></a><span>
826+</span><a name="line-826"></a><span class="hs-comment">-- | Matrix relational composition.</span><span>
827+</span><a name="line-827"></a><span class="hs-identifier">compRel</span><span> </span><span class="hs-glyph">::</span><span> </span><a href="Matrix.Internal.html#Matrix"><span class="hs-identifier hs-type">Matrix</span></a><span> </span><span class="hs-special">(</span><a href="Utils.Internal.html#Natural"><span class="hs-identifier hs-type">Natural</span></a><span> </span><span class="hs-number">0</span><span> </span><span class="hs-number">1</span><span class="hs-special">)</span><span> </span><a href="#local-6989586621679038579"><span class="hs-identifier hs-type">cr</span></a><span> </span><a href="#local-6989586621679038580"><span class="hs-identifier hs-type">rows</span></a><span> </span><span class="hs-glyph">-&gt;</span><span> </span><a href="Matrix.Internal.html#Matrix"><span class="hs-identifier hs-type">Matrix</span></a><span> </span><span class="hs-special">(</span><a href="Utils.Internal.html#Natural"><span class="hs-identifier hs-type">Natural</span></a><span> </span><span class="hs-number">0</span><span> </span><span class="hs-number">1</span><span class="hs-special">)</span><span> </span><a href="#local-6989586621679038581"><span class="hs-identifier hs-type">cols</span></a><span> </span><a href="#local-6989586621679038579"><span class="hs-identifier hs-type">cr</span></a><span> </span><span class="hs-glyph">-&gt;</span><span> </span><a href="Matrix.Internal.html#Matrix"><span class="hs-identifier hs-type">Matrix</span></a><span> </span><span class="hs-special">(</span><a href="Utils.Internal.html#Natural"><span class="hs-identifier hs-type">Natural</span></a><span> </span><span class="hs-number">0</span><span> </span><span class="hs-number">1</span><span class="hs-special">)</span><span> </span><a href="#local-6989586621679038581"><span class="hs-identifier hs-type">cols</span></a><span> </span><a href="#local-6989586621679038580"><span class="hs-identifier hs-type">rows</span></a><span>
828+</span><a name="line-828"></a><a name="compRel"><a href="Matrix.Internal.html#compRel"><span class="hs-identifier">compRel</span></a></a><span> </span><a href="Matrix.Internal.html#Empty"><span class="hs-identifier hs-var">Empty</span></a><span> </span><a href="Matrix.Internal.html#Empty"><span class="hs-identifier hs-var">Empty</span></a><span> </span><span class="hs-glyph">=</span><span> </span><a href="Matrix.Internal.html#Empty"><span class="hs-identifier hs-var">Empty</span></a><span>
829+</span><a name="line-829"></a><span class="hs-identifier">compRel</span><span> </span><span class="hs-special">(</span><a href="Matrix.Internal.html#One"><span class="hs-identifier hs-var">One</span></a><span> </span><a name="local-6989586621679039250"><a href="#local-6989586621679039250"><span class="hs-identifier">a</span></a></a><span class="hs-special">)</span><span> </span><span class="hs-special">(</span><a href="Matrix.Internal.html#One"><span class="hs-identifier hs-var">One</span></a><span> </span><a name="local-6989586621679039251"><a href="#local-6989586621679039251"><span class="hs-identifier">b</span></a></a><span class="hs-special">)</span><span> </span><span class="hs-glyph">=</span><span> </span><a href="Matrix.Internal.html#One"><span class="hs-identifier hs-var">One</span></a><span> </span><span class="hs-special">(</span><a href="Matrix.Internal.html#fromBool"><span class="hs-identifier hs-var">fromBool</span></a><span> </span><span class="hs-special">(</span><a href="Matrix.Internal.html#toBool"><span class="hs-identifier hs-var">toBool</span></a><span> </span><a href="#local-6989586621679039250"><span class="hs-identifier hs-var">a</span></a><span> </span><span class="hs-operator hs-var">&amp;&amp;</span><span> </span><a href="Matrix.Internal.html#toBool"><span class="hs-identifier hs-var">toBool</span></a><span> </span><a href="#local-6989586621679039251"><span class="hs-identifier hs-var">b</span></a><span class="hs-special">)</span><span class="hs-special">)</span><span>
830+</span><a name="line-830"></a><span class="hs-identifier">compRel</span><span> </span><span class="hs-special">(</span><a href="Matrix.Internal.html#Junc"><span class="hs-identifier hs-var">Junc</span></a><span> </span><a name="local-6989586621679039252"><a href="#local-6989586621679039252"><span class="hs-identifier">a</span></a></a><span> </span><a name="local-6989586621679039253"><a href="#local-6989586621679039253"><span class="hs-identifier">b</span></a></a><span class="hs-special">)</span><span> </span><span class="hs-special">(</span><a href="Matrix.Internal.html#Split"><span class="hs-identifier hs-var">Split</span></a><span> </span><a name="local-6989586621679039254"><a href="#local-6989586621679039254"><span class="hs-identifier">c</span></a></a><span> </span><a name="local-6989586621679039255"><a href="#local-6989586621679039255"><span class="hs-identifier">d</span></a></a><span class="hs-special">)</span><span> </span><span class="hs-glyph">=</span><span> </span><a href="Matrix.Internal.html#orM"><span class="hs-identifier hs-var">orM</span></a><span> </span><span class="hs-special">(</span><a href="Matrix.Internal.html#compRel"><span class="hs-identifier hs-var">compRel</span></a><span> </span><a href="#local-6989586621679039252"><span class="hs-identifier hs-var">a</span></a><span> </span><a href="#local-6989586621679039254"><span class="hs-identifier hs-var">c</span></a><span class="hs-special">)</span><span> </span><span class="hs-special">(</span><a href="Matrix.Internal.html#compRel"><span class="hs-identifier hs-var">compRel</span></a><span> </span><a href="#local-6989586621679039253"><span class="hs-identifier hs-var">b</span></a><span> </span><a href="#local-6989586621679039255"><span class="hs-identifier hs-var">d</span></a><span class="hs-special">)</span><span> </span><span class="hs-comment">-- Divide-and-conquer law</span><span>
831+</span><a name="line-831"></a><span class="hs-identifier">compRel</span><span> </span><span class="hs-special">(</span><a href="Matrix.Internal.html#Split"><span class="hs-identifier hs-var">Split</span></a><span> </span><a name="local-6989586621679039256"><a href="#local-6989586621679039256"><span class="hs-identifier">a</span></a></a><span> </span><a name="local-6989586621679039257"><a href="#local-6989586621679039257"><span class="hs-identifier">b</span></a></a><span class="hs-special">)</span><span> </span><a name="local-6989586621679039258"><a href="#local-6989586621679039258"><span class="hs-identifier">c</span></a></a><span> </span><span class="hs-glyph">=</span><span> </span><a href="Matrix.Internal.html#Split"><span class="hs-identifier hs-var">Split</span></a><span> </span><span class="hs-special">(</span><a href="Matrix.Internal.html#compRel"><span class="hs-identifier hs-var">compRel</span></a><span> </span><a href="#local-6989586621679039256"><span class="hs-identifier hs-var">a</span></a><span> </span><a href="#local-6989586621679039258"><span class="hs-identifier hs-var">c</span></a><span class="hs-special">)</span><span> </span><span class="hs-special">(</span><a href="Matrix.Internal.html#compRel"><span class="hs-identifier hs-var">compRel</span></a><span> </span><a href="#local-6989586621679039257"><span class="hs-identifier hs-var">b</span></a><span> </span><a href="#local-6989586621679039258"><span class="hs-identifier hs-var">c</span></a><span class="hs-special">)</span><span> </span><span class="hs-comment">-- Split fusion law</span><span>
832+</span><a name="line-832"></a><span class="hs-identifier">compRel</span><span> </span><a name="local-6989586621679039259"><a href="#local-6989586621679039259"><span class="hs-identifier">c</span></a></a><span> </span><span class="hs-special">(</span><a href="Matrix.Internal.html#Junc"><span class="hs-identifier hs-var">Junc</span></a><span> </span><a name="local-6989586621679039260"><a href="#local-6989586621679039260"><span class="hs-identifier">a</span></a></a><span> </span><a name="local-6989586621679039261"><a href="#local-6989586621679039261"><span class="hs-identifier">b</span></a></a><span class="hs-special">)</span><span> </span><span class="hs-glyph">=</span><span> </span><a href="Matrix.Internal.html#Junc"><span class="hs-identifier hs-var">Junc</span></a><span> </span><span class="hs-special">(</span><a href="Matrix.Internal.html#compRel"><span class="hs-identifier hs-var">compRel</span></a><span> </span><a href="#local-6989586621679039259"><span class="hs-identifier hs-var">c</span></a><span> </span><a href="#local-6989586621679039260"><span class="hs-identifier hs-var">a</span></a><span class="hs-special">)</span><span> </span><span class="hs-special">(</span><a href="Matrix.Internal.html#compRel"><span class="hs-identifier hs-var">compRel</span></a><span> </span><a href="#local-6989586621679039259"><span class="hs-identifier hs-var">c</span></a><span> </span><a href="#local-6989586621679039261"><span class="hs-identifier hs-var">b</span></a><span class="hs-special">)</span><span> </span><span class="hs-comment">-- Junc fusion law</span><span>
833+</span><a name="line-833"></a><span>
834+</span><a name="line-834"></a><span class="hs-comment">-- | Lifts functions to relations with arbitrary dimensions.</span><span>
835+</span><a name="line-835"></a><span class="hs-comment">--</span><span>
836+</span><a name="line-836"></a><span class="hs-comment">-- NOTE: Be careful to not ask for a relation bigger than the cardinality of</span><span>
837+</span><a name="line-837"></a><span class="hs-comment">-- types @a@ or @b@ allows.</span><span>
838+</span><a name="line-838"></a><span class="hs-identifier">fromFRel</span><span> </span><span class="hs-glyph">::</span><span>
839+</span><a name="line-839"></a><span> </span><span class="hs-keyword">forall</span><span> </span><a name="local-6989586621679038575"><a href="#local-6989586621679038575"><span class="hs-identifier">a</span></a></a><span> </span><a name="local-6989586621679038576"><a href="#local-6989586621679038576"><span class="hs-identifier">b</span></a></a><span> </span><a name="local-6989586621679038577"><a href="#local-6989586621679038577"><span class="hs-identifier">cols</span></a></a><span> </span><a name="local-6989586621679038578"><a href="#local-6989586621679038578"><span class="hs-identifier">rows</span></a></a><span class="hs-operator">.</span><span>
840+</span><a name="line-840"></a><span> </span><span class="hs-special">(</span><span> </span><span class="hs-identifier hs-type">Bounded</span><span> </span><a href="#local-6989586621679038575"><span class="hs-identifier hs-type">a</span></a><span class="hs-special">,</span><span>
841+</span><a name="line-841"></a><span> </span><span class="hs-identifier hs-type">Bounded</span><span> </span><a href="#local-6989586621679038576"><span class="hs-identifier hs-type">b</span></a><span class="hs-special">,</span><span>
842+</span><a name="line-842"></a><span> </span><span class="hs-identifier hs-type">Enum</span><span> </span><a href="#local-6989586621679038575"><span class="hs-identifier hs-type">a</span></a><span class="hs-special">,</span><span>
843+</span><a name="line-843"></a><span> </span><span class="hs-identifier hs-type">Enum</span><span> </span><a href="#local-6989586621679038576"><span class="hs-identifier hs-type">b</span></a><span class="hs-special">,</span><span>
844+</span><a name="line-844"></a><span> </span><span class="hs-identifier hs-type">Eq</span><span> </span><a href="#local-6989586621679038576"><span class="hs-identifier hs-type">b</span></a><span class="hs-special">,</span><span>
845+</span><a name="line-845"></a><span> </span><span class="hs-identifier hs-type">KnownNat</span><span> </span><span class="hs-special">(</span><a href="Matrix.Internal.html#Count"><span class="hs-identifier hs-type">Count</span></a><span> </span><a href="#local-6989586621679038577"><span class="hs-identifier hs-type">cols</span></a><span class="hs-special">)</span><span class="hs-special">,</span><span>
846+</span><a name="line-846"></a><span> </span><span class="hs-identifier hs-type">KnownNat</span><span> </span><span class="hs-special">(</span><a href="Matrix.Internal.html#Count"><span class="hs-identifier hs-type">Count</span></a><span> </span><a href="#local-6989586621679038578"><span class="hs-identifier hs-type">rows</span></a><span class="hs-special">)</span><span class="hs-special">,</span><span>
847+</span><a name="line-847"></a><span> </span><a href="Matrix.Internal.html#FromLists"><span class="hs-identifier hs-type">FromLists</span></a><span> </span><span class="hs-special">(</span><a href="Utils.Internal.html#Natural"><span class="hs-identifier hs-type">Natural</span></a><span> </span><span class="hs-number">0</span><span> </span><span class="hs-number">1</span><span class="hs-special">)</span><span> </span><a href="#local-6989586621679038578"><span class="hs-identifier hs-type">rows</span></a><span> </span><a href="#local-6989586621679038577"><span class="hs-identifier hs-type">cols</span></a><span>
848+</span><a name="line-848"></a><span> </span><span class="hs-special">)</span><span> </span><span class="hs-glyph">=&gt;</span><span>
849+</span><a name="line-849"></a><span> </span><span class="hs-special">(</span><a href="#local-6989586621679038575"><span class="hs-identifier hs-type">a</span></a><span> </span><span class="hs-glyph">-&gt;</span><span> </span><a href="#local-6989586621679038576"><span class="hs-identifier hs-type">b</span></a><span class="hs-special">)</span><span> </span><span class="hs-glyph">-&gt;</span><span>
850+</span><a name="line-850"></a><span> </span><a href="Matrix.Internal.html#Matrix"><span class="hs-identifier hs-type">Matrix</span></a><span> </span><span class="hs-special">(</span><a href="Utils.Internal.html#Natural"><span class="hs-identifier hs-type">Natural</span></a><span> </span><span class="hs-number">0</span><span> </span><span class="hs-number">1</span><span class="hs-special">)</span><span> </span><a href="#local-6989586621679038577"><span class="hs-identifier hs-type">cols</span></a><span> </span><a href="#local-6989586621679038578"><span class="hs-identifier hs-type">rows</span></a><span>
851+</span><a name="line-851"></a><a name="fromFRel"><a href="Matrix.Internal.html#fromFRel"><span class="hs-identifier">fromFRel</span></a></a><span> </span><a name="local-6989586621679039262"><a href="#local-6989586621679039262"><span class="hs-identifier">f</span></a></a><span> </span><span class="hs-glyph">=</span><span>
852+</span><a name="line-852"></a><span> </span><span class="hs-keyword">let</span><span> </span><a name="local-6989586621679039266"><a href="#local-6989586621679039266"><span class="hs-identifier">minA</span></a></a><span> </span><span class="hs-glyph">=</span><span> </span><span class="hs-identifier hs-var">minBound</span><span> </span><span class="hs-glyph">@</span><a href="#local-6989586621679038575"><span class="hs-identifier hs-type">a</span></a><span>
853+</span><a name="line-853"></a><span> </span><a name="local-6989586621679039267"><a href="#local-6989586621679039267"><span class="hs-identifier">maxA</span></a></a><span> </span><span class="hs-glyph">=</span><span> </span><span class="hs-identifier hs-var">maxBound</span><span> </span><span class="hs-glyph">@</span><a href="#local-6989586621679038575"><span class="hs-identifier hs-type">a</span></a><span>
854+</span><a name="line-854"></a><span> </span><a name="local-6989586621679039268"><a href="#local-6989586621679039268"><span class="hs-identifier">minB</span></a></a><span> </span><span class="hs-glyph">=</span><span> </span><span class="hs-identifier hs-var">minBound</span><span> </span><span class="hs-glyph">@</span><a href="#local-6989586621679038576"><span class="hs-identifier hs-type">b</span></a><span>
855+</span><a name="line-855"></a><span> </span><a name="local-6989586621679039269"><a href="#local-6989586621679039269"><span class="hs-identifier">maxB</span></a></a><span> </span><span class="hs-glyph">=</span><span> </span><span class="hs-identifier hs-var">maxBound</span><span> </span><span class="hs-glyph">@</span><a href="#local-6989586621679038576"><span class="hs-identifier hs-type">b</span></a><span>
856+</span><a name="line-856"></a><span> </span><a name="local-6989586621679039270"><a href="#local-6989586621679039270"><span class="hs-identifier">ccols</span></a></a><span> </span><span class="hs-glyph">=</span><span> </span><span class="hs-identifier hs-var">fromInteger</span><span> </span><span class="hs-operator hs-var">$</span><span> </span><span class="hs-identifier hs-var">natVal</span><span> </span><span class="hs-special">(</span><span class="hs-identifier hs-var">Proxy</span><span> </span><span class="hs-glyph">::</span><span> </span><span class="hs-identifier hs-type">Proxy</span><span> </span><span class="hs-special">(</span><a href="Matrix.Internal.html#Count"><span class="hs-identifier hs-type">Count</span></a><span> </span><a href="#local-6989586621679038577"><span class="hs-identifier hs-type">cols</span></a><span class="hs-special">)</span><span class="hs-special">)</span><span>
857+</span><a name="line-857"></a><span> </span><a name="local-6989586621679039271"><a href="#local-6989586621679039271"><span class="hs-identifier">rrows</span></a></a><span> </span><span class="hs-glyph">=</span><span> </span><span class="hs-identifier hs-var">fromInteger</span><span> </span><span class="hs-operator hs-var">$</span><span> </span><span class="hs-identifier hs-var">natVal</span><span> </span><span class="hs-special">(</span><span class="hs-identifier hs-var">Proxy</span><span> </span><span class="hs-glyph">::</span><span> </span><span class="hs-identifier hs-type">Proxy</span><span> </span><span class="hs-special">(</span><a href="Matrix.Internal.html#Count"><span class="hs-identifier hs-type">Count</span></a><span> </span><a href="#local-6989586621679038578"><span class="hs-identifier hs-type">rows</span></a><span class="hs-special">)</span><span class="hs-special">)</span><span>
858+</span><a name="line-858"></a><span> </span><a name="local-6989586621679039272"><a href="#local-6989586621679039272"><span class="hs-identifier">elementsA</span></a></a><span> </span><span class="hs-glyph">=</span><span> </span><span class="hs-identifier hs-var">take</span><span> </span><a href="#local-6989586621679039270"><span class="hs-identifier hs-var">ccols</span></a><span> </span><span class="hs-special">[</span><a href="#local-6989586621679039266"><span class="hs-identifier hs-var">minA</span></a><span> </span><span class="hs-glyph">..</span><span> </span><a href="#local-6989586621679039267"><span class="hs-identifier hs-var">maxA</span></a><span class="hs-special">]</span><span>
859+</span><a name="line-859"></a><span> </span><a name="local-6989586621679039273"><a href="#local-6989586621679039273"><span class="hs-identifier">elementsB</span></a></a><span> </span><span class="hs-glyph">=</span><span> </span><span class="hs-identifier hs-var">take</span><span> </span><a href="#local-6989586621679039271"><span class="hs-identifier hs-var">rrows</span></a><span> </span><span class="hs-special">[</span><a href="#local-6989586621679039268"><span class="hs-identifier hs-var">minB</span></a><span> </span><span class="hs-glyph">..</span><span> </span><a href="#local-6989586621679039269"><span class="hs-identifier hs-var">maxB</span></a><span class="hs-special">]</span><span>
860+</span><a name="line-860"></a><span> </span><a name="local-6989586621679039274"><a href="#local-6989586621679039274"><span class="hs-identifier">combinations</span></a></a><span> </span><span class="hs-glyph">=</span><span> </span><span class="hs-special">(</span><span class="hs-special">,</span><span class="hs-special">)</span><span> </span><span class="hs-operator hs-var">&lt;$&gt;</span><span> </span><a href="#local-6989586621679039272"><span class="hs-identifier hs-var">elementsA</span></a><span> </span><span class="hs-operator hs-var">&lt;*&gt;</span><span> </span><a href="#local-6989586621679039273"><span class="hs-identifier hs-var">elementsB</span></a><span>
861+</span><a name="line-861"></a><span> </span><a name="local-6989586621679039275"><a href="#local-6989586621679039275"><span class="hs-identifier">combAp</span></a></a><span> </span><span class="hs-glyph">=</span><span> </span><span class="hs-identifier hs-var">map</span><span> </span><span class="hs-identifier hs-var">snd</span><span> </span><span class="hs-operator hs-var">.</span><span> </span><span class="hs-identifier hs-var">sort</span><span> </span><span class="hs-operator hs-var">.</span><span> </span><span class="hs-identifier hs-var">map</span><span> </span><span class="hs-special">(</span><span class="hs-glyph">\</span><span class="hs-special">(</span><a name="local-6989586621679039277"><a href="#local-6989586621679039277"><span class="hs-identifier">a</span></a></a><span class="hs-special">,</span><span> </span><a name="local-6989586621679039278"><a href="#local-6989586621679039278"><span class="hs-identifier">b</span></a></a><span class="hs-special">)</span><span> </span><span class="hs-glyph">-&gt;</span><span> </span><span class="hs-keyword">if</span><span> </span><a href="#local-6989586621679039262"><span class="hs-identifier hs-var">f</span></a><span> </span><a href="#local-6989586621679039277"><span class="hs-identifier hs-var">a</span></a><span> </span><span class="hs-operator hs-var">==</span><span> </span><a href="#local-6989586621679039278"><span class="hs-identifier hs-var">b</span></a><span>
862+</span><a name="line-862"></a><span> </span><span class="hs-keyword">then</span><span> </span><span class="hs-special">(</span><span class="hs-special">(</span><span class="hs-identifier hs-var">fromEnum</span><span> </span><a href="#local-6989586621679039277"><span class="hs-identifier hs-var">a</span></a><span class="hs-special">,</span><span> </span><span class="hs-identifier hs-var">fromEnum</span><span> </span><a href="#local-6989586621679039278"><span class="hs-identifier hs-var">b</span></a><span class="hs-special">)</span><span class="hs-special">,</span><span> </span><a href="Utils.Internal.html#nat"><span class="hs-identifier hs-var">nat</span></a><span> </span><span class="hs-number">1</span><span class="hs-special">)</span><span>
863+</span><a name="line-863"></a><span> </span><span class="hs-keyword">else</span><span> </span><span class="hs-special">(</span><span class="hs-special">(</span><span class="hs-identifier hs-var">fromEnum</span><span> </span><a href="#local-6989586621679039277"><span class="hs-identifier hs-var">a</span></a><span class="hs-special">,</span><span> </span><span class="hs-identifier hs-var">fromEnum</span><span> </span><a href="#local-6989586621679039278"><span class="hs-identifier hs-var">b</span></a><span class="hs-special">)</span><span class="hs-special">,</span><span> </span><a href="Utils.Internal.html#nat"><span class="hs-identifier hs-var">nat</span></a><span> </span><span class="hs-number">0</span><span class="hs-special">)</span><span class="hs-special">)</span><span> </span><span class="hs-operator hs-var">$</span><span> </span><a href="#local-6989586621679039274"><span class="hs-identifier hs-var">combinations</span></a><span>
864+</span><a name="line-864"></a><span> </span><a name="local-6989586621679039276"><a href="#local-6989586621679039276"><span class="hs-identifier">mList</span></a></a><span> </span><span class="hs-glyph">=</span><span> </span><a href="#local-6989586621679039263"><span class="hs-identifier hs-var">buildList</span></a><span> </span><a href="#local-6989586621679039275"><span class="hs-identifier hs-var">combAp</span></a><span> </span><a href="#local-6989586621679039271"><span class="hs-identifier hs-var">rrows</span></a><span>
865+</span><a name="line-865"></a><span> </span><span class="hs-keyword">in</span><span> </span><a href="Matrix.Internal.html#tr"><span class="hs-identifier hs-var">tr</span></a><span> </span><span class="hs-operator hs-var">$</span><span> </span><a href="Matrix.Internal.html#fromLists"><span class="hs-identifier hs-var">fromLists</span></a><span> </span><a href="#local-6989586621679039276"><span class="hs-identifier hs-var">mList</span></a><span>
866+</span><a name="line-866"></a><span> </span><span class="hs-keyword">where</span><span>
867+</span><a name="line-867"></a><span> </span><a name="local-6989586621679039263"><a href="#local-6989586621679039263"><span class="hs-identifier">buildList</span></a></a><span> </span><span class="hs-special">[</span><span class="hs-special">]</span><span> </span><span class="hs-identifier">_</span><span> </span><span class="hs-glyph">=</span><span> </span><span class="hs-special">[</span><span class="hs-special">]</span><span>
868+</span><a name="line-868"></a><span> </span><span class="hs-identifier">buildList</span><span> </span><a name="local-6989586621679039264"><a href="#local-6989586621679039264"><span class="hs-identifier">l</span></a></a><span> </span><a name="local-6989586621679039265"><a href="#local-6989586621679039265"><span class="hs-identifier">r</span></a></a><span> </span><span class="hs-glyph">=</span><span> </span><span class="hs-identifier hs-var">take</span><span> </span><a href="#local-6989586621679039265"><span class="hs-identifier hs-var">r</span></a><span> </span><a href="#local-6989586621679039264"><span class="hs-identifier hs-var">l</span></a><span> </span><span class="hs-glyph">:</span><span> </span><a href="#local-6989586621679039263"><span class="hs-identifier hs-var">buildList</span></a><span> </span><span class="hs-special">(</span><span class="hs-identifier hs-var">drop</span><span> </span><a href="#local-6989586621679039265"><span class="hs-identifier hs-var">r</span></a><span> </span><a href="#local-6989586621679039264"><span class="hs-identifier hs-var">l</span></a><span class="hs-special">)</span><span> </span><a href="#local-6989586621679039265"><span class="hs-identifier hs-var">r</span></a><span>
869+</span><a name="line-869"></a><span>
870+</span><a name="line-870"></a><span class="hs-comment">-- | Lifts functions to relations with dimensions matching @a@ and @b@</span><span>
871+</span><a name="line-871"></a><span class="hs-comment">-- cardinality's.</span><span>
872+</span><a name="line-872"></a><span class="hs-identifier">fromFRel'</span><span> </span><span class="hs-glyph">::</span><span>
873+</span><a name="line-873"></a><span> </span><span class="hs-keyword">forall</span><span> </span><a name="local-6989586621679038573"><a href="#local-6989586621679038573"><span class="hs-identifier">a</span></a></a><span> </span><a name="local-6989586621679038574"><a href="#local-6989586621679038574"><span class="hs-identifier">b</span></a></a><span class="hs-operator">.</span><span>
874+</span><a name="line-874"></a><span> </span><span class="hs-special">(</span><span> </span><span class="hs-identifier hs-type">Bounded</span><span> </span><a href="#local-6989586621679038573"><span class="hs-identifier hs-type">a</span></a><span class="hs-special">,</span><span>
875+</span><a name="line-875"></a><span> </span><span class="hs-identifier hs-type">Bounded</span><span> </span><a href="#local-6989586621679038574"><span class="hs-identifier hs-type">b</span></a><span class="hs-special">,</span><span>
876+</span><a name="line-876"></a><span> </span><span class="hs-identifier hs-type">Enum</span><span> </span><a href="#local-6989586621679038573"><span class="hs-identifier hs-type">a</span></a><span class="hs-special">,</span><span>
877+</span><a name="line-877"></a><span> </span><span class="hs-identifier hs-type">Enum</span><span> </span><a href="#local-6989586621679038574"><span class="hs-identifier hs-type">b</span></a><span class="hs-special">,</span><span>
878+</span><a name="line-878"></a><span> </span><span class="hs-identifier hs-type">Eq</span><span> </span><a href="#local-6989586621679038574"><span class="hs-identifier hs-type">b</span></a><span class="hs-special">,</span><span>
879+</span><a name="line-879"></a><span> </span><span class="hs-identifier hs-type">KnownNat</span><span> </span><span class="hs-special">(</span><a href="Matrix.Internal.html#Count"><span class="hs-identifier hs-type">Count</span></a><span> </span><span class="hs-special">(</span><a href="Matrix.Internal.html#Normalize"><span class="hs-identifier hs-type">Normalize</span></a><span> </span><a href="#local-6989586621679038573"><span class="hs-identifier hs-type">a</span></a><span class="hs-special">)</span><span class="hs-special">)</span><span class="hs-special">,</span><span>
880+</span><a name="line-880"></a><span> </span><span class="hs-identifier hs-type">KnownNat</span><span> </span><span class="hs-special">(</span><a href="Matrix.Internal.html#Count"><span class="hs-identifier hs-type">Count</span></a><span> </span><span class="hs-special">(</span><a href="Matrix.Internal.html#Normalize"><span class="hs-identifier hs-type">Normalize</span></a><span> </span><a href="#local-6989586621679038574"><span class="hs-identifier hs-type">b</span></a><span class="hs-special">)</span><span class="hs-special">)</span><span class="hs-special">,</span><span>
881+</span><a name="line-881"></a><span> </span><a href="Matrix.Internal.html#FromLists"><span class="hs-identifier hs-type">FromLists</span></a><span> </span><span class="hs-special">(</span><a href="Utils.Internal.html#Natural"><span class="hs-identifier hs-type">Natural</span></a><span> </span><span class="hs-number">0</span><span> </span><span class="hs-number">1</span><span class="hs-special">)</span><span> </span><span class="hs-special">(</span><a href="Matrix.Internal.html#Normalize"><span class="hs-identifier hs-type">Normalize</span></a><span> </span><a href="#local-6989586621679038574"><span class="hs-identifier hs-type">b</span></a><span class="hs-special">)</span><span> </span><span class="hs-special">(</span><a href="Matrix.Internal.html#Normalize"><span class="hs-identifier hs-type">Normalize</span></a><span> </span><a href="#local-6989586621679038573"><span class="hs-identifier hs-type">a</span></a><span class="hs-special">)</span><span>
882+</span><a name="line-882"></a><span> </span><span class="hs-special">)</span><span> </span><span class="hs-glyph">=&gt;</span><span>
883+</span><a name="line-883"></a><span> </span><span class="hs-special">(</span><a href="#local-6989586621679038573"><span class="hs-identifier hs-type">a</span></a><span> </span><span class="hs-glyph">-&gt;</span><span> </span><a href="#local-6989586621679038574"><span class="hs-identifier hs-type">b</span></a><span class="hs-special">)</span><span> </span><span class="hs-glyph">-&gt;</span><span>
884+</span><a name="line-884"></a><span> </span><a href="Matrix.Internal.html#Matrix"><span class="hs-identifier hs-type">Matrix</span></a><span> </span><span class="hs-special">(</span><a href="Utils.Internal.html#Natural"><span class="hs-identifier hs-type">Natural</span></a><span> </span><span class="hs-number">0</span><span> </span><span class="hs-number">1</span><span class="hs-special">)</span><span> </span><span class="hs-special">(</span><a href="Matrix.Internal.html#Normalize"><span class="hs-identifier hs-type">Normalize</span></a><span> </span><a href="#local-6989586621679038573"><span class="hs-identifier hs-type">a</span></a><span class="hs-special">)</span><span> </span><span class="hs-special">(</span><a href="Matrix.Internal.html#Normalize"><span class="hs-identifier hs-type">Normalize</span></a><span> </span><a href="#local-6989586621679038574"><span class="hs-identifier hs-type">b</span></a><span class="hs-special">)</span><span>
885+</span><a name="line-885"></a><a name="fromFRel%27"><a href="Matrix.Internal.html#fromFRel%27"><span class="hs-identifier">fromFRel'</span></a></a><span> </span><a name="local-6989586621679039279"><a href="#local-6989586621679039279"><span class="hs-identifier">f</span></a></a><span> </span><span class="hs-glyph">=</span><span>
886+</span><a name="line-886"></a><span> </span><span class="hs-keyword">let</span><span> </span><a name="local-6989586621679039283"><a href="#local-6989586621679039283"><span class="hs-identifier">minA</span></a></a><span> </span><span class="hs-glyph">=</span><span> </span><span class="hs-identifier hs-var">minBound</span><span> </span><span class="hs-glyph">@</span><a href="#local-6989586621679038573"><span class="hs-identifier hs-type">a</span></a><span>
887+</span><a name="line-887"></a><span> </span><a name="local-6989586621679039284"><a href="#local-6989586621679039284"><span class="hs-identifier">maxA</span></a></a><span> </span><span class="hs-glyph">=</span><span> </span><span class="hs-identifier hs-var">maxBound</span><span> </span><span class="hs-glyph">@</span><a href="#local-6989586621679038573"><span class="hs-identifier hs-type">a</span></a><span>
888+</span><a name="line-888"></a><span> </span><a name="local-6989586621679039285"><a href="#local-6989586621679039285"><span class="hs-identifier">minB</span></a></a><span> </span><span class="hs-glyph">=</span><span> </span><span class="hs-identifier hs-var">minBound</span><span> </span><span class="hs-glyph">@</span><a href="#local-6989586621679038574"><span class="hs-identifier hs-type">b</span></a><span>
889+</span><a name="line-889"></a><span> </span><a name="local-6989586621679039286"><a href="#local-6989586621679039286"><span class="hs-identifier">maxB</span></a></a><span> </span><span class="hs-glyph">=</span><span> </span><span class="hs-identifier hs-var">maxBound</span><span> </span><span class="hs-glyph">@</span><a href="#local-6989586621679038574"><span class="hs-identifier hs-type">b</span></a><span>
890+</span><a name="line-890"></a><span> </span><a name="local-6989586621679039287"><a href="#local-6989586621679039287"><span class="hs-identifier">ccols</span></a></a><span> </span><span class="hs-glyph">=</span><span> </span><span class="hs-identifier hs-var">fromInteger</span><span> </span><span class="hs-operator hs-var">$</span><span> </span><span class="hs-identifier hs-var">natVal</span><span> </span><span class="hs-special">(</span><span class="hs-identifier hs-var">Proxy</span><span> </span><span class="hs-glyph">::</span><span> </span><span class="hs-identifier hs-type">Proxy</span><span> </span><span class="hs-special">(</span><a href="Matrix.Internal.html#Count"><span class="hs-identifier hs-type">Count</span></a><span> </span><span class="hs-special">(</span><a href="Matrix.Internal.html#Normalize"><span class="hs-identifier hs-type">Normalize</span></a><span> </span><a href="#local-6989586621679038573"><span class="hs-identifier hs-type">a</span></a><span class="hs-special">)</span><span class="hs-special">)</span><span class="hs-special">)</span><span>
891+</span><a name="line-891"></a><span> </span><a name="local-6989586621679039288"><a href="#local-6989586621679039288"><span class="hs-identifier">rrows</span></a></a><span> </span><span class="hs-glyph">=</span><span> </span><span class="hs-identifier hs-var">fromInteger</span><span> </span><span class="hs-operator hs-var">$</span><span> </span><span class="hs-identifier hs-var">natVal</span><span> </span><span class="hs-special">(</span><span class="hs-identifier hs-var">Proxy</span><span> </span><span class="hs-glyph">::</span><span> </span><span class="hs-identifier hs-type">Proxy</span><span> </span><span class="hs-special">(</span><a href="Matrix.Internal.html#Count"><span class="hs-identifier hs-type">Count</span></a><span> </span><span class="hs-special">(</span><a href="Matrix.Internal.html#Normalize"><span class="hs-identifier hs-type">Normalize</span></a><span> </span><a href="#local-6989586621679038574"><span class="hs-identifier hs-type">b</span></a><span class="hs-special">)</span><span class="hs-special">)</span><span class="hs-special">)</span><span>
892+</span><a name="line-892"></a><span> </span><a name="local-6989586621679039289"><a href="#local-6989586621679039289"><span class="hs-identifier">elementsA</span></a></a><span> </span><span class="hs-glyph">=</span><span> </span><span class="hs-identifier hs-var">take</span><span> </span><a href="#local-6989586621679039287"><span class="hs-identifier hs-var">ccols</span></a><span> </span><span class="hs-special">[</span><a href="#local-6989586621679039283"><span class="hs-identifier hs-var">minA</span></a><span> </span><span class="hs-glyph">..</span><span> </span><a href="#local-6989586621679039284"><span class="hs-identifier hs-var">maxA</span></a><span class="hs-special">]</span><span>
893+</span><a name="line-893"></a><span> </span><a name="local-6989586621679039290"><a href="#local-6989586621679039290"><span class="hs-identifier">elementsB</span></a></a><span> </span><span class="hs-glyph">=</span><span> </span><span class="hs-identifier hs-var">take</span><span> </span><a href="#local-6989586621679039288"><span class="hs-identifier hs-var">rrows</span></a><span> </span><span class="hs-special">[</span><a href="#local-6989586621679039285"><span class="hs-identifier hs-var">minB</span></a><span> </span><span class="hs-glyph">..</span><span> </span><a href="#local-6989586621679039286"><span class="hs-identifier hs-var">maxB</span></a><span class="hs-special">]</span><span>
894+</span><a name="line-894"></a><span> </span><a name="local-6989586621679039291"><a href="#local-6989586621679039291"><span class="hs-identifier">combinations</span></a></a><span> </span><span class="hs-glyph">=</span><span> </span><span class="hs-special">(</span><span class="hs-special">,</span><span class="hs-special">)</span><span> </span><span class="hs-operator hs-var">&lt;$&gt;</span><span> </span><a href="#local-6989586621679039289"><span class="hs-identifier hs-var">elementsA</span></a><span> </span><span class="hs-operator hs-var">&lt;*&gt;</span><span> </span><a href="#local-6989586621679039290"><span class="hs-identifier hs-var">elementsB</span></a><span>
895+</span><a name="line-895"></a><span> </span><a name="local-6989586621679039292"><a href="#local-6989586621679039292"><span class="hs-identifier">combAp</span></a></a><span> </span><span class="hs-glyph">=</span><span> </span><span class="hs-identifier hs-var">map</span><span> </span><span class="hs-identifier hs-var">snd</span><span> </span><span class="hs-operator hs-var">.</span><span> </span><span class="hs-identifier hs-var">sort</span><span> </span><span class="hs-operator hs-var">.</span><span> </span><span class="hs-identifier hs-var">map</span><span> </span><span class="hs-special">(</span><span class="hs-glyph">\</span><span class="hs-special">(</span><a name="local-6989586621679039294"><a href="#local-6989586621679039294"><span class="hs-identifier">a</span></a></a><span class="hs-special">,</span><span> </span><a name="local-6989586621679039295"><a href="#local-6989586621679039295"><span class="hs-identifier">b</span></a></a><span class="hs-special">)</span><span> </span><span class="hs-glyph">-&gt;</span><span> </span><span class="hs-keyword">if</span><span> </span><a href="#local-6989586621679039279"><span class="hs-identifier hs-var">f</span></a><span> </span><a href="#local-6989586621679039294"><span class="hs-identifier hs-var">a</span></a><span> </span><span class="hs-operator hs-var">==</span><span> </span><a href="#local-6989586621679039295"><span class="hs-identifier hs-var">b</span></a><span>
896+</span><a name="line-896"></a><span> </span><span class="hs-keyword">then</span><span> </span><span class="hs-special">(</span><span class="hs-special">(</span><span class="hs-identifier hs-var">fromEnum</span><span> </span><a href="#local-6989586621679039294"><span class="hs-identifier hs-var">a</span></a><span class="hs-special">,</span><span> </span><span class="hs-identifier hs-var">fromEnum</span><span> </span><a href="#local-6989586621679039295"><span class="hs-identifier hs-var">b</span></a><span class="hs-special">)</span><span class="hs-special">,</span><span> </span><a href="Utils.Internal.html#nat"><span class="hs-identifier hs-var">nat</span></a><span> </span><span class="hs-number">1</span><span class="hs-special">)</span><span>
897+</span><a name="line-897"></a><span> </span><span class="hs-keyword">else</span><span> </span><span class="hs-special">(</span><span class="hs-special">(</span><span class="hs-identifier hs-var">fromEnum</span><span> </span><a href="#local-6989586621679039294"><span class="hs-identifier hs-var">a</span></a><span class="hs-special">,</span><span> </span><span class="hs-identifier hs-var">fromEnum</span><span> </span><a href="#local-6989586621679039295"><span class="hs-identifier hs-var">b</span></a><span class="hs-special">)</span><span class="hs-special">,</span><span> </span><a href="Utils.Internal.html#nat"><span class="hs-identifier hs-var">nat</span></a><span> </span><span class="hs-number">0</span><span class="hs-special">)</span><span class="hs-special">)</span><span> </span><span class="hs-operator hs-var">$</span><span> </span><a href="#local-6989586621679039291"><span class="hs-identifier hs-var">combinations</span></a><span>
898+</span><a name="line-898"></a><span> </span><a name="local-6989586621679039293"><a href="#local-6989586621679039293"><span class="hs-identifier">mList</span></a></a><span> </span><span class="hs-glyph">=</span><span> </span><a href="#local-6989586621679039280"><span class="hs-identifier hs-var">buildList</span></a><span> </span><a href="#local-6989586621679039292"><span class="hs-identifier hs-var">combAp</span></a><span> </span><a href="#local-6989586621679039288"><span class="hs-identifier hs-var">rrows</span></a><span>
899+</span><a name="line-899"></a><span> </span><span class="hs-keyword">in</span><span> </span><a href="Matrix.Internal.html#tr"><span class="hs-identifier hs-var">tr</span></a><span> </span><span class="hs-operator hs-var">$</span><span> </span><a href="Matrix.Internal.html#fromLists"><span class="hs-identifier hs-var">fromLists</span></a><span> </span><a href="#local-6989586621679039293"><span class="hs-identifier hs-var">mList</span></a><span>
900+</span><a name="line-900"></a><span> </span><span class="hs-keyword">where</span><span>
901+</span><a name="line-901"></a><span> </span><a name="local-6989586621679039280"><a href="#local-6989586621679039280"><span class="hs-identifier">buildList</span></a></a><span> </span><span class="hs-special">[</span><span class="hs-special">]</span><span> </span><span class="hs-identifier">_</span><span> </span><span class="hs-glyph">=</span><span> </span><span class="hs-special">[</span><span class="hs-special">]</span><span>
902+</span><a name="line-902"></a><span> </span><span class="hs-identifier">buildList</span><span> </span><a name="local-6989586621679039281"><a href="#local-6989586621679039281"><span class="hs-identifier">l</span></a></a><span> </span><a name="local-6989586621679039282"><a href="#local-6989586621679039282"><span class="hs-identifier">r</span></a></a><span> </span><span class="hs-glyph">=</span><span> </span><span class="hs-identifier hs-var">take</span><span> </span><a href="#local-6989586621679039282"><span class="hs-identifier hs-var">r</span></a><span> </span><a href="#local-6989586621679039281"><span class="hs-identifier hs-var">l</span></a><span> </span><span class="hs-glyph">:</span><span> </span><a href="#local-6989586621679039280"><span class="hs-identifier hs-var">buildList</span></a><span> </span><span class="hs-special">(</span><span class="hs-identifier hs-var">drop</span><span> </span><a href="#local-6989586621679039282"><span class="hs-identifier hs-var">r</span></a><span> </span><a href="#local-6989586621679039281"><span class="hs-identifier hs-var">l</span></a><span class="hs-special">)</span><span> </span><a href="#local-6989586621679039282"><span class="hs-identifier hs-var">r</span></a><span>
903+</span><a name="line-903"></a></pre></body></html>
build/x86_64-linux/ghc-8.6.5/laop-0.1.0.0/doc/html/laop-0.1.0.0-docs/src/Matrix.Nat.htmlnew file+484
@@ -0,0 +1,484 @@
1+<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"><html xmlns="http://www.w3.org/1999/xhtml"><head><link rel="stylesheet" type="text/css" href="style.css" /><script type="text/javascript" src="highlight.js"></script></head><body><pre><span class="hs-pragma">{-# LANGUAGE AllowAmbiguousTypes #-}</span><span>
2+</span><a name="line-2"></a><span class="hs-pragma">{-# LANGUAGE DataKinds #-}</span><span>
3+</span><a name="line-3"></a><span class="hs-pragma">{-# LANGUAGE DerivingVia #-}</span><span>
4+</span><a name="line-4"></a><span class="hs-pragma">{-# LANGUAGE FlexibleContexts #-}</span><span>
5+</span><a name="line-5"></a><span class="hs-pragma">{-# LANGUAGE FlexibleInstances #-}</span><span>
6+</span><a name="line-6"></a><span class="hs-pragma">{-# LANGUAGE GADTs #-}</span><span>
7+</span><a name="line-7"></a><span class="hs-pragma">{-# LANGUAGE KindSignatures #-}</span><span>
8+</span><a name="line-8"></a><span class="hs-pragma">{-# LANGUAGE MultiParamTypeClasses #-}</span><span>
9+</span><a name="line-9"></a><span class="hs-pragma">{-# LANGUAGE NoStarIsType #-}</span><span>
10+</span><a name="line-10"></a><span class="hs-pragma">{-# LANGUAGE RankNTypes #-}</span><span>
11+</span><a name="line-11"></a><span class="hs-pragma">{-# LANGUAGE ScopedTypeVariables #-}</span><span>
12+</span><a name="line-12"></a><span class="hs-pragma">{-# LANGUAGE TypeApplications #-}</span><span>
13+</span><a name="line-13"></a><span class="hs-pragma">{-# LANGUAGE TypeOperators #-}</span><span>
14+</span><a name="line-14"></a><span class="hs-pragma">{-# LANGUAGE UndecidableInstances #-}</span><span>
15+</span><a name="line-15"></a><span>
16+</span><a name="line-16"></a><span class="hs-comment">-----------------------------------------------------------------------------</span><span>
17+</span><a name="line-17"></a><span class="hs-comment">-- |</span><span>
18+</span><a name="line-18"></a><span class="hs-comment">-- Module : Matrix.Nat</span><span>
19+</span><a name="line-19"></a><span class="hs-comment">-- Copyright : (c) Armando Santos 2019-2020</span><span>
20+</span><a name="line-20"></a><span class="hs-comment">-- Maintainer : armandoifsantos@gmail.com</span><span>
21+</span><a name="line-21"></a><span class="hs-comment">-- Stability : experimental</span><span>
22+</span><a name="line-22"></a><span class="hs-comment">--</span><span>
23+</span><a name="line-23"></a><span class="hs-comment">-- The LAoP discipline generalises relations and functions treating them as</span><span>
24+</span><a name="line-24"></a><span class="hs-comment">-- Boolean matrices and in turn consider these as arrows.</span><span>
25+</span><a name="line-25"></a><span class="hs-comment">--</span><span>
26+</span><a name="line-26"></a><span class="hs-comment">-- __LAoP__ is a library for algebraic (inductive) construction and manipulation of matrices</span><span>
27+</span><a name="line-27"></a><span class="hs-comment">-- in Haskell. See &lt;https://github.com/bolt12/master-thesis my Msc Thesis&gt; for the</span><span>
28+</span><a name="line-28"></a><span class="hs-comment">-- motivation behind the library, the underlying theory, and implementation details.</span><span>
29+</span><a name="line-29"></a><span class="hs-comment">--</span><span>
30+</span><a name="line-30"></a><span class="hs-comment">-- This module offers a newtype wrapper around 'Matrix.Type.Matrix' that</span><span>
31+</span><a name="line-31"></a><span class="hs-comment">-- uses type level naturals instead of standard data types for the matrices</span><span>
32+</span><a name="line-32"></a><span class="hs-comment">-- dimensions.</span><span>
33+</span><a name="line-33"></a><span class="hs-comment">--</span><span>
34+</span><a name="line-34"></a><span class="hs-comment">-----------------------------------------------------------------------------</span><span>
35+</span><a name="line-35"></a><span>
36+</span><a name="line-36"></a><span class="hs-keyword">module</span><span> </span><span class="hs-identifier">Matrix.Nat</span><span>
37+</span><a name="line-37"></a><span> </span><span class="hs-special">(</span><span> </span><span class="hs-comment">-- | LAoP (Linear Algebra of Programming) Inductive Matrix definition.</span><span>
38+</span><a name="line-38"></a><span> </span><span class="hs-comment">--</span><span>
39+</span><a name="line-39"></a><span> </span><span class="hs-comment">-- LAoP generalises relations and functions treating them as</span><span>
40+</span><a name="line-40"></a><span> </span><span class="hs-comment">-- Boolean matrices and in turn consider these as arrows.</span><span>
41+</span><a name="line-41"></a><span> </span><span class="hs-comment">-- This library offers many of the combinators mentioned in the work of</span><span>
42+</span><a name="line-42"></a><span> </span><span class="hs-comment">-- Macedo (2012) and Oliveira (2012).</span><span>
43+</span><a name="line-43"></a><span> </span><span class="hs-comment">--</span><span>
44+</span><a name="line-44"></a><span> </span><span class="hs-comment">-- This definition is a wrapper around 'Matrix.Type' but</span><span>
45+</span><a name="line-45"></a><span> </span><span class="hs-comment">-- dimensions are type level Naturals. Type inference might not</span><span>
46+</span><a name="line-46"></a><span> </span><span class="hs-comment">-- be as desired.</span><span>
47+</span><a name="line-47"></a><span> </span><span class="hs-comment">--</span><span>
48+</span><a name="line-48"></a><span> </span><span class="hs-comment">-- There exists two type families that make it easier to write</span><span>
49+</span><a name="line-49"></a><span> </span><span class="hs-comment">-- matrix dimensions: 'FromNat' and 'Count'. This approach</span><span>
50+</span><a name="line-50"></a><span> </span><span class="hs-comment">-- leads to a very straightforward implementation </span><span>
51+</span><a name="line-51"></a><span> </span><span class="hs-comment">-- of LAoP combinators. </span><span>
52+</span><a name="line-52"></a><span>
53+</span><a name="line-53"></a><span> </span><span class="hs-comment">-- * Type safe matrix representation</span><span>
54+</span><a name="line-54"></a><span> </span><a href="Matrix.Nat.html#Matrix"><span class="hs-identifier hs-type">Matrix</span></a><span> </span><span class="hs-special">(</span><span class="hs-glyph">..</span><span class="hs-special">)</span><span class="hs-special">,</span><span>
55+</span><a name="line-55"></a><span>
56+</span><a name="line-56"></a><span> </span><span class="hs-comment">-- * Primitives</span><span>
57+</span><a name="line-57"></a><span> </span><a href="Matrix.Nat.html#empty"><span class="hs-identifier hs-var">empty</span></a><span class="hs-special">,</span><span>
58+</span><a name="line-58"></a><span> </span><a href="Matrix.Nat.html#one"><span class="hs-identifier hs-var">one</span></a><span class="hs-special">,</span><span>
59+</span><a name="line-59"></a><span> </span><a href="Matrix.Nat.html#junc"><span class="hs-identifier hs-var">junc</span></a><span class="hs-special">,</span><span>
60+</span><a name="line-60"></a><span> </span><a href="Matrix.Nat.html#split"><span class="hs-identifier hs-var">split</span></a><span class="hs-special">,</span><span>
61+</span><a name="line-61"></a><span>
62+</span><a name="line-62"></a><span> </span><span class="hs-comment">-- * Auxiliary type families</span><span>
63+</span><a name="line-63"></a><span> </span><a href="Matrix.Internal.html#FromNat"><span class="hs-identifier hs-type">I.FromNat</span></a><span class="hs-special">,</span><span>
64+</span><a name="line-64"></a><span> </span><a href="Matrix.Internal.html#Count"><span class="hs-identifier hs-type">I.Count</span></a><span class="hs-special">,</span><span>
65+</span><a name="line-65"></a><span> </span><a href="Matrix.Internal.html#Normalize"><span class="hs-identifier hs-type">I.Normalize</span></a><span class="hs-special">,</span><span>
66+</span><a name="line-66"></a><span>
67+</span><a name="line-67"></a><span> </span><span class="hs-comment">-- * Matrix construction and conversion</span><span>
68+</span><a name="line-68"></a><span> </span><a href="Matrix.Internal.html#FromLists"><span class="hs-identifier hs-type">I.FromLists</span></a><span class="hs-special">,</span><span>
69+</span><a name="line-69"></a><span> </span><a href="Matrix.Nat.html#fromLists"><span class="hs-identifier hs-var">fromLists</span></a><span class="hs-special">,</span><span>
70+</span><a name="line-70"></a><span> </span><a href="Matrix.Nat.html#toLists"><span class="hs-identifier hs-var">toLists</span></a><span class="hs-special">,</span><span>
71+</span><a name="line-71"></a><span> </span><a href="Matrix.Nat.html#toList"><span class="hs-identifier hs-var">toList</span></a><span class="hs-special">,</span><span>
72+</span><a name="line-72"></a><span> </span><a href="Matrix.Nat.html#matrixBuilder"><span class="hs-identifier hs-var">matrixBuilder</span></a><span class="hs-special">,</span><span>
73+</span><a name="line-73"></a><span> </span><a href="Matrix.Nat.html#row"><span class="hs-identifier hs-var">row</span></a><span class="hs-special">,</span><span>
74+</span><a name="line-74"></a><span> </span><a href="Matrix.Nat.html#col"><span class="hs-identifier hs-var">col</span></a><span class="hs-special">,</span><span>
75+</span><a name="line-75"></a><span> </span><a href="Matrix.Nat.html#zeros"><span class="hs-identifier hs-var">zeros</span></a><span class="hs-special">,</span><span>
76+</span><a name="line-76"></a><span> </span><a href="Matrix.Nat.html#ones"><span class="hs-identifier hs-var">ones</span></a><span class="hs-special">,</span><span>
77+</span><a name="line-77"></a><span> </span><a href="Matrix.Nat.html#bang"><span class="hs-identifier hs-var">bang</span></a><span class="hs-special">,</span><span>
78+</span><a name="line-78"></a><span> </span><a href="Matrix.Nat.html#constant"><span class="hs-identifier hs-var">constant</span></a><span class="hs-special">,</span><span>
79+</span><a name="line-79"></a><span>
80+</span><a name="line-80"></a><span> </span><span class="hs-comment">-- * Misc</span><span>
81+</span><a name="line-81"></a><span> </span><span class="hs-comment">-- ** Get dimensions</span><span>
82+</span><a name="line-82"></a><span> </span><a href="Matrix.Nat.html#columns"><span class="hs-identifier hs-var">columns</span></a><span class="hs-special">,</span><span>
83+</span><a name="line-83"></a><span> </span><a href="Matrix.Nat.html#rows"><span class="hs-identifier hs-var">rows</span></a><span class="hs-special">,</span><span>
84+</span><a name="line-84"></a><span>
85+</span><a name="line-85"></a><span> </span><span class="hs-comment">-- ** Matrix Transposition</span><span>
86+</span><a name="line-86"></a><span> </span><a href="Matrix.Nat.html#tr"><span class="hs-identifier hs-var">tr</span></a><span class="hs-special">,</span><span>
87+</span><a name="line-87"></a><span>
88+</span><a name="line-88"></a><span> </span><span class="hs-comment">-- ** Selective operator</span><span>
89+</span><a name="line-89"></a><span> </span><a href="Matrix.Nat.html#select"><span class="hs-identifier hs-var">select</span></a><span class="hs-special">,</span><span>
90+</span><a name="line-90"></a><span>
91+</span><a name="line-91"></a><span> </span><span class="hs-comment">-- ** McCarthy's Conditional</span><span>
92+</span><a name="line-92"></a><span> </span><a href="Matrix.Nat.html#cond"><span class="hs-identifier hs-var">cond</span></a><span class="hs-special">,</span><span>
93+</span><a name="line-93"></a><span>
94+</span><a name="line-94"></a><span> </span><span class="hs-comment">-- ** Matrix &quot;abiding&quot;</span><span>
95+</span><a name="line-95"></a><span> </span><a href="Matrix.Nat.html#abideJS"><span class="hs-identifier hs-var">abideJS</span></a><span class="hs-special">,</span><span>
96+</span><a name="line-96"></a><span> </span><a href="Matrix.Nat.html#abideSJ"><span class="hs-identifier hs-var">abideSJ</span></a><span class="hs-special">,</span><span>
97+</span><a name="line-97"></a><span>
98+</span><a name="line-98"></a><span> </span><span class="hs-comment">-- * Biproduct approach</span><span>
99+</span><a name="line-99"></a><span> </span><span class="hs-comment">-- ** Split</span><span>
100+</span><a name="line-100"></a><span> </span><span class="hs-special">(</span><a href="Matrix.Nat.html#%3D%3D%3D"><span class="hs-operator hs-var">===</span></a><span class="hs-special">)</span><span class="hs-special">,</span><span>
101+</span><a name="line-101"></a><span> </span><span class="hs-comment">-- *** Projections</span><span>
102+</span><a name="line-102"></a><span> </span><a href="Matrix.Nat.html#p1"><span class="hs-identifier hs-var">p1</span></a><span class="hs-special">,</span><span>
103+</span><a name="line-103"></a><span> </span><a href="Matrix.Nat.html#p2"><span class="hs-identifier hs-var">p2</span></a><span class="hs-special">,</span><span>
104+</span><a name="line-104"></a><span> </span><span class="hs-comment">-- ** Junc</span><span>
105+</span><a name="line-105"></a><span> </span><span class="hs-special">(</span><a href="Matrix.Nat.html#%7C%7C%7C"><span class="hs-operator hs-var">|||</span></a><span class="hs-special">)</span><span class="hs-special">,</span><span>
106+</span><a name="line-106"></a><span> </span><span class="hs-comment">-- *** Injections</span><span>
107+</span><a name="line-107"></a><span> </span><a href="Matrix.Nat.html#i1"><span class="hs-identifier hs-var">i1</span></a><span class="hs-special">,</span><span>
108+</span><a name="line-108"></a><span> </span><a href="Matrix.Nat.html#i2"><span class="hs-identifier hs-var">i2</span></a><span class="hs-special">,</span><span>
109+</span><a name="line-109"></a><span> </span><span class="hs-comment">-- ** Bifunctors</span><span>
110+</span><a name="line-110"></a><span> </span><span class="hs-special">(</span><a href="Matrix.Nat.html#-%7C-"><span class="hs-operator hs-var">-|-</span></a><span class="hs-special">)</span><span class="hs-special">,</span><span>
111+</span><a name="line-111"></a><span> </span><span class="hs-special">(</span><a href="Matrix.Nat.html#%3E%3C"><span class="hs-operator hs-var">&gt;&lt;</span></a><span class="hs-special">)</span><span class="hs-special">,</span><span>
112+</span><a name="line-112"></a><span>
113+</span><a name="line-113"></a><span> </span><span class="hs-comment">-- ** Applicative matrix combinators</span><span>
114+</span><a name="line-114"></a><span>
115+</span><a name="line-115"></a><span> </span><span class="hs-comment">-- | Note that given the restrictions imposed it is not possible to</span><span>
116+</span><a name="line-116"></a><span> </span><span class="hs-comment">-- implement the standard type classes present in standard Haskell.</span><span>
117+</span><a name="line-117"></a><span> </span><span class="hs-comment">-- *** Matrix pairing projections</span><span>
118+</span><a name="line-118"></a><span> </span><a href="Matrix.Nat.html#kp1"><span class="hs-identifier hs-var">kp1</span></a><span class="hs-special">,</span><span>
119+</span><a name="line-119"></a><span> </span><a href="Matrix.Nat.html#kp2"><span class="hs-identifier hs-var">kp2</span></a><span class="hs-special">,</span><span>
120+</span><a name="line-120"></a><span>
121+</span><a name="line-121"></a><span> </span><span class="hs-comment">-- *** Matrix pairing</span><span>
122+</span><a name="line-122"></a><span> </span><a href="Matrix.Nat.html#khatri"><span class="hs-identifier hs-var">khatri</span></a><span class="hs-special">,</span><span>
123+</span><a name="line-123"></a><span>
124+</span><a name="line-124"></a><span> </span><span class="hs-comment">-- * Matrix composition and lifting</span><span>
125+</span><a name="line-125"></a><span>
126+</span><a name="line-126"></a><span> </span><span class="hs-comment">-- ** Arrow matrix combinators</span><span>
127+</span><a name="line-127"></a><span>
128+</span><a name="line-128"></a><span> </span><span class="hs-comment">-- | Note that given the restrictions imposed it is not possible to</span><span>
129+</span><a name="line-129"></a><span> </span><span class="hs-comment">-- implement the standard type classes present in standard Haskell.</span><span>
130+</span><a name="line-130"></a><span> </span><a href="Matrix.Nat.html#identity"><span class="hs-identifier hs-var">identity</span></a><span class="hs-special">,</span><span>
131+</span><a name="line-131"></a><span> </span><a href="Matrix.Nat.html#comp"><span class="hs-identifier hs-var">comp</span></a><span class="hs-special">,</span><span>
132+</span><a name="line-132"></a><span> </span><a href="Matrix.Nat.html#fromF"><span class="hs-identifier hs-var">fromF</span></a><span class="hs-special">,</span><span>
133+</span><a name="line-133"></a><span> </span><a href="Matrix.Nat.html#fromF%27"><span class="hs-identifier hs-var">fromF'</span></a><span class="hs-special">,</span><span>
134+</span><a name="line-134"></a><span>
135+</span><a name="line-135"></a><span> </span><span class="hs-comment">-- * Matrix printing</span><span>
136+</span><a name="line-136"></a><span> </span><a href="Matrix.Nat.html#pretty"><span class="hs-identifier hs-var">pretty</span></a><span class="hs-special">,</span><span>
137+</span><a name="line-137"></a><span> </span><a href="Matrix.Nat.html#prettyPrint"><span class="hs-identifier hs-var">prettyPrint</span></a><span>
138+</span><a name="line-138"></a><span> </span><span class="hs-special">)</span><span>
139+</span><a name="line-139"></a><span class="hs-keyword">where</span><span>
140+</span><a name="line-140"></a><span>
141+</span><a name="line-141"></a><span class="hs-keyword">import</span><span> </span><span class="hs-identifier">Data.Proxy</span><span>
142+</span><a name="line-142"></a><span class="hs-keyword">import</span><span> </span><span class="hs-identifier">GHC.TypeLits</span><span>
143+</span><a name="line-143"></a><span class="hs-keyword">import</span><span> </span><span class="hs-identifier">Control.DeepSeq</span><span>
144+</span><a name="line-144"></a><span class="hs-keyword">import</span><span> </span><span class="hs-keyword">qualified</span><span> </span><span class="hs-identifier">Control.Category</span><span> </span><span class="hs-keyword">as</span><span> </span><span class="hs-identifier">C</span><span>
145+</span><a name="line-145"></a><span class="hs-keyword">import</span><span> </span><span class="hs-keyword">qualified</span><span> </span><a href="Matrix.Internal.html"><span class="hs-identifier">Matrix.Internal</span></a><span> </span><span class="hs-keyword">as</span><span> </span><span class="hs-identifier">I</span><span>
146+</span><a name="line-146"></a><span>
147+</span><a name="line-147"></a><span class="hs-keyword">newtype</span><span> </span><a name="Matrix"><a href="Matrix.Nat.html#Matrix"><span class="hs-identifier">Matrix</span></a></a><span> </span><a name="local-6989586621679063540"><a href="#local-6989586621679063540"><span class="hs-identifier">e</span></a></a><span> </span><span class="hs-special">(</span><a name="local-6989586621679063541"><a href="#local-6989586621679063541"><span class="hs-identifier">cols</span></a></a><span> </span><span class="hs-glyph">::</span><span> </span><span class="hs-identifier hs-type">Nat</span><span class="hs-special">)</span><span> </span><span class="hs-special">(</span><a name="local-6989586621679063542"><a href="#local-6989586621679063542"><span class="hs-identifier">rows</span></a></a><span> </span><span class="hs-glyph">::</span><span> </span><span class="hs-identifier hs-type">Nat</span><span class="hs-special">)</span><span> </span><span class="hs-glyph">=</span><span> </span><a name="M"><a href="Matrix.Nat.html#M"><span class="hs-identifier">M</span></a></a><span> </span><span class="hs-special">(</span><a href="Matrix.Internal.html#Matrix"><span class="hs-identifier hs-type">I.Matrix</span></a><span> </span><a href="#local-6989586621679063540"><span class="hs-identifier hs-type">e</span></a><span> </span><span class="hs-special">(</span><a href="Matrix.Internal.html#FromNat"><span class="hs-identifier hs-type">I.FromNat</span></a><span> </span><a href="#local-6989586621679063541"><span class="hs-identifier hs-type">cols</span></a><span class="hs-special">)</span><span> </span><span class="hs-special">(</span><a href="Matrix.Internal.html#FromNat"><span class="hs-identifier hs-type">I.FromNat</span></a><span> </span><a href="#local-6989586621679063542"><span class="hs-identifier hs-type">rows</span></a><span class="hs-special">)</span><span class="hs-special">)</span><span>
148+</span><a name="line-148"></a><span> </span><span class="hs-keyword">deriving</span><span> </span><span class="hs-special">(</span><span class="hs-identifier hs-type">Show</span><span class="hs-special">,</span><span> </span><span class="hs-identifier hs-type">Num</span><span class="hs-special">,</span><span> </span><span class="hs-identifier hs-type">Eq</span><span class="hs-special">,</span><span> </span><span class="hs-identifier hs-type">Ord</span><span class="hs-special">,</span><span> </span><span class="hs-identifier hs-type">NFData</span><span class="hs-special">)</span><span> </span><span class="hs-keyword">via</span><span> </span><span class="hs-special">(</span><a href="Matrix.Internal.html#Matrix"><span class="hs-identifier hs-type">I.Matrix</span></a><span> </span><a href="#local-6989586621679063540"><span class="hs-identifier hs-type">e</span></a><span> </span><span class="hs-special">(</span><a href="Matrix.Internal.html#FromNat"><span class="hs-identifier hs-type">I.FromNat</span></a><span> </span><a href="#local-6989586621679063541"><span class="hs-identifier hs-type">cols</span></a><span class="hs-special">)</span><span> </span><span class="hs-special">(</span><a href="Matrix.Internal.html#FromNat"><span class="hs-identifier hs-type">I.FromNat</span></a><span> </span><a href="#local-6989586621679063542"><span class="hs-identifier hs-type">rows</span></a><span class="hs-special">)</span><span class="hs-special">)</span><span>
149+</span><a name="line-149"></a><span>
150+</span><a name="line-150"></a><span class="hs-comment">-- | It isn't possible to implement the 'id' function so it's</span><span>
151+</span><a name="line-151"></a><span class="hs-comment">-- implementation is 'undefined'. However 'comp' can be and this partial</span><span>
152+</span><a name="line-152"></a><span class="hs-comment">-- class implementation exists just to make the code more readable.</span><span>
153+</span><a name="line-153"></a><span class="hs-comment">--</span><span>
154+</span><a name="line-154"></a><span class="hs-comment">-- Please use 'identity' instead.</span><span>
155+</span><a name="line-155"></a><span class="hs-keyword">instance</span><span> </span><span class="hs-special">(</span><span class="hs-identifier hs-type">Num</span><span> </span><a href="#local-6989586621679063543"><span class="hs-identifier hs-type">e</span></a><span class="hs-special">)</span><span> </span><span class="hs-glyph">=&gt;</span><span> </span><span class="hs-identifier hs-type">C.Category</span><span> </span><span class="hs-special">(</span><a href="Matrix.Nat.html#Matrix"><span class="hs-identifier hs-type">Matrix</span></a><span> </span><a href="#local-6989586621679063543"><span class="hs-identifier hs-type">e</span></a><span class="hs-special">)</span><span> </span><span class="hs-keyword">where</span><span>
156+</span><a name="line-156"></a><span> </span><a name="local-8214565720323789508"><span class="hs-identifier">id</span></a><span> </span><span class="hs-glyph">=</span><span> </span><span class="hs-identifier hs-var">undefined</span><span>
157+</span><a name="line-157"></a><span> </span><span class="hs-special">(</span><a name="local-8214565720323789507"><span class="hs-operator">.</span></a><span class="hs-special">)</span><span> </span><span class="hs-glyph">=</span><span> </span><a href="Matrix.Nat.html#comp"><span class="hs-identifier hs-var">comp</span></a><span>
158+</span><a name="line-158"></a><span>
159+</span><a name="line-159"></a><span class="hs-comment">-- Primitives</span><span>
160+</span><a name="line-160"></a><span>
161+</span><a name="line-161"></a><span class="hs-identifier">empty</span><span> </span><span class="hs-glyph">::</span><span> </span><a href="Matrix.Nat.html#Matrix"><span class="hs-identifier hs-type">Matrix</span></a><span> </span><a href="#local-6989586621679063670"><span class="hs-identifier hs-type">e</span></a><span> </span><span class="hs-number">0</span><span> </span><span class="hs-number">0</span><span>
162+</span><a name="line-162"></a><a name="empty"><a href="Matrix.Nat.html#empty"><span class="hs-identifier">empty</span></a></a><span> </span><span class="hs-glyph">=</span><span> </span><a href="Matrix.Nat.html#M"><span class="hs-identifier hs-var">M</span></a><span> </span><a href="Matrix.Internal.html#Empty"><span class="hs-identifier hs-var">I.Empty</span></a><span>
163+</span><a name="line-163"></a><span>
164+</span><a name="line-164"></a><span class="hs-identifier">one</span><span> </span><span class="hs-glyph">::</span><span> </span><a href="#local-6989586621679063669"><span class="hs-identifier hs-type">e</span></a><span> </span><span class="hs-glyph">-&gt;</span><span> </span><a href="Matrix.Nat.html#Matrix"><span class="hs-identifier hs-type">Matrix</span></a><span> </span><a href="#local-6989586621679063669"><span class="hs-identifier hs-type">e</span></a><span> </span><span class="hs-number">1</span><span> </span><span class="hs-number">1</span><span>
165+</span><a name="line-165"></a><a name="one"><a href="Matrix.Nat.html#one"><span class="hs-identifier">one</span></a></a><span> </span><span class="hs-glyph">=</span><span> </span><a href="Matrix.Nat.html#M"><span class="hs-identifier hs-var">M</span></a><span> </span><span class="hs-operator hs-var">.</span><span> </span><a href="Matrix.Internal.html#One"><span class="hs-identifier hs-var">I.One</span></a><span>
166+</span><a name="line-166"></a><span>
167+</span><a name="line-167"></a><span class="hs-identifier">junc</span><span> </span><span class="hs-glyph">::</span><span>
168+</span><a name="line-168"></a><span> </span><span class="hs-special">(</span><span class="hs-identifier hs-type">I.FromNat</span><span> </span><a href="#local-6989586621679063664"><span class="hs-identifier hs-type">cols3</span></a><span> </span><span class="hs-glyph">~</span><span> </span><span class="hs-identifier hs-type">Either</span><span> </span><span class="hs-special">(</span><a href="Matrix.Internal.html#FromNat"><span class="hs-identifier hs-type">I.FromNat</span></a><span> </span><a href="#local-6989586621679063665"><span class="hs-identifier hs-type">cols1</span></a><span class="hs-special">)</span><span> </span><span class="hs-special">(</span><a href="Matrix.Internal.html#FromNat"><span class="hs-identifier hs-type">I.FromNat</span></a><span> </span><a href="#local-6989586621679063666"><span class="hs-identifier hs-type">cols2</span></a><span class="hs-special">)</span><span class="hs-special">)</span><span> </span><span class="hs-glyph">=&gt;</span><span>
169+</span><a name="line-169"></a><span> </span><a href="Matrix.Nat.html#Matrix"><span class="hs-identifier hs-type">Matrix</span></a><span> </span><a href="#local-6989586621679063667"><span class="hs-identifier hs-type">e</span></a><span> </span><a href="#local-6989586621679063665"><span class="hs-identifier hs-type">cols1</span></a><span> </span><a href="#local-6989586621679063668"><span class="hs-identifier hs-type">rows</span></a><span> </span><span class="hs-glyph">-&gt;</span><span>
170+</span><a name="line-170"></a><span> </span><a href="Matrix.Nat.html#Matrix"><span class="hs-identifier hs-type">Matrix</span></a><span> </span><a href="#local-6989586621679063667"><span class="hs-identifier hs-type">e</span></a><span> </span><a href="#local-6989586621679063666"><span class="hs-identifier hs-type">cols2</span></a><span> </span><a href="#local-6989586621679063668"><span class="hs-identifier hs-type">rows</span></a><span> </span><span class="hs-glyph">-&gt;</span><span>
171+</span><a name="line-171"></a><span> </span><a href="Matrix.Nat.html#Matrix"><span class="hs-identifier hs-type">Matrix</span></a><span> </span><a href="#local-6989586621679063667"><span class="hs-identifier hs-type">e</span></a><span> </span><a href="#local-6989586621679063664"><span class="hs-identifier hs-type">cols3</span></a><span> </span><a href="#local-6989586621679063668"><span class="hs-identifier hs-type">rows</span></a><span>
172+</span><a name="line-172"></a><a name="junc"><a href="Matrix.Nat.html#junc"><span class="hs-identifier">junc</span></a></a><span> </span><span class="hs-special">(</span><a href="Matrix.Nat.html#M"><span class="hs-identifier hs-var">M</span></a><span> </span><a name="local-6989586621679063671"><a href="#local-6989586621679063671"><span class="hs-identifier">a</span></a></a><span class="hs-special">)</span><span> </span><span class="hs-special">(</span><a href="Matrix.Nat.html#M"><span class="hs-identifier hs-var">M</span></a><span> </span><a name="local-6989586621679063672"><a href="#local-6989586621679063672"><span class="hs-identifier">b</span></a></a><span class="hs-special">)</span><span> </span><span class="hs-glyph">=</span><span> </span><a href="Matrix.Nat.html#M"><span class="hs-identifier hs-var">M</span></a><span> </span><span class="hs-special">(</span><a href="Matrix.Internal.html#Junc"><span class="hs-identifier hs-var">I.Junc</span></a><span> </span><a href="#local-6989586621679063671"><span class="hs-identifier hs-var">a</span></a><span> </span><a href="#local-6989586621679063672"><span class="hs-identifier hs-var">b</span></a><span class="hs-special">)</span><span>
173+</span><a name="line-173"></a><span>
174+</span><a name="line-174"></a><span class="hs-keyword">infixl</span><span> </span><span class="hs-number">3</span><span> </span><a href="Matrix.Nat.html#%7C%7C%7C"><span class="hs-operator hs-var">|||</span></a><span>
175+</span><a name="line-175"></a><span class="hs-special">(</span><span class="hs-operator">|||</span><span class="hs-special">)</span><span> </span><span class="hs-glyph">::</span><span>
176+</span><a name="line-176"></a><span> </span><span class="hs-special">(</span><span class="hs-identifier hs-type">I.FromNat</span><span> </span><a href="#local-6989586621679063659"><span class="hs-identifier hs-type">cols3</span></a><span> </span><span class="hs-glyph">~</span><span> </span><span class="hs-identifier hs-type">Either</span><span> </span><span class="hs-special">(</span><a href="Matrix.Internal.html#FromNat"><span class="hs-identifier hs-type">I.FromNat</span></a><span> </span><a href="#local-6989586621679063660"><span class="hs-identifier hs-type">cols1</span></a><span class="hs-special">)</span><span> </span><span class="hs-special">(</span><a href="Matrix.Internal.html#FromNat"><span class="hs-identifier hs-type">I.FromNat</span></a><span> </span><a href="#local-6989586621679063661"><span class="hs-identifier hs-type">cols2</span></a><span class="hs-special">)</span><span class="hs-special">)</span><span> </span><span class="hs-glyph">=&gt;</span><span>
177+</span><a name="line-177"></a><span> </span><a href="Matrix.Nat.html#Matrix"><span class="hs-identifier hs-type">Matrix</span></a><span> </span><a href="#local-6989586621679063662"><span class="hs-identifier hs-type">e</span></a><span> </span><a href="#local-6989586621679063660"><span class="hs-identifier hs-type">cols1</span></a><span> </span><a href="#local-6989586621679063663"><span class="hs-identifier hs-type">rows</span></a><span> </span><span class="hs-glyph">-&gt;</span><span>
178+</span><a name="line-178"></a><span> </span><a href="Matrix.Nat.html#Matrix"><span class="hs-identifier hs-type">Matrix</span></a><span> </span><a href="#local-6989586621679063662"><span class="hs-identifier hs-type">e</span></a><span> </span><a href="#local-6989586621679063661"><span class="hs-identifier hs-type">cols2</span></a><span> </span><a href="#local-6989586621679063663"><span class="hs-identifier hs-type">rows</span></a><span> </span><span class="hs-glyph">-&gt;</span><span>
179+</span><a name="line-179"></a><span> </span><a href="Matrix.Nat.html#Matrix"><span class="hs-identifier hs-type">Matrix</span></a><span> </span><a href="#local-6989586621679063662"><span class="hs-identifier hs-type">e</span></a><span> </span><a href="#local-6989586621679063659"><span class="hs-identifier hs-type">cols3</span></a><span> </span><a href="#local-6989586621679063663"><span class="hs-identifier hs-type">rows</span></a><span>
180+</span><a name="line-180"></a><span class="hs-special">(</span><a name="%7C%7C%7C"><a href="Matrix.Nat.html#%7C%7C%7C"><span class="hs-operator">|||</span></a></a><span class="hs-special">)</span><span> </span><span class="hs-glyph">=</span><span> </span><a href="Matrix.Nat.html#junc"><span class="hs-identifier hs-var">junc</span></a><span>
181+</span><a name="line-181"></a><span>
182+</span><a name="line-182"></a><span class="hs-identifier">split</span><span> </span><span class="hs-glyph">::</span><span>
183+</span><a name="line-183"></a><span> </span><span class="hs-special">(</span><span class="hs-identifier hs-type">I.FromNat</span><span> </span><a href="#local-6989586621679063654"><span class="hs-identifier hs-type">rows3</span></a><span> </span><span class="hs-glyph">~</span><span> </span><span class="hs-identifier hs-type">Either</span><span> </span><span class="hs-special">(</span><a href="Matrix.Internal.html#FromNat"><span class="hs-identifier hs-type">I.FromNat</span></a><span> </span><a href="#local-6989586621679063655"><span class="hs-identifier hs-type">rows1</span></a><span class="hs-special">)</span><span> </span><span class="hs-special">(</span><a href="Matrix.Internal.html#FromNat"><span class="hs-identifier hs-type">I.FromNat</span></a><span> </span><a href="#local-6989586621679063656"><span class="hs-identifier hs-type">rows2</span></a><span class="hs-special">)</span><span class="hs-special">)</span><span> </span><span class="hs-glyph">=&gt;</span><span>
184+</span><a name="line-184"></a><span> </span><a href="Matrix.Nat.html#Matrix"><span class="hs-identifier hs-type">Matrix</span></a><span> </span><a href="#local-6989586621679063657"><span class="hs-identifier hs-type">e</span></a><span> </span><a href="#local-6989586621679063658"><span class="hs-identifier hs-type">cols</span></a><span> </span><a href="#local-6989586621679063655"><span class="hs-identifier hs-type">rows1</span></a><span> </span><span class="hs-glyph">-&gt;</span><span>
185+</span><a name="line-185"></a><span> </span><a href="Matrix.Nat.html#Matrix"><span class="hs-identifier hs-type">Matrix</span></a><span> </span><a href="#local-6989586621679063657"><span class="hs-identifier hs-type">e</span></a><span> </span><a href="#local-6989586621679063658"><span class="hs-identifier hs-type">cols</span></a><span> </span><a href="#local-6989586621679063656"><span class="hs-identifier hs-type">rows2</span></a><span> </span><span class="hs-glyph">-&gt;</span><span>
186+</span><a name="line-186"></a><span> </span><a href="Matrix.Nat.html#Matrix"><span class="hs-identifier hs-type">Matrix</span></a><span> </span><a href="#local-6989586621679063657"><span class="hs-identifier hs-type">e</span></a><span> </span><a href="#local-6989586621679063658"><span class="hs-identifier hs-type">cols</span></a><span> </span><a href="#local-6989586621679063654"><span class="hs-identifier hs-type">rows3</span></a><span>
187+</span><a name="line-187"></a><a name="split"><a href="Matrix.Nat.html#split"><span class="hs-identifier">split</span></a></a><span> </span><span class="hs-special">(</span><a href="Matrix.Nat.html#M"><span class="hs-identifier hs-var">M</span></a><span> </span><a name="local-6989586621679063673"><a href="#local-6989586621679063673"><span class="hs-identifier">a</span></a></a><span class="hs-special">)</span><span> </span><span class="hs-special">(</span><a href="Matrix.Nat.html#M"><span class="hs-identifier hs-var">M</span></a><span> </span><a name="local-6989586621679063674"><a href="#local-6989586621679063674"><span class="hs-identifier">b</span></a></a><span class="hs-special">)</span><span> </span><span class="hs-glyph">=</span><span> </span><a href="Matrix.Nat.html#M"><span class="hs-identifier hs-var">M</span></a><span> </span><span class="hs-special">(</span><a href="Matrix.Internal.html#Split"><span class="hs-identifier hs-var">I.Split</span></a><span> </span><a href="#local-6989586621679063673"><span class="hs-identifier hs-var">a</span></a><span> </span><a href="#local-6989586621679063674"><span class="hs-identifier hs-var">b</span></a><span class="hs-special">)</span><span>
188+</span><a name="line-188"></a><span>
189+</span><a name="line-189"></a><span class="hs-keyword">infixl</span><span> </span><span class="hs-number">2</span><span> </span><a href="Matrix.Nat.html#%3D%3D%3D"><span class="hs-operator hs-var">===</span></a><span>
190+</span><a name="line-190"></a><span class="hs-special">(</span><span class="hs-operator">===</span><span class="hs-special">)</span><span> </span><span class="hs-glyph">::</span><span>
191+</span><a name="line-191"></a><span> </span><span class="hs-special">(</span><span class="hs-identifier hs-type">I.FromNat</span><span> </span><a href="#local-6989586621679063649"><span class="hs-identifier hs-type">rows3</span></a><span> </span><span class="hs-glyph">~</span><span> </span><span class="hs-identifier hs-type">Either</span><span> </span><span class="hs-special">(</span><a href="Matrix.Internal.html#FromNat"><span class="hs-identifier hs-type">I.FromNat</span></a><span> </span><a href="#local-6989586621679063650"><span class="hs-identifier hs-type">rows1</span></a><span class="hs-special">)</span><span> </span><span class="hs-special">(</span><a href="Matrix.Internal.html#FromNat"><span class="hs-identifier hs-type">I.FromNat</span></a><span> </span><a href="#local-6989586621679063651"><span class="hs-identifier hs-type">rows2</span></a><span class="hs-special">)</span><span class="hs-special">)</span><span> </span><span class="hs-glyph">=&gt;</span><span>
192+</span><a name="line-192"></a><span> </span><a href="Matrix.Nat.html#Matrix"><span class="hs-identifier hs-type">Matrix</span></a><span> </span><a href="#local-6989586621679063652"><span class="hs-identifier hs-type">e</span></a><span> </span><a href="#local-6989586621679063653"><span class="hs-identifier hs-type">cols</span></a><span> </span><a href="#local-6989586621679063650"><span class="hs-identifier hs-type">rows1</span></a><span> </span><span class="hs-glyph">-&gt;</span><span>
193+</span><a name="line-193"></a><span> </span><a href="Matrix.Nat.html#Matrix"><span class="hs-identifier hs-type">Matrix</span></a><span> </span><a href="#local-6989586621679063652"><span class="hs-identifier hs-type">e</span></a><span> </span><a href="#local-6989586621679063653"><span class="hs-identifier hs-type">cols</span></a><span> </span><a href="#local-6989586621679063651"><span class="hs-identifier hs-type">rows2</span></a><span> </span><span class="hs-glyph">-&gt;</span><span>
194+</span><a name="line-194"></a><span> </span><a href="Matrix.Nat.html#Matrix"><span class="hs-identifier hs-type">Matrix</span></a><span> </span><a href="#local-6989586621679063652"><span class="hs-identifier hs-type">e</span></a><span> </span><a href="#local-6989586621679063653"><span class="hs-identifier hs-type">cols</span></a><span> </span><a href="#local-6989586621679063649"><span class="hs-identifier hs-type">rows3</span></a><span>
195+</span><a name="line-195"></a><span class="hs-special">(</span><a name="%3D%3D%3D"><a href="Matrix.Nat.html#%3D%3D%3D"><span class="hs-operator">===</span></a></a><span class="hs-special">)</span><span> </span><span class="hs-glyph">=</span><span> </span><a href="Matrix.Nat.html#split"><span class="hs-identifier hs-var">split</span></a><span>
196+</span><a name="line-196"></a><span>
197+</span><a name="line-197"></a><span class="hs-comment">-- Construction</span><span>
198+</span><a name="line-198"></a><span>
199+</span><a name="line-199"></a><span class="hs-identifier">fromLists</span><span> </span><span class="hs-glyph">::</span><span> </span><span class="hs-special">(</span><a href="Matrix.Internal.html#FromLists"><span class="hs-identifier hs-type">I.FromLists</span></a><span> </span><a href="#local-6989586621679063646"><span class="hs-identifier hs-type">e</span></a><span> </span><span class="hs-special">(</span><a href="Matrix.Internal.html#FromNat"><span class="hs-identifier hs-type">I.FromNat</span></a><span> </span><a href="#local-6989586621679063647"><span class="hs-identifier hs-type">cols</span></a><span class="hs-special">)</span><span> </span><span class="hs-special">(</span><a href="Matrix.Internal.html#FromNat"><span class="hs-identifier hs-type">I.FromNat</span></a><span> </span><a href="#local-6989586621679063648"><span class="hs-identifier hs-type">rows</span></a><span class="hs-special">)</span><span class="hs-special">)</span><span> </span><span class="hs-glyph">=&gt;</span><span> </span><span class="hs-special">[</span><span class="hs-special">[</span><a href="#local-6989586621679063646"><span class="hs-identifier hs-type">e</span></a><span class="hs-special">]</span><span class="hs-special">]</span><span> </span><span class="hs-glyph">-&gt;</span><span> </span><a href="Matrix.Nat.html#Matrix"><span class="hs-identifier hs-type">Matrix</span></a><span> </span><a href="#local-6989586621679063646"><span class="hs-identifier hs-type">e</span></a><span> </span><a href="#local-6989586621679063647"><span class="hs-identifier hs-type">cols</span></a><span> </span><a href="#local-6989586621679063648"><span class="hs-identifier hs-type">rows</span></a><span>
200+</span><a name="line-200"></a><a name="fromLists"><a href="Matrix.Nat.html#fromLists"><span class="hs-identifier">fromLists</span></a></a><span> </span><span class="hs-glyph">=</span><span> </span><a href="Matrix.Nat.html#M"><span class="hs-identifier hs-var">M</span></a><span> </span><span class="hs-operator hs-var">.</span><span> </span><a href="Matrix.Internal.html#fromLists"><span class="hs-identifier hs-var">I.fromLists</span></a><span>
201+</span><a name="line-201"></a><span>
202+</span><a name="line-202"></a><span class="hs-identifier">matrixBuilder</span><span> </span><span class="hs-glyph">::</span><span>
203+</span><a name="line-203"></a><span> </span><span class="hs-special">(</span><a href="Matrix.Internal.html#FromLists"><span class="hs-identifier hs-type">I.FromLists</span></a><span> </span><a href="#local-6989586621679063643"><span class="hs-identifier hs-type">e</span></a><span> </span><span class="hs-special">(</span><a href="Matrix.Internal.html#FromNat"><span class="hs-identifier hs-type">I.FromNat</span></a><span> </span><a href="#local-6989586621679063644"><span class="hs-identifier hs-type">cols</span></a><span class="hs-special">)</span><span> </span><span class="hs-special">(</span><a href="Matrix.Internal.html#FromNat"><span class="hs-identifier hs-type">I.FromNat</span></a><span> </span><a href="#local-6989586621679063645"><span class="hs-identifier hs-type">rows</span></a><span class="hs-special">)</span><span class="hs-special">,</span><span> </span><span class="hs-identifier hs-type">KnownNat</span><span> </span><span class="hs-special">(</span><a href="Matrix.Internal.html#Count"><span class="hs-identifier hs-type">I.Count</span></a><span> </span><span class="hs-special">(</span><a href="Matrix.Internal.html#FromNat"><span class="hs-identifier hs-type">I.FromNat</span></a><span> </span><a href="#local-6989586621679063644"><span class="hs-identifier hs-type">cols</span></a><span class="hs-special">)</span><span class="hs-special">)</span><span class="hs-special">,</span><span> </span><span class="hs-identifier hs-type">KnownNat</span><span> </span><span class="hs-special">(</span><a href="Matrix.Internal.html#Count"><span class="hs-identifier hs-type">I.Count</span></a><span> </span><span class="hs-special">(</span><a href="Matrix.Internal.html#FromNat"><span class="hs-identifier hs-type">I.FromNat</span></a><span> </span><a href="#local-6989586621679063645"><span class="hs-identifier hs-type">rows</span></a><span class="hs-special">)</span><span class="hs-special">)</span><span class="hs-special">)</span><span> </span><span class="hs-glyph">=&gt;</span><span>
204+</span><a name="line-204"></a><span> </span><span class="hs-special">(</span><span class="hs-special">(</span><span class="hs-identifier hs-type">Int</span><span class="hs-special">,</span><span> </span><span class="hs-identifier hs-type">Int</span><span class="hs-special">)</span><span> </span><span class="hs-glyph">-&gt;</span><span> </span><a href="#local-6989586621679063643"><span class="hs-identifier hs-type">e</span></a><span class="hs-special">)</span><span> </span><span class="hs-glyph">-&gt;</span><span>
205+</span><a name="line-205"></a><span> </span><a href="Matrix.Nat.html#Matrix"><span class="hs-identifier hs-type">Matrix</span></a><span> </span><a href="#local-6989586621679063643"><span class="hs-identifier hs-type">e</span></a><span> </span><a href="#local-6989586621679063644"><span class="hs-identifier hs-type">cols</span></a><span> </span><a href="#local-6989586621679063645"><span class="hs-identifier hs-type">rows</span></a><span>
206+</span><a name="line-206"></a><a name="matrixBuilder"><a href="Matrix.Nat.html#matrixBuilder"><span class="hs-identifier">matrixBuilder</span></a></a><span> </span><span class="hs-glyph">=</span><span> </span><a href="Matrix.Nat.html#M"><span class="hs-identifier hs-var">M</span></a><span> </span><span class="hs-operator hs-var">.</span><span> </span><a href="Matrix.Internal.html#matrixBuilder"><span class="hs-identifier hs-var">I.matrixBuilder</span></a><span>
207+</span><a name="line-207"></a><span>
208+</span><a name="line-208"></a><span class="hs-identifier">col</span><span> </span><span class="hs-glyph">::</span><span> </span><span class="hs-special">(</span><a href="Matrix.Internal.html#FromLists"><span class="hs-identifier hs-type">I.FromLists</span></a><span> </span><a href="#local-6989586621679063641"><span class="hs-identifier hs-type">e</span></a><span> </span><span class="hs-special">(</span><span class="hs-special">)</span><span> </span><span class="hs-special">(</span><a href="Matrix.Internal.html#FromNat"><span class="hs-identifier hs-type">I.FromNat</span></a><span> </span><a href="#local-6989586621679063642"><span class="hs-identifier hs-type">rows</span></a><span class="hs-special">)</span><span class="hs-special">)</span><span> </span><span class="hs-glyph">=&gt;</span><span> </span><span class="hs-special">[</span><a href="#local-6989586621679063641"><span class="hs-identifier hs-type">e</span></a><span class="hs-special">]</span><span> </span><span class="hs-glyph">-&gt;</span><span> </span><a href="Matrix.Nat.html#Matrix"><span class="hs-identifier hs-type">Matrix</span></a><span> </span><a href="#local-6989586621679063641"><span class="hs-identifier hs-type">e</span></a><span> </span><span class="hs-number">1</span><span> </span><a href="#local-6989586621679063642"><span class="hs-identifier hs-type">rows</span></a><span>
209+</span><a name="line-209"></a><a name="col"><a href="Matrix.Nat.html#col"><span class="hs-identifier">col</span></a></a><span> </span><span class="hs-glyph">=</span><span> </span><a href="Matrix.Nat.html#M"><span class="hs-identifier hs-var">M</span></a><span> </span><span class="hs-operator hs-var">.</span><span> </span><a href="Matrix.Internal.html#col"><span class="hs-identifier hs-var">I.col</span></a><span>
210+</span><a name="line-210"></a><span>
211+</span><a name="line-211"></a><span class="hs-identifier">row</span><span> </span><span class="hs-glyph">::</span><span> </span><span class="hs-special">(</span><a href="Matrix.Internal.html#FromLists"><span class="hs-identifier hs-type">I.FromLists</span></a><span> </span><a href="#local-6989586621679063639"><span class="hs-identifier hs-type">e</span></a><span> </span><span class="hs-special">(</span><a href="Matrix.Internal.html#FromNat"><span class="hs-identifier hs-type">I.FromNat</span></a><span> </span><a href="#local-6989586621679063640"><span class="hs-identifier hs-type">cols</span></a><span class="hs-special">)</span><span> </span><span class="hs-special">(</span><span class="hs-special">)</span><span class="hs-special">)</span><span> </span><span class="hs-glyph">=&gt;</span><span> </span><span class="hs-special">[</span><a href="#local-6989586621679063639"><span class="hs-identifier hs-type">e</span></a><span class="hs-special">]</span><span> </span><span class="hs-glyph">-&gt;</span><span> </span><a href="Matrix.Nat.html#Matrix"><span class="hs-identifier hs-type">Matrix</span></a><span> </span><a href="#local-6989586621679063639"><span class="hs-identifier hs-type">e</span></a><span> </span><a href="#local-6989586621679063640"><span class="hs-identifier hs-type">cols</span></a><span> </span><span class="hs-number">1</span><span>
212+</span><a name="line-212"></a><a name="row"><a href="Matrix.Nat.html#row"><span class="hs-identifier">row</span></a></a><span> </span><span class="hs-glyph">=</span><span> </span><a href="Matrix.Nat.html#M"><span class="hs-identifier hs-var">M</span></a><span> </span><span class="hs-operator hs-var">.</span><span> </span><a href="Matrix.Internal.html#row"><span class="hs-identifier hs-var">I.row</span></a><span>
213+</span><a name="line-213"></a><span>
214+</span><a name="line-214"></a><span class="hs-identifier">fromF</span><span> </span><span class="hs-glyph">::</span><span>
215+</span><a name="line-215"></a><span> </span><span class="hs-special">(</span><span> </span><span class="hs-identifier hs-type">Bounded</span><span> </span><a href="#local-6989586621679063634"><span class="hs-identifier hs-type">a</span></a><span class="hs-special">,</span><span>
216+</span><a name="line-216"></a><span> </span><span class="hs-identifier hs-type">Bounded</span><span> </span><a href="#local-6989586621679063635"><span class="hs-identifier hs-type">b</span></a><span class="hs-special">,</span><span>
217+</span><a name="line-217"></a><span> </span><span class="hs-identifier hs-type">Enum</span><span> </span><a href="#local-6989586621679063634"><span class="hs-identifier hs-type">a</span></a><span class="hs-special">,</span><span>
218+</span><a name="line-218"></a><span> </span><span class="hs-identifier hs-type">Enum</span><span> </span><a href="#local-6989586621679063635"><span class="hs-identifier hs-type">b</span></a><span class="hs-special">,</span><span>
219+</span><a name="line-219"></a><span> </span><span class="hs-identifier hs-type">Eq</span><span> </span><a href="#local-6989586621679063635"><span class="hs-identifier hs-type">b</span></a><span class="hs-special">,</span><span>
220+</span><a name="line-220"></a><span> </span><span class="hs-identifier hs-type">Num</span><span> </span><a href="#local-6989586621679063636"><span class="hs-identifier hs-type">e</span></a><span class="hs-special">,</span><span>
221+</span><a name="line-221"></a><span> </span><span class="hs-identifier hs-type">Ord</span><span> </span><a href="#local-6989586621679063636"><span class="hs-identifier hs-type">e</span></a><span class="hs-special">,</span><span>
222+</span><a name="line-222"></a><span> </span><span class="hs-identifier hs-type">KnownNat</span><span> </span><span class="hs-special">(</span><a href="Matrix.Internal.html#Count"><span class="hs-identifier hs-type">I.Count</span></a><span> </span><span class="hs-special">(</span><a href="Matrix.Internal.html#FromNat"><span class="hs-identifier hs-type">I.FromNat</span></a><span> </span><a href="#local-6989586621679063637"><span class="hs-identifier hs-type">cols</span></a><span class="hs-special">)</span><span class="hs-special">)</span><span class="hs-special">,</span><span>
223+</span><a name="line-223"></a><span> </span><span class="hs-identifier hs-type">KnownNat</span><span> </span><span class="hs-special">(</span><a href="Matrix.Internal.html#Count"><span class="hs-identifier hs-type">I.Count</span></a><span> </span><span class="hs-special">(</span><a href="Matrix.Internal.html#FromNat"><span class="hs-identifier hs-type">I.FromNat</span></a><span> </span><a href="#local-6989586621679063638"><span class="hs-identifier hs-type">rows</span></a><span class="hs-special">)</span><span class="hs-special">)</span><span class="hs-special">,</span><span>
224+</span><a name="line-224"></a><span> </span><a href="Matrix.Internal.html#FromLists"><span class="hs-identifier hs-type">I.FromLists</span></a><span> </span><a href="#local-6989586621679063636"><span class="hs-identifier hs-type">e</span></a><span> </span><span class="hs-special">(</span><a href="Matrix.Internal.html#FromNat"><span class="hs-identifier hs-type">I.FromNat</span></a><span> </span><a href="#local-6989586621679063638"><span class="hs-identifier hs-type">rows</span></a><span class="hs-special">)</span><span> </span><span class="hs-special">(</span><a href="Matrix.Internal.html#FromNat"><span class="hs-identifier hs-type">I.FromNat</span></a><span> </span><a href="#local-6989586621679063637"><span class="hs-identifier hs-type">cols</span></a><span class="hs-special">)</span><span>
225+</span><a name="line-225"></a><span> </span><span class="hs-special">)</span><span> </span><span class="hs-glyph">=&gt;</span><span>
226+</span><a name="line-226"></a><span> </span><span class="hs-special">(</span><a href="#local-6989586621679063634"><span class="hs-identifier hs-type">a</span></a><span> </span><span class="hs-glyph">-&gt;</span><span> </span><a href="#local-6989586621679063635"><span class="hs-identifier hs-type">b</span></a><span class="hs-special">)</span><span> </span><span class="hs-glyph">-&gt;</span><span>
227+</span><a name="line-227"></a><span> </span><a href="Matrix.Nat.html#Matrix"><span class="hs-identifier hs-type">Matrix</span></a><span> </span><a href="#local-6989586621679063636"><span class="hs-identifier hs-type">e</span></a><span> </span><a href="#local-6989586621679063637"><span class="hs-identifier hs-type">cols</span></a><span> </span><a href="#local-6989586621679063638"><span class="hs-identifier hs-type">rows</span></a><span>
228+</span><a name="line-228"></a><a name="fromF"><a href="Matrix.Nat.html#fromF"><span class="hs-identifier">fromF</span></a></a><span> </span><span class="hs-glyph">=</span><span> </span><a href="Matrix.Nat.html#M"><span class="hs-identifier hs-var">M</span></a><span> </span><span class="hs-operator hs-var">.</span><span> </span><a href="Matrix.Internal.html#fromF"><span class="hs-identifier hs-var">I.fromF</span></a><span>
229+</span><a name="line-229"></a><span>
230+</span><a name="line-230"></a><span class="hs-identifier">fromF'</span><span> </span><span class="hs-glyph">::</span><span>
231+</span><a name="line-231"></a><span> </span><span class="hs-special">(</span><span> </span><span class="hs-identifier hs-type">Bounded</span><span> </span><a href="#local-6989586621679063631"><span class="hs-identifier hs-type">a</span></a><span class="hs-special">,</span><span>
232+</span><a name="line-232"></a><span> </span><span class="hs-identifier hs-type">Bounded</span><span> </span><a href="#local-6989586621679063632"><span class="hs-identifier hs-type">b</span></a><span class="hs-special">,</span><span>
233+</span><a name="line-233"></a><span> </span><span class="hs-identifier hs-type">Enum</span><span> </span><a href="#local-6989586621679063631"><span class="hs-identifier hs-type">a</span></a><span class="hs-special">,</span><span>
234+</span><a name="line-234"></a><span> </span><span class="hs-identifier hs-type">Enum</span><span> </span><a href="#local-6989586621679063632"><span class="hs-identifier hs-type">b</span></a><span class="hs-special">,</span><span>
235+</span><a name="line-235"></a><span> </span><span class="hs-identifier hs-type">Eq</span><span> </span><a href="#local-6989586621679063632"><span class="hs-identifier hs-type">b</span></a><span class="hs-special">,</span><span>
236+</span><a name="line-236"></a><span> </span><span class="hs-identifier hs-type">Num</span><span> </span><a href="#local-6989586621679063633"><span class="hs-identifier hs-type">e</span></a><span class="hs-special">,</span><span>
237+</span><a name="line-237"></a><span> </span><span class="hs-identifier hs-type">Ord</span><span> </span><a href="#local-6989586621679063633"><span class="hs-identifier hs-type">e</span></a><span class="hs-special">,</span><span>
238+</span><a name="line-238"></a><span> </span><span class="hs-identifier hs-type">KnownNat</span><span> </span><span class="hs-special">(</span><a href="Matrix.Internal.html#Count"><span class="hs-identifier hs-type">I.Count</span></a><span> </span><span class="hs-special">(</span><a href="Matrix.Internal.html#Normalize"><span class="hs-identifier hs-type">I.Normalize</span></a><span> </span><a href="#local-6989586621679063631"><span class="hs-identifier hs-type">a</span></a><span class="hs-special">)</span><span class="hs-special">)</span><span class="hs-special">,</span><span>
239+</span><a name="line-239"></a><span> </span><span class="hs-identifier hs-type">KnownNat</span><span> </span><span class="hs-special">(</span><a href="Matrix.Internal.html#Count"><span class="hs-identifier hs-type">I.Count</span></a><span> </span><span class="hs-special">(</span><a href="Matrix.Internal.html#Normalize"><span class="hs-identifier hs-type">I.Normalize</span></a><span> </span><a href="#local-6989586621679063632"><span class="hs-identifier hs-type">b</span></a><span class="hs-special">)</span><span class="hs-special">)</span><span class="hs-special">,</span><span>
240+</span><a name="line-240"></a><span> </span><a href="Matrix.Internal.html#FromLists"><span class="hs-identifier hs-type">I.FromLists</span></a><span> </span><a href="#local-6989586621679063633"><span class="hs-identifier hs-type">e</span></a><span> </span><span class="hs-special">(</span><a href="Matrix.Internal.html#Normalize"><span class="hs-identifier hs-type">I.Normalize</span></a><span> </span><a href="#local-6989586621679063632"><span class="hs-identifier hs-type">b</span></a><span class="hs-special">)</span><span> </span><span class="hs-special">(</span><a href="Matrix.Internal.html#Normalize"><span class="hs-identifier hs-type">I.Normalize</span></a><span> </span><a href="#local-6989586621679063631"><span class="hs-identifier hs-type">a</span></a><span class="hs-special">)</span><span>
241+</span><a name="line-241"></a><span> </span><span class="hs-special">)</span><span> </span><span class="hs-glyph">=&gt;</span><span>
242+</span><a name="line-242"></a><span> </span><span class="hs-special">(</span><a href="#local-6989586621679063631"><span class="hs-identifier hs-type">a</span></a><span> </span><span class="hs-glyph">-&gt;</span><span> </span><a href="#local-6989586621679063632"><span class="hs-identifier hs-type">b</span></a><span class="hs-special">)</span><span> </span><span class="hs-glyph">-&gt;</span><span>
243+</span><a name="line-243"></a><span> </span><a href="Matrix.Nat.html#Matrix"><span class="hs-identifier hs-type">Matrix</span></a><span> </span><a href="#local-6989586621679063633"><span class="hs-identifier hs-type">e</span></a><span> </span><span class="hs-special">(</span><a href="Matrix.Internal.html#Count"><span class="hs-identifier hs-type">I.Count</span></a><span> </span><a href="#local-6989586621679063631"><span class="hs-identifier hs-type">a</span></a><span class="hs-special">)</span><span> </span><span class="hs-special">(</span><a href="Matrix.Internal.html#Count"><span class="hs-identifier hs-type">I.Count</span></a><span> </span><a href="#local-6989586621679063632"><span class="hs-identifier hs-type">b</span></a><span class="hs-special">)</span><span>
244+</span><a name="line-244"></a><a name="fromF%27"><a href="Matrix.Nat.html#fromF%27"><span class="hs-identifier">fromF'</span></a></a><span> </span><span class="hs-glyph">=</span><span> </span><a href="Matrix.Nat.html#M"><span class="hs-identifier hs-var">M</span></a><span> </span><span class="hs-operator hs-var">.</span><span> </span><a href="Matrix.Internal.html#fromF%27"><span class="hs-identifier hs-var">I.fromF'</span></a><span>
245+</span><a name="line-245"></a><span>
246+</span><a name="line-246"></a><span class="hs-comment">-- Conversion</span><span>
247+</span><a name="line-247"></a><span>
248+</span><a name="line-248"></a><span class="hs-identifier">toLists</span><span> </span><span class="hs-glyph">::</span><span> </span><a href="Matrix.Nat.html#Matrix"><span class="hs-identifier hs-type">Matrix</span></a><span> </span><a href="#local-6989586621679063628"><span class="hs-identifier hs-type">e</span></a><span> </span><a href="#local-6989586621679063629"><span class="hs-identifier hs-type">cols</span></a><span> </span><a href="#local-6989586621679063630"><span class="hs-identifier hs-type">rows</span></a><span> </span><span class="hs-glyph">-&gt;</span><span> </span><span class="hs-special">[</span><span class="hs-special">[</span><a href="#local-6989586621679063628"><span class="hs-identifier hs-type">e</span></a><span class="hs-special">]</span><span class="hs-special">]</span><span>
249+</span><a name="line-249"></a><a name="toLists"><a href="Matrix.Nat.html#toLists"><span class="hs-identifier">toLists</span></a></a><span> </span><span class="hs-special">(</span><a href="Matrix.Nat.html#M"><span class="hs-identifier hs-var">M</span></a><span> </span><a name="local-6989586621679063675"><a href="#local-6989586621679063675"><span class="hs-identifier">m</span></a></a><span class="hs-special">)</span><span> </span><span class="hs-glyph">=</span><span> </span><a href="Matrix.Internal.html#toLists"><span class="hs-identifier hs-var">I.toLists</span></a><span> </span><a href="#local-6989586621679063675"><span class="hs-identifier hs-var">m</span></a><span>
250+</span><a name="line-250"></a><span>
251+</span><a name="line-251"></a><span class="hs-identifier">toList</span><span> </span><span class="hs-glyph">::</span><span> </span><a href="Matrix.Nat.html#Matrix"><span class="hs-identifier hs-type">Matrix</span></a><span> </span><a href="#local-6989586621679063625"><span class="hs-identifier hs-type">e</span></a><span> </span><a href="#local-6989586621679063626"><span class="hs-identifier hs-type">cols</span></a><span> </span><a href="#local-6989586621679063627"><span class="hs-identifier hs-type">rows</span></a><span> </span><span class="hs-glyph">-&gt;</span><span> </span><span class="hs-special">[</span><a href="#local-6989586621679063625"><span class="hs-identifier hs-type">e</span></a><span class="hs-special">]</span><span>
252+</span><a name="line-252"></a><a name="toList"><a href="Matrix.Nat.html#toList"><span class="hs-identifier">toList</span></a></a><span> </span><span class="hs-special">(</span><a href="Matrix.Nat.html#M"><span class="hs-identifier hs-var">M</span></a><span> </span><a name="local-6989586621679063676"><a href="#local-6989586621679063676"><span class="hs-identifier">m</span></a></a><span class="hs-special">)</span><span> </span><span class="hs-glyph">=</span><span> </span><a href="Matrix.Internal.html#toList"><span class="hs-identifier hs-var">I.toList</span></a><span> </span><a href="#local-6989586621679063676"><span class="hs-identifier hs-var">m</span></a><span>
253+</span><a name="line-253"></a><span>
254+</span><a name="line-254"></a><span class="hs-comment">-- Zeros Matrix</span><span>
255+</span><a name="line-255"></a><span>
256+</span><a name="line-256"></a><span class="hs-identifier">zeros</span><span> </span><span class="hs-glyph">::</span><span>
257+</span><a name="line-257"></a><span> </span><span class="hs-special">(</span><span class="hs-identifier hs-type">Num</span><span> </span><a href="#local-6989586621679063622"><span class="hs-identifier hs-type">e</span></a><span class="hs-special">,</span><span> </span><a href="Matrix.Internal.html#FromLists"><span class="hs-identifier hs-type">I.FromLists</span></a><span> </span><a href="#local-6989586621679063622"><span class="hs-identifier hs-type">e</span></a><span> </span><span class="hs-special">(</span><a href="Matrix.Internal.html#FromNat"><span class="hs-identifier hs-type">I.FromNat</span></a><span> </span><a href="#local-6989586621679063623"><span class="hs-identifier hs-type">cols</span></a><span class="hs-special">)</span><span> </span><span class="hs-special">(</span><a href="Matrix.Internal.html#FromNat"><span class="hs-identifier hs-type">I.FromNat</span></a><span> </span><a href="#local-6989586621679063624"><span class="hs-identifier hs-type">rows</span></a><span class="hs-special">)</span><span class="hs-special">,</span><span> </span><span class="hs-identifier hs-type">KnownNat</span><span> </span><span class="hs-special">(</span><a href="Matrix.Internal.html#Count"><span class="hs-identifier hs-type">I.Count</span></a><span> </span><span class="hs-special">(</span><a href="Matrix.Internal.html#FromNat"><span class="hs-identifier hs-type">I.FromNat</span></a><span> </span><a href="#local-6989586621679063623"><span class="hs-identifier hs-type">cols</span></a><span class="hs-special">)</span><span class="hs-special">)</span><span class="hs-special">,</span><span> </span><span class="hs-identifier hs-type">KnownNat</span><span> </span><span class="hs-special">(</span><a href="Matrix.Internal.html#Count"><span class="hs-identifier hs-type">I.Count</span></a><span> </span><span class="hs-special">(</span><a href="Matrix.Internal.html#FromNat"><span class="hs-identifier hs-type">I.FromNat</span></a><span> </span><a href="#local-6989586621679063624"><span class="hs-identifier hs-type">rows</span></a><span class="hs-special">)</span><span class="hs-special">)</span><span class="hs-special">)</span><span> </span><span class="hs-glyph">=&gt;</span><span>
258+</span><a name="line-258"></a><span> </span><a href="Matrix.Nat.html#Matrix"><span class="hs-identifier hs-type">Matrix</span></a><span> </span><a href="#local-6989586621679063622"><span class="hs-identifier hs-type">e</span></a><span> </span><a href="#local-6989586621679063623"><span class="hs-identifier hs-type">cols</span></a><span> </span><a href="#local-6989586621679063624"><span class="hs-identifier hs-type">rows</span></a><span>
259+</span><a name="line-259"></a><a name="zeros"><a href="Matrix.Nat.html#zeros"><span class="hs-identifier">zeros</span></a></a><span> </span><span class="hs-glyph">=</span><span> </span><a href="Matrix.Nat.html#M"><span class="hs-identifier hs-var">M</span></a><span> </span><a href="Matrix.Internal.html#zeros"><span class="hs-identifier hs-var">I.zeros</span></a><span>
260+</span><a name="line-260"></a><span>
261+</span><a name="line-261"></a><span class="hs-comment">-- Ones Matrix</span><span>
262+</span><a name="line-262"></a><span>
263+</span><a name="line-263"></a><span class="hs-identifier">ones</span><span> </span><span class="hs-glyph">::</span><span>
264+</span><a name="line-264"></a><span> </span><span class="hs-special">(</span><span class="hs-identifier hs-type">Num</span><span> </span><a href="#local-6989586621679063619"><span class="hs-identifier hs-type">e</span></a><span class="hs-special">,</span><span> </span><a href="Matrix.Internal.html#FromLists"><span class="hs-identifier hs-type">I.FromLists</span></a><span> </span><a href="#local-6989586621679063619"><span class="hs-identifier hs-type">e</span></a><span> </span><span class="hs-special">(</span><a href="Matrix.Internal.html#FromNat"><span class="hs-identifier hs-type">I.FromNat</span></a><span> </span><a href="#local-6989586621679063620"><span class="hs-identifier hs-type">cols</span></a><span class="hs-special">)</span><span> </span><span class="hs-special">(</span><a href="Matrix.Internal.html#FromNat"><span class="hs-identifier hs-type">I.FromNat</span></a><span> </span><a href="#local-6989586621679063621"><span class="hs-identifier hs-type">rows</span></a><span class="hs-special">)</span><span class="hs-special">,</span><span> </span><span class="hs-identifier hs-type">KnownNat</span><span> </span><span class="hs-special">(</span><a href="Matrix.Internal.html#Count"><span class="hs-identifier hs-type">I.Count</span></a><span> </span><span class="hs-special">(</span><a href="Matrix.Internal.html#FromNat"><span class="hs-identifier hs-type">I.FromNat</span></a><span> </span><a href="#local-6989586621679063620"><span class="hs-identifier hs-type">cols</span></a><span class="hs-special">)</span><span class="hs-special">)</span><span class="hs-special">,</span><span> </span><span class="hs-identifier hs-type">KnownNat</span><span> </span><span class="hs-special">(</span><a href="Matrix.Internal.html#Count"><span class="hs-identifier hs-type">I.Count</span></a><span> </span><span class="hs-special">(</span><a href="Matrix.Internal.html#FromNat"><span class="hs-identifier hs-type">I.FromNat</span></a><span> </span><a href="#local-6989586621679063621"><span class="hs-identifier hs-type">rows</span></a><span class="hs-special">)</span><span class="hs-special">)</span><span class="hs-special">)</span><span> </span><span class="hs-glyph">=&gt;</span><span>
265+</span><a name="line-265"></a><span> </span><a href="Matrix.Nat.html#Matrix"><span class="hs-identifier hs-type">Matrix</span></a><span> </span><a href="#local-6989586621679063619"><span class="hs-identifier hs-type">e</span></a><span> </span><a href="#local-6989586621679063620"><span class="hs-identifier hs-type">cols</span></a><span> </span><a href="#local-6989586621679063621"><span class="hs-identifier hs-type">rows</span></a><span>
266+</span><a name="line-266"></a><a name="ones"><a href="Matrix.Nat.html#ones"><span class="hs-identifier">ones</span></a></a><span> </span><span class="hs-glyph">=</span><span> </span><a href="Matrix.Nat.html#M"><span class="hs-identifier hs-var">M</span></a><span> </span><a href="Matrix.Internal.html#ones"><span class="hs-identifier hs-var">I.ones</span></a><span>
267+</span><a name="line-267"></a><span>
268+</span><a name="line-268"></a><span class="hs-comment">-- Const Matrix</span><span>
269+</span><a name="line-269"></a><span>
270+</span><a name="line-270"></a><span class="hs-identifier">constant</span><span> </span><span class="hs-glyph">::</span><span>
271+</span><a name="line-271"></a><span> </span><span class="hs-special">(</span><span class="hs-identifier hs-type">Num</span><span> </span><a href="#local-6989586621679063616"><span class="hs-identifier hs-type">e</span></a><span class="hs-special">,</span><span> </span><a href="Matrix.Internal.html#FromLists"><span class="hs-identifier hs-type">I.FromLists</span></a><span> </span><a href="#local-6989586621679063616"><span class="hs-identifier hs-type">e</span></a><span> </span><span class="hs-special">(</span><a href="Matrix.Internal.html#FromNat"><span class="hs-identifier hs-type">I.FromNat</span></a><span> </span><a href="#local-6989586621679063617"><span class="hs-identifier hs-type">cols</span></a><span class="hs-special">)</span><span> </span><span class="hs-special">(</span><a href="Matrix.Internal.html#FromNat"><span class="hs-identifier hs-type">I.FromNat</span></a><span> </span><a href="#local-6989586621679063618"><span class="hs-identifier hs-type">rows</span></a><span class="hs-special">)</span><span class="hs-special">,</span><span> </span><span class="hs-identifier hs-type">KnownNat</span><span> </span><span class="hs-special">(</span><a href="Matrix.Internal.html#Count"><span class="hs-identifier hs-type">I.Count</span></a><span> </span><span class="hs-special">(</span><a href="Matrix.Internal.html#FromNat"><span class="hs-identifier hs-type">I.FromNat</span></a><span> </span><a href="#local-6989586621679063617"><span class="hs-identifier hs-type">cols</span></a><span class="hs-special">)</span><span class="hs-special">)</span><span class="hs-special">,</span><span> </span><span class="hs-identifier hs-type">KnownNat</span><span> </span><span class="hs-special">(</span><a href="Matrix.Internal.html#Count"><span class="hs-identifier hs-type">I.Count</span></a><span> </span><span class="hs-special">(</span><a href="Matrix.Internal.html#FromNat"><span class="hs-identifier hs-type">I.FromNat</span></a><span> </span><a href="#local-6989586621679063618"><span class="hs-identifier hs-type">rows</span></a><span class="hs-special">)</span><span class="hs-special">)</span><span class="hs-special">)</span><span> </span><span class="hs-glyph">=&gt;</span><span>
272+</span><a name="line-272"></a><span> </span><a href="#local-6989586621679063616"><span class="hs-identifier hs-type">e</span></a><span> </span><span class="hs-glyph">-&gt;</span><span>
273+</span><a name="line-273"></a><span> </span><a href="Matrix.Nat.html#Matrix"><span class="hs-identifier hs-type">Matrix</span></a><span> </span><a href="#local-6989586621679063616"><span class="hs-identifier hs-type">e</span></a><span> </span><a href="#local-6989586621679063617"><span class="hs-identifier hs-type">cols</span></a><span> </span><a href="#local-6989586621679063618"><span class="hs-identifier hs-type">rows</span></a><span>
274+</span><a name="line-274"></a><a name="constant"><a href="Matrix.Nat.html#constant"><span class="hs-identifier">constant</span></a></a><span> </span><span class="hs-glyph">=</span><span> </span><a href="Matrix.Nat.html#M"><span class="hs-identifier hs-var">M</span></a><span> </span><span class="hs-operator hs-var">.</span><span> </span><a href="Matrix.Internal.html#constant"><span class="hs-identifier hs-var">I.constant</span></a><span>
275+</span><a name="line-275"></a><span>
276+</span><a name="line-276"></a><span class="hs-comment">-- Bang Matrix</span><span>
277+</span><a name="line-277"></a><span>
278+</span><a name="line-278"></a><span class="hs-identifier">bang</span><span> </span><span class="hs-glyph">::</span><span>
279+</span><a name="line-279"></a><span> </span><span class="hs-keyword">forall</span><span> </span><a name="local-6989586621679063614"><a href="#local-6989586621679063614"><span class="hs-identifier">e</span></a></a><span> </span><a name="local-6989586621679063615"><a href="#local-6989586621679063615"><span class="hs-identifier">cols</span></a></a><span class="hs-operator">.</span><span>
280+</span><a name="line-280"></a><span> </span><span class="hs-special">(</span><span class="hs-identifier hs-type">Num</span><span> </span><a href="#local-6989586621679063614"><span class="hs-identifier hs-type">e</span></a><span class="hs-special">,</span><span> </span><span class="hs-identifier hs-type">Enum</span><span> </span><a href="#local-6989586621679063614"><span class="hs-identifier hs-type">e</span></a><span class="hs-special">,</span><span> </span><a href="Matrix.Internal.html#FromLists"><span class="hs-identifier hs-type">I.FromLists</span></a><span> </span><a href="#local-6989586621679063614"><span class="hs-identifier hs-type">e</span></a><span> </span><span class="hs-special">(</span><a href="Matrix.Internal.html#FromNat"><span class="hs-identifier hs-type">I.FromNat</span></a><span> </span><a href="#local-6989586621679063615"><span class="hs-identifier hs-type">cols</span></a><span class="hs-special">)</span><span> </span><span class="hs-special">(</span><span class="hs-special">)</span><span class="hs-special">,</span><span> </span><span class="hs-identifier hs-type">KnownNat</span><span> </span><span class="hs-special">(</span><a href="Matrix.Internal.html#Count"><span class="hs-identifier hs-type">I.Count</span></a><span> </span><span class="hs-special">(</span><a href="Matrix.Internal.html#FromNat"><span class="hs-identifier hs-type">I.FromNat</span></a><span> </span><a href="#local-6989586621679063615"><span class="hs-identifier hs-type">cols</span></a><span class="hs-special">)</span><span class="hs-special">)</span><span class="hs-special">)</span><span> </span><span class="hs-glyph">=&gt;</span><span>
281+</span><a name="line-281"></a><span> </span><a href="Matrix.Nat.html#Matrix"><span class="hs-identifier hs-type">Matrix</span></a><span> </span><a href="#local-6989586621679063614"><span class="hs-identifier hs-type">e</span></a><span> </span><a href="#local-6989586621679063615"><span class="hs-identifier hs-type">cols</span></a><span> </span><span class="hs-number">1</span><span>
282+</span><a name="line-282"></a><a name="bang"><a href="Matrix.Nat.html#bang"><span class="hs-identifier">bang</span></a></a><span> </span><span class="hs-glyph">=</span><span> </span><a href="Matrix.Nat.html#M"><span class="hs-identifier hs-var">M</span></a><span> </span><a href="Matrix.Internal.html#bang"><span class="hs-identifier hs-var">I.bang</span></a><span>
283+</span><a name="line-283"></a><span>
284+</span><a name="line-284"></a><span class="hs-comment">-- Identity Matrix</span><span>
285+</span><a name="line-285"></a><span>
286+</span><a name="line-286"></a><span class="hs-identifier">identity</span><span> </span><span class="hs-glyph">::</span><span>
287+</span><a name="line-287"></a><span> </span><span class="hs-special">(</span><span class="hs-identifier hs-type">Num</span><span> </span><a href="#local-6989586621679063612"><span class="hs-identifier hs-type">e</span></a><span class="hs-special">,</span><span> </span><a href="Matrix.Internal.html#FromLists"><span class="hs-identifier hs-type">I.FromLists</span></a><span> </span><a href="#local-6989586621679063612"><span class="hs-identifier hs-type">e</span></a><span> </span><span class="hs-special">(</span><a href="Matrix.Internal.html#FromNat"><span class="hs-identifier hs-type">I.FromNat</span></a><span> </span><a href="#local-6989586621679063613"><span class="hs-identifier hs-type">cols</span></a><span class="hs-special">)</span><span> </span><span class="hs-special">(</span><a href="Matrix.Internal.html#FromNat"><span class="hs-identifier hs-type">I.FromNat</span></a><span> </span><a href="#local-6989586621679063613"><span class="hs-identifier hs-type">cols</span></a><span class="hs-special">)</span><span class="hs-special">,</span><span> </span><span class="hs-identifier hs-type">KnownNat</span><span> </span><span class="hs-special">(</span><a href="Matrix.Internal.html#Count"><span class="hs-identifier hs-type">I.Count</span></a><span> </span><span class="hs-special">(</span><a href="Matrix.Internal.html#FromNat"><span class="hs-identifier hs-type">I.FromNat</span></a><span> </span><a href="#local-6989586621679063613"><span class="hs-identifier hs-type">cols</span></a><span class="hs-special">)</span><span class="hs-special">)</span><span class="hs-special">)</span><span> </span><span class="hs-glyph">=&gt;</span><span>
288+</span><a name="line-288"></a><span> </span><a href="Matrix.Nat.html#Matrix"><span class="hs-identifier hs-type">Matrix</span></a><span> </span><a href="#local-6989586621679063612"><span class="hs-identifier hs-type">e</span></a><span> </span><a href="#local-6989586621679063613"><span class="hs-identifier hs-type">cols</span></a><span> </span><a href="#local-6989586621679063613"><span class="hs-identifier hs-type">cols</span></a><span>
289+</span><a name="line-289"></a><a name="identity"><a href="Matrix.Nat.html#identity"><span class="hs-identifier">identity</span></a></a><span> </span><span class="hs-glyph">=</span><span> </span><a href="Matrix.Nat.html#M"><span class="hs-identifier hs-var">M</span></a><span> </span><a href="Matrix.Internal.html#identity"><span class="hs-identifier hs-var">I.identity</span></a><span>
290+</span><a name="line-290"></a><span>
291+</span><a name="line-291"></a><span class="hs-comment">-- Matrix composition (MMM)</span><span>
292+</span><a name="line-292"></a><span>
293+</span><a name="line-293"></a><span class="hs-identifier">comp</span><span> </span><span class="hs-glyph">::</span><span> </span><span class="hs-special">(</span><span class="hs-identifier hs-type">Num</span><span> </span><a href="#local-6989586621679063608"><span class="hs-identifier hs-type">e</span></a><span class="hs-special">)</span><span> </span><span class="hs-glyph">=&gt;</span><span> </span><a href="Matrix.Nat.html#Matrix"><span class="hs-identifier hs-type">Matrix</span></a><span> </span><a href="#local-6989586621679063608"><span class="hs-identifier hs-type">e</span></a><span> </span><a href="#local-6989586621679063609"><span class="hs-identifier hs-type">cr</span></a><span> </span><a href="#local-6989586621679063610"><span class="hs-identifier hs-type">rows</span></a><span> </span><span class="hs-glyph">-&gt;</span><span> </span><a href="Matrix.Nat.html#Matrix"><span class="hs-identifier hs-type">Matrix</span></a><span> </span><a href="#local-6989586621679063608"><span class="hs-identifier hs-type">e</span></a><span> </span><a href="#local-6989586621679063611"><span class="hs-identifier hs-type">cols</span></a><span> </span><a href="#local-6989586621679063609"><span class="hs-identifier hs-type">cr</span></a><span> </span><span class="hs-glyph">-&gt;</span><span> </span><a href="Matrix.Nat.html#Matrix"><span class="hs-identifier hs-type">Matrix</span></a><span> </span><a href="#local-6989586621679063608"><span class="hs-identifier hs-type">e</span></a><span> </span><a href="#local-6989586621679063611"><span class="hs-identifier hs-type">cols</span></a><span> </span><a href="#local-6989586621679063610"><span class="hs-identifier hs-type">rows</span></a><span>
294+</span><a name="line-294"></a><a name="comp"><a href="Matrix.Nat.html#comp"><span class="hs-identifier">comp</span></a></a><span> </span><span class="hs-special">(</span><a href="Matrix.Nat.html#M"><span class="hs-identifier hs-var">M</span></a><span> </span><a name="local-6989586621679063677"><a href="#local-6989586621679063677"><span class="hs-identifier">a</span></a></a><span class="hs-special">)</span><span> </span><span class="hs-special">(</span><a href="Matrix.Nat.html#M"><span class="hs-identifier hs-var">M</span></a><span> </span><a name="local-6989586621679063678"><a href="#local-6989586621679063678"><span class="hs-identifier">b</span></a></a><span class="hs-special">)</span><span> </span><span class="hs-glyph">=</span><span> </span><a href="Matrix.Nat.html#M"><span class="hs-identifier hs-var">M</span></a><span> </span><span class="hs-special">(</span><a href="Matrix.Internal.html#comp"><span class="hs-identifier hs-var">I.comp</span></a><span> </span><a href="#local-6989586621679063677"><span class="hs-identifier hs-var">a</span></a><span> </span><a href="#local-6989586621679063678"><span class="hs-identifier hs-var">b</span></a><span class="hs-special">)</span><span>
295+</span><a name="line-295"></a><span>
296+</span><a name="line-296"></a><span class="hs-identifier">p1</span><span> </span><span class="hs-glyph">::</span><span>
297+</span><a name="line-297"></a><span> </span><span class="hs-special">(</span><span> </span><span class="hs-identifier hs-type">Num</span><span> </span><a href="#local-6989586621679063605"><span class="hs-identifier hs-type">e</span></a><span class="hs-special">,</span><span>
298+</span><a name="line-298"></a><span> </span><span class="hs-identifier hs-type">KnownNat</span><span> </span><span class="hs-special">(</span><a href="Matrix.Internal.html#Count"><span class="hs-identifier hs-type">I.Count</span></a><span> </span><span class="hs-special">(</span><a href="Matrix.Internal.html#FromNat"><span class="hs-identifier hs-type">I.FromNat</span></a><span> </span><a href="#local-6989586621679063606"><span class="hs-identifier hs-type">n</span></a><span class="hs-special">)</span><span class="hs-special">)</span><span class="hs-special">,</span><span>
299+</span><a name="line-299"></a><span> </span><span class="hs-identifier hs-type">KnownNat</span><span> </span><span class="hs-special">(</span><a href="Matrix.Internal.html#Count"><span class="hs-identifier hs-type">I.Count</span></a><span> </span><span class="hs-special">(</span><a href="Matrix.Internal.html#FromNat"><span class="hs-identifier hs-type">I.FromNat</span></a><span> </span><a href="#local-6989586621679063607"><span class="hs-identifier hs-type">m</span></a><span class="hs-special">)</span><span class="hs-special">)</span><span class="hs-special">,</span><span>
300+</span><a name="line-300"></a><span> </span><a href="Matrix.Internal.html#FromLists"><span class="hs-identifier hs-type">I.FromLists</span></a><span> </span><a href="#local-6989586621679063605"><span class="hs-identifier hs-type">e</span></a><span> </span><span class="hs-special">(</span><a href="Matrix.Internal.html#FromNat"><span class="hs-identifier hs-type">I.FromNat</span></a><span> </span><a href="#local-6989586621679063606"><span class="hs-identifier hs-type">n</span></a><span class="hs-special">)</span><span> </span><span class="hs-special">(</span><a href="Matrix.Internal.html#FromNat"><span class="hs-identifier hs-type">I.FromNat</span></a><span> </span><a href="#local-6989586621679063607"><span class="hs-identifier hs-type">m</span></a><span class="hs-special">)</span><span class="hs-special">,</span><span>
301+</span><a name="line-301"></a><span> </span><a href="Matrix.Internal.html#FromLists"><span class="hs-identifier hs-type">I.FromLists</span></a><span> </span><a href="#local-6989586621679063605"><span class="hs-identifier hs-type">e</span></a><span> </span><span class="hs-special">(</span><a href="Matrix.Internal.html#FromNat"><span class="hs-identifier hs-type">I.FromNat</span></a><span> </span><a href="#local-6989586621679063607"><span class="hs-identifier hs-type">m</span></a><span class="hs-special">)</span><span> </span><span class="hs-special">(</span><a href="Matrix.Internal.html#FromNat"><span class="hs-identifier hs-type">I.FromNat</span></a><span> </span><a href="#local-6989586621679063607"><span class="hs-identifier hs-type">m</span></a><span class="hs-special">)</span><span class="hs-special">,</span><span>
302+</span><a name="line-302"></a><span> </span><span class="hs-identifier hs-type">I.FromNat</span><span> </span><span class="hs-special">(</span><span class="hs-identifier hs-type">m</span><span> </span><span class="hs-operator hs-type">+</span><span> </span><a href="#local-6989586621679063606"><span class="hs-identifier hs-type">n</span></a><span class="hs-special">)</span><span> </span><span class="hs-glyph">~</span><span> </span><span class="hs-identifier hs-type">Either</span><span> </span><span class="hs-special">(</span><a href="Matrix.Internal.html#FromNat"><span class="hs-identifier hs-type">I.FromNat</span></a><span> </span><a href="#local-6989586621679063607"><span class="hs-identifier hs-type">m</span></a><span class="hs-special">)</span><span> </span><span class="hs-special">(</span><a href="Matrix.Internal.html#FromNat"><span class="hs-identifier hs-type">I.FromNat</span></a><span> </span><a href="#local-6989586621679063606"><span class="hs-identifier hs-type">n</span></a><span class="hs-special">)</span><span>
303+</span><a name="line-303"></a><span> </span><span class="hs-special">)</span><span> </span><span class="hs-glyph">=&gt;</span><span>
304+</span><a name="line-304"></a><span> </span><a href="Matrix.Nat.html#Matrix"><span class="hs-identifier hs-type">Matrix</span></a><span> </span><a href="#local-6989586621679063605"><span class="hs-identifier hs-type">e</span></a><span> </span><span class="hs-special">(</span><span class="hs-identifier hs-type">m</span><span> </span><span class="hs-operator hs-type">+</span><span> </span><a href="#local-6989586621679063606"><span class="hs-identifier hs-type">n</span></a><span class="hs-special">)</span><span> </span><a href="#local-6989586621679063607"><span class="hs-identifier hs-type">m</span></a><span>
305+</span><a name="line-305"></a><a name="p1"><a href="Matrix.Nat.html#p1"><span class="hs-identifier">p1</span></a></a><span> </span><span class="hs-glyph">=</span><span> </span><a href="Matrix.Nat.html#M"><span class="hs-identifier hs-var">M</span></a><span> </span><a href="Matrix.Internal.html#p1"><span class="hs-identifier hs-var">I.p1</span></a><span>
306+</span><a name="line-306"></a><span>
307+</span><a name="line-307"></a><span class="hs-identifier">p2</span><span> </span><span class="hs-glyph">::</span><span>
308+</span><a name="line-308"></a><span> </span><span class="hs-special">(</span><span> </span><span class="hs-identifier hs-type">Num</span><span> </span><a href="#local-6989586621679063602"><span class="hs-identifier hs-type">e</span></a><span class="hs-special">,</span><span>
309+</span><a name="line-309"></a><span> </span><span class="hs-identifier hs-type">KnownNat</span><span> </span><span class="hs-special">(</span><a href="Matrix.Internal.html#Count"><span class="hs-identifier hs-type">I.Count</span></a><span> </span><span class="hs-special">(</span><a href="Matrix.Internal.html#FromNat"><span class="hs-identifier hs-type">I.FromNat</span></a><span> </span><a href="#local-6989586621679063603"><span class="hs-identifier hs-type">n</span></a><span class="hs-special">)</span><span class="hs-special">)</span><span class="hs-special">,</span><span>
310+</span><a name="line-310"></a><span> </span><span class="hs-identifier hs-type">KnownNat</span><span> </span><span class="hs-special">(</span><a href="Matrix.Internal.html#Count"><span class="hs-identifier hs-type">I.Count</span></a><span> </span><span class="hs-special">(</span><a href="Matrix.Internal.html#FromNat"><span class="hs-identifier hs-type">I.FromNat</span></a><span> </span><a href="#local-6989586621679063604"><span class="hs-identifier hs-type">m</span></a><span class="hs-special">)</span><span class="hs-special">)</span><span class="hs-special">,</span><span>
311+</span><a name="line-311"></a><span> </span><a href="Matrix.Internal.html#FromLists"><span class="hs-identifier hs-type">I.FromLists</span></a><span> </span><a href="#local-6989586621679063602"><span class="hs-identifier hs-type">e</span></a><span> </span><span class="hs-special">(</span><a href="Matrix.Internal.html#FromNat"><span class="hs-identifier hs-type">I.FromNat</span></a><span> </span><a href="#local-6989586621679063604"><span class="hs-identifier hs-type">m</span></a><span class="hs-special">)</span><span> </span><span class="hs-special">(</span><a href="Matrix.Internal.html#FromNat"><span class="hs-identifier hs-type">I.FromNat</span></a><span> </span><a href="#local-6989586621679063603"><span class="hs-identifier hs-type">n</span></a><span class="hs-special">)</span><span class="hs-special">,</span><span>
312+</span><a name="line-312"></a><span> </span><a href="Matrix.Internal.html#FromLists"><span class="hs-identifier hs-type">I.FromLists</span></a><span> </span><a href="#local-6989586621679063602"><span class="hs-identifier hs-type">e</span></a><span> </span><span class="hs-special">(</span><a href="Matrix.Internal.html#FromNat"><span class="hs-identifier hs-type">I.FromNat</span></a><span> </span><a href="#local-6989586621679063603"><span class="hs-identifier hs-type">n</span></a><span class="hs-special">)</span><span> </span><span class="hs-special">(</span><a href="Matrix.Internal.html#FromNat"><span class="hs-identifier hs-type">I.FromNat</span></a><span> </span><a href="#local-6989586621679063603"><span class="hs-identifier hs-type">n</span></a><span class="hs-special">)</span><span class="hs-special">,</span><span>
313+</span><a name="line-313"></a><span> </span><span class="hs-identifier hs-type">I.FromNat</span><span> </span><span class="hs-special">(</span><span class="hs-identifier hs-type">m</span><span> </span><span class="hs-operator hs-type">+</span><span> </span><a href="#local-6989586621679063603"><span class="hs-identifier hs-type">n</span></a><span class="hs-special">)</span><span> </span><span class="hs-glyph">~</span><span> </span><span class="hs-identifier hs-type">Either</span><span> </span><span class="hs-special">(</span><a href="Matrix.Internal.html#FromNat"><span class="hs-identifier hs-type">I.FromNat</span></a><span> </span><a href="#local-6989586621679063604"><span class="hs-identifier hs-type">m</span></a><span class="hs-special">)</span><span> </span><span class="hs-special">(</span><a href="Matrix.Internal.html#FromNat"><span class="hs-identifier hs-type">I.FromNat</span></a><span> </span><a href="#local-6989586621679063603"><span class="hs-identifier hs-type">n</span></a><span class="hs-special">)</span><span>
314+</span><a name="line-314"></a><span> </span><span class="hs-special">)</span><span> </span><span class="hs-glyph">=&gt;</span><span>
315+</span><a name="line-315"></a><span> </span><a href="Matrix.Nat.html#Matrix"><span class="hs-identifier hs-type">Matrix</span></a><span> </span><a href="#local-6989586621679063602"><span class="hs-identifier hs-type">e</span></a><span> </span><span class="hs-special">(</span><span class="hs-identifier hs-type">m</span><span> </span><span class="hs-operator hs-type">+</span><span> </span><a href="#local-6989586621679063603"><span class="hs-identifier hs-type">n</span></a><span class="hs-special">)</span><span> </span><a href="#local-6989586621679063603"><span class="hs-identifier hs-type">n</span></a><span>
316+</span><a name="line-316"></a><a name="p2"><a href="Matrix.Nat.html#p2"><span class="hs-identifier">p2</span></a></a><span> </span><span class="hs-glyph">=</span><span> </span><a href="Matrix.Nat.html#M"><span class="hs-identifier hs-var">M</span></a><span> </span><a href="Matrix.Internal.html#p2"><span class="hs-identifier hs-var">I.p2</span></a><span>
317+</span><a name="line-317"></a><span>
318+</span><a name="line-318"></a><span class="hs-comment">-- Injections</span><span>
319+</span><a name="line-319"></a><span>
320+</span><a name="line-320"></a><span class="hs-identifier">i1</span><span> </span><span class="hs-glyph">::</span><span>
321+</span><a name="line-321"></a><span> </span><span class="hs-special">(</span><span> </span><span class="hs-identifier hs-type">Num</span><span> </span><a href="#local-6989586621679063599"><span class="hs-identifier hs-type">e</span></a><span class="hs-special">,</span><span>
322+</span><a name="line-322"></a><span> </span><span class="hs-identifier hs-type">KnownNat</span><span> </span><span class="hs-special">(</span><a href="Matrix.Internal.html#Count"><span class="hs-identifier hs-type">I.Count</span></a><span> </span><span class="hs-special">(</span><a href="Matrix.Internal.html#FromNat"><span class="hs-identifier hs-type">I.FromNat</span></a><span> </span><a href="#local-6989586621679063600"><span class="hs-identifier hs-type">n</span></a><span class="hs-special">)</span><span class="hs-special">)</span><span class="hs-special">,</span><span>
323+</span><a name="line-323"></a><span> </span><span class="hs-identifier hs-type">KnownNat</span><span> </span><span class="hs-special">(</span><a href="Matrix.Internal.html#Count"><span class="hs-identifier hs-type">I.Count</span></a><span> </span><span class="hs-special">(</span><a href="Matrix.Internal.html#FromNat"><span class="hs-identifier hs-type">I.FromNat</span></a><span> </span><a href="#local-6989586621679063601"><span class="hs-identifier hs-type">rows</span></a><span class="hs-special">)</span><span class="hs-special">)</span><span class="hs-special">,</span><span>
324+</span><a name="line-324"></a><span> </span><a href="Matrix.Internal.html#FromLists"><span class="hs-identifier hs-type">I.FromLists</span></a><span> </span><a href="#local-6989586621679063599"><span class="hs-identifier hs-type">e</span></a><span> </span><span class="hs-special">(</span><a href="Matrix.Internal.html#FromNat"><span class="hs-identifier hs-type">I.FromNat</span></a><span> </span><a href="#local-6989586621679063600"><span class="hs-identifier hs-type">n</span></a><span class="hs-special">)</span><span> </span><span class="hs-special">(</span><a href="Matrix.Internal.html#FromNat"><span class="hs-identifier hs-type">I.FromNat</span></a><span> </span><a href="#local-6989586621679063601"><span class="hs-identifier hs-type">rows</span></a><span class="hs-special">)</span><span class="hs-special">,</span><span>
325+</span><a name="line-325"></a><span> </span><a href="Matrix.Internal.html#FromLists"><span class="hs-identifier hs-type">I.FromLists</span></a><span> </span><a href="#local-6989586621679063599"><span class="hs-identifier hs-type">e</span></a><span> </span><span class="hs-special">(</span><a href="Matrix.Internal.html#FromNat"><span class="hs-identifier hs-type">I.FromNat</span></a><span> </span><a href="#local-6989586621679063601"><span class="hs-identifier hs-type">rows</span></a><span class="hs-special">)</span><span> </span><span class="hs-special">(</span><a href="Matrix.Internal.html#FromNat"><span class="hs-identifier hs-type">I.FromNat</span></a><span> </span><a href="#local-6989586621679063601"><span class="hs-identifier hs-type">rows</span></a><span class="hs-special">)</span><span class="hs-special">,</span><span>
326+</span><a name="line-326"></a><span> </span><span class="hs-identifier hs-type">I.FromNat</span><span> </span><span class="hs-special">(</span><span class="hs-identifier hs-type">rows</span><span> </span><span class="hs-operator hs-type">+</span><span> </span><a href="#local-6989586621679063600"><span class="hs-identifier hs-type">n</span></a><span class="hs-special">)</span><span> </span><span class="hs-glyph">~</span><span> </span><span class="hs-identifier hs-type">Either</span><span> </span><span class="hs-special">(</span><a href="Matrix.Internal.html#FromNat"><span class="hs-identifier hs-type">I.FromNat</span></a><span> </span><a href="#local-6989586621679063601"><span class="hs-identifier hs-type">rows</span></a><span class="hs-special">)</span><span> </span><span class="hs-special">(</span><a href="Matrix.Internal.html#FromNat"><span class="hs-identifier hs-type">I.FromNat</span></a><span> </span><a href="#local-6989586621679063600"><span class="hs-identifier hs-type">n</span></a><span class="hs-special">)</span><span>
327+</span><a name="line-327"></a><span> </span><span class="hs-special">)</span><span> </span><span class="hs-glyph">=&gt;</span><span>
328+</span><a name="line-328"></a><span> </span><a href="Matrix.Nat.html#Matrix"><span class="hs-identifier hs-type">Matrix</span></a><span> </span><a href="#local-6989586621679063599"><span class="hs-identifier hs-type">e</span></a><span> </span><a href="#local-6989586621679063601"><span class="hs-identifier hs-type">rows</span></a><span> </span><span class="hs-special">(</span><span class="hs-identifier hs-type">rows</span><span> </span><span class="hs-operator hs-type">+</span><span> </span><a href="#local-6989586621679063600"><span class="hs-identifier hs-type">n</span></a><span class="hs-special">)</span><span>
329+</span><a name="line-329"></a><a name="i1"><a href="Matrix.Nat.html#i1"><span class="hs-identifier">i1</span></a></a><span> </span><span class="hs-glyph">=</span><span> </span><a href="Matrix.Nat.html#tr"><span class="hs-identifier hs-var">tr</span></a><span> </span><a href="Matrix.Nat.html#p1"><span class="hs-identifier hs-var">p1</span></a><span>
330+</span><a name="line-330"></a><span>
331+</span><a name="line-331"></a><span class="hs-identifier">i2</span><span> </span><span class="hs-glyph">::</span><span>
332+</span><a name="line-332"></a><span> </span><span class="hs-special">(</span><span> </span><span class="hs-identifier hs-type">Num</span><span> </span><a href="#local-6989586621679063596"><span class="hs-identifier hs-type">e</span></a><span class="hs-special">,</span><span>
333+</span><a name="line-333"></a><span> </span><span class="hs-identifier hs-type">KnownNat</span><span> </span><span class="hs-special">(</span><a href="Matrix.Internal.html#Count"><span class="hs-identifier hs-type">I.Count</span></a><span> </span><span class="hs-special">(</span><a href="Matrix.Internal.html#FromNat"><span class="hs-identifier hs-type">I.FromNat</span></a><span> </span><a href="#local-6989586621679063597"><span class="hs-identifier hs-type">rows</span></a><span class="hs-special">)</span><span class="hs-special">)</span><span class="hs-special">,</span><span>
334+</span><a name="line-334"></a><span> </span><span class="hs-identifier hs-type">KnownNat</span><span> </span><span class="hs-special">(</span><a href="Matrix.Internal.html#Count"><span class="hs-identifier hs-type">I.Count</span></a><span> </span><span class="hs-special">(</span><a href="Matrix.Internal.html#FromNat"><span class="hs-identifier hs-type">I.FromNat</span></a><span> </span><a href="#local-6989586621679063598"><span class="hs-identifier hs-type">m</span></a><span class="hs-special">)</span><span class="hs-special">)</span><span class="hs-special">,</span><span>
335+</span><a name="line-335"></a><span> </span><a href="Matrix.Internal.html#FromLists"><span class="hs-identifier hs-type">I.FromLists</span></a><span> </span><a href="#local-6989586621679063596"><span class="hs-identifier hs-type">e</span></a><span> </span><span class="hs-special">(</span><a href="Matrix.Internal.html#FromNat"><span class="hs-identifier hs-type">I.FromNat</span></a><span> </span><a href="#local-6989586621679063598"><span class="hs-identifier hs-type">m</span></a><span class="hs-special">)</span><span> </span><span class="hs-special">(</span><a href="Matrix.Internal.html#FromNat"><span class="hs-identifier hs-type">I.FromNat</span></a><span> </span><a href="#local-6989586621679063597"><span class="hs-identifier hs-type">rows</span></a><span class="hs-special">)</span><span class="hs-special">,</span><span>
336+</span><a name="line-336"></a><span> </span><a href="Matrix.Internal.html#FromLists"><span class="hs-identifier hs-type">I.FromLists</span></a><span> </span><a href="#local-6989586621679063596"><span class="hs-identifier hs-type">e</span></a><span> </span><span class="hs-special">(</span><a href="Matrix.Internal.html#FromNat"><span class="hs-identifier hs-type">I.FromNat</span></a><span> </span><a href="#local-6989586621679063597"><span class="hs-identifier hs-type">rows</span></a><span class="hs-special">)</span><span> </span><span class="hs-special">(</span><a href="Matrix.Internal.html#FromNat"><span class="hs-identifier hs-type">I.FromNat</span></a><span> </span><a href="#local-6989586621679063597"><span class="hs-identifier hs-type">rows</span></a><span class="hs-special">)</span><span class="hs-special">,</span><span>
337+</span><a name="line-337"></a><span> </span><span class="hs-identifier hs-type">I.FromNat</span><span> </span><span class="hs-special">(</span><span class="hs-identifier hs-type">m</span><span> </span><span class="hs-operator hs-type">+</span><span> </span><a href="#local-6989586621679063597"><span class="hs-identifier hs-type">rows</span></a><span class="hs-special">)</span><span> </span><span class="hs-glyph">~</span><span> </span><span class="hs-identifier hs-type">Either</span><span> </span><span class="hs-special">(</span><a href="Matrix.Internal.html#FromNat"><span class="hs-identifier hs-type">I.FromNat</span></a><span> </span><a href="#local-6989586621679063598"><span class="hs-identifier hs-type">m</span></a><span class="hs-special">)</span><span> </span><span class="hs-special">(</span><a href="Matrix.Internal.html#FromNat"><span class="hs-identifier hs-type">I.FromNat</span></a><span> </span><a href="#local-6989586621679063597"><span class="hs-identifier hs-type">rows</span></a><span class="hs-special">)</span><span>
338+</span><a name="line-338"></a><span> </span><span class="hs-special">)</span><span> </span><span class="hs-glyph">=&gt;</span><span>
339+</span><a name="line-339"></a><span> </span><a href="Matrix.Nat.html#Matrix"><span class="hs-identifier hs-type">Matrix</span></a><span> </span><a href="#local-6989586621679063596"><span class="hs-identifier hs-type">e</span></a><span> </span><a href="#local-6989586621679063597"><span class="hs-identifier hs-type">rows</span></a><span> </span><span class="hs-special">(</span><span class="hs-identifier hs-type">m</span><span> </span><span class="hs-operator hs-type">+</span><span> </span><a href="#local-6989586621679063597"><span class="hs-identifier hs-type">rows</span></a><span class="hs-special">)</span><span>
340+</span><a name="line-340"></a><a name="i2"><a href="Matrix.Nat.html#i2"><span class="hs-identifier">i2</span></a></a><span> </span><span class="hs-glyph">=</span><span> </span><a href="Matrix.Nat.html#tr"><span class="hs-identifier hs-var">tr</span></a><span> </span><a href="Matrix.Nat.html#p2"><span class="hs-identifier hs-var">p2</span></a><span>
341+</span><a name="line-341"></a><span>
342+</span><a name="line-342"></a><span class="hs-comment">-- Dimensions</span><span>
343+</span><a name="line-343"></a><span>
344+</span><a name="line-344"></a><span class="hs-identifier">rows</span><span> </span><span class="hs-glyph">::</span><span> </span><span class="hs-special">(</span><span class="hs-identifier hs-type">KnownNat</span><span> </span><span class="hs-special">(</span><a href="Matrix.Internal.html#Count"><span class="hs-identifier hs-type">I.Count</span></a><span> </span><span class="hs-special">(</span><a href="Matrix.Internal.html#FromNat"><span class="hs-identifier hs-type">I.FromNat</span></a><span> </span><a href="#local-6989586621679063593"><span class="hs-identifier hs-type">rows</span></a><span class="hs-special">)</span><span class="hs-special">)</span><span class="hs-special">)</span><span> </span><span class="hs-glyph">=&gt;</span><span> </span><a href="Matrix.Nat.html#Matrix"><span class="hs-identifier hs-type">Matrix</span></a><span> </span><a href="#local-6989586621679063594"><span class="hs-identifier hs-type">e</span></a><span> </span><a href="#local-6989586621679063595"><span class="hs-identifier hs-type">cols</span></a><span> </span><a href="#local-6989586621679063593"><span class="hs-identifier hs-type">rows</span></a><span> </span><span class="hs-glyph">-&gt;</span><span> </span><span class="hs-identifier hs-type">Int</span><span>
345+</span><a name="line-345"></a><a name="rows"><a href="Matrix.Nat.html#rows"><span class="hs-identifier">rows</span></a></a><span> </span><span class="hs-special">(</span><a href="Matrix.Nat.html#M"><span class="hs-identifier hs-var">M</span></a><span> </span><a name="local-6989586621679063679"><a href="#local-6989586621679063679"><span class="hs-identifier">m</span></a></a><span class="hs-special">)</span><span> </span><span class="hs-glyph">=</span><span> </span><a href="Matrix.Internal.html#rows"><span class="hs-identifier hs-var">I.rows</span></a><span> </span><a href="#local-6989586621679063679"><span class="hs-identifier hs-var">m</span></a><span>
346+</span><a name="line-346"></a><span>
347+</span><a name="line-347"></a><span class="hs-identifier">columns</span><span> </span><span class="hs-glyph">::</span><span> </span><span class="hs-special">(</span><span class="hs-identifier hs-type">KnownNat</span><span> </span><span class="hs-special">(</span><a href="Matrix.Internal.html#Count"><span class="hs-identifier hs-type">I.Count</span></a><span> </span><span class="hs-special">(</span><a href="Matrix.Internal.html#FromNat"><span class="hs-identifier hs-type">I.FromNat</span></a><span> </span><a href="#local-6989586621679063590"><span class="hs-identifier hs-type">cols</span></a><span class="hs-special">)</span><span class="hs-special">)</span><span class="hs-special">)</span><span> </span><span class="hs-glyph">=&gt;</span><span> </span><a href="Matrix.Nat.html#Matrix"><span class="hs-identifier hs-type">Matrix</span></a><span> </span><a href="#local-6989586621679063591"><span class="hs-identifier hs-type">e</span></a><span> </span><a href="#local-6989586621679063590"><span class="hs-identifier hs-type">cols</span></a><span> </span><a href="#local-6989586621679063592"><span class="hs-identifier hs-type">rows</span></a><span> </span><span class="hs-glyph">-&gt;</span><span> </span><span class="hs-identifier hs-type">Int</span><span>
348+</span><a name="line-348"></a><a name="columns"><a href="Matrix.Nat.html#columns"><span class="hs-identifier">columns</span></a></a><span> </span><span class="hs-special">(</span><a href="Matrix.Nat.html#M"><span class="hs-identifier hs-var">M</span></a><span> </span><a name="local-6989586621679063680"><a href="#local-6989586621679063680"><span class="hs-identifier">m</span></a></a><span class="hs-special">)</span><span> </span><span class="hs-glyph">=</span><span> </span><a href="Matrix.Internal.html#columns"><span class="hs-identifier hs-var">I.columns</span></a><span> </span><a href="#local-6989586621679063680"><span class="hs-identifier hs-var">m</span></a><span>
349+</span><a name="line-349"></a><span>
350+</span><a name="line-350"></a><span class="hs-comment">-- Coproduct Bifunctor</span><span>
351+</span><a name="line-351"></a><span>
352+</span><a name="line-352"></a><span class="hs-keyword">infixl</span><span> </span><span class="hs-number">5</span><span> </span><a href="Matrix.Nat.html#-%7C-"><span class="hs-operator hs-var">-|-</span></a><span>
353+</span><a name="line-353"></a><span>
354+</span><a name="line-354"></a><span class="hs-special">(</span><span class="hs-operator">-|-</span><span class="hs-special">)</span><span> </span><span class="hs-glyph">::</span><span>
355+</span><a name="line-355"></a><span> </span><span class="hs-special">(</span><span> </span><span class="hs-identifier hs-type">Num</span><span> </span><a href="#local-6989586621679063585"><span class="hs-identifier hs-type">e</span></a><span class="hs-special">,</span><span>
356+</span><a name="line-356"></a><span> </span><span class="hs-identifier hs-type">KnownNat</span><span> </span><span class="hs-special">(</span><a href="Matrix.Internal.html#Count"><span class="hs-identifier hs-type">I.Count</span></a><span> </span><span class="hs-special">(</span><a href="Matrix.Internal.html#FromNat"><span class="hs-identifier hs-type">I.FromNat</span></a><span> </span><a href="#local-6989586621679063586"><span class="hs-identifier hs-type">j</span></a><span class="hs-special">)</span><span class="hs-special">)</span><span class="hs-special">,</span><span>
357+</span><a name="line-357"></a><span> </span><span class="hs-identifier hs-type">KnownNat</span><span> </span><span class="hs-special">(</span><a href="Matrix.Internal.html#Count"><span class="hs-identifier hs-type">I.Count</span></a><span> </span><span class="hs-special">(</span><a href="Matrix.Internal.html#FromNat"><span class="hs-identifier hs-type">I.FromNat</span></a><span> </span><a href="#local-6989586621679063587"><span class="hs-identifier hs-type">k</span></a><span class="hs-special">)</span><span class="hs-special">)</span><span class="hs-special">,</span><span>
358+</span><a name="line-358"></a><span> </span><a href="Matrix.Internal.html#FromLists"><span class="hs-identifier hs-type">I.FromLists</span></a><span> </span><a href="#local-6989586621679063585"><span class="hs-identifier hs-type">e</span></a><span> </span><span class="hs-special">(</span><a href="Matrix.Internal.html#FromNat"><span class="hs-identifier hs-type">I.FromNat</span></a><span> </span><a href="#local-6989586621679063587"><span class="hs-identifier hs-type">k</span></a><span class="hs-special">)</span><span> </span><span class="hs-special">(</span><a href="Matrix.Internal.html#FromNat"><span class="hs-identifier hs-type">I.FromNat</span></a><span> </span><a href="#local-6989586621679063587"><span class="hs-identifier hs-type">k</span></a><span class="hs-special">)</span><span class="hs-special">,</span><span>
359+</span><a name="line-359"></a><span> </span><a href="Matrix.Internal.html#FromLists"><span class="hs-identifier hs-type">I.FromLists</span></a><span> </span><a href="#local-6989586621679063585"><span class="hs-identifier hs-type">e</span></a><span> </span><span class="hs-special">(</span><a href="Matrix.Internal.html#FromNat"><span class="hs-identifier hs-type">I.FromNat</span></a><span> </span><a href="#local-6989586621679063586"><span class="hs-identifier hs-type">j</span></a><span class="hs-special">)</span><span> </span><span class="hs-special">(</span><a href="Matrix.Internal.html#FromNat"><span class="hs-identifier hs-type">I.FromNat</span></a><span> </span><a href="#local-6989586621679063587"><span class="hs-identifier hs-type">k</span></a><span class="hs-special">)</span><span class="hs-special">,</span><span>
360+</span><a name="line-360"></a><span> </span><a href="Matrix.Internal.html#FromLists"><span class="hs-identifier hs-type">I.FromLists</span></a><span> </span><a href="#local-6989586621679063585"><span class="hs-identifier hs-type">e</span></a><span> </span><span class="hs-special">(</span><a href="Matrix.Internal.html#FromNat"><span class="hs-identifier hs-type">I.FromNat</span></a><span> </span><a href="#local-6989586621679063587"><span class="hs-identifier hs-type">k</span></a><span class="hs-special">)</span><span> </span><span class="hs-special">(</span><a href="Matrix.Internal.html#FromNat"><span class="hs-identifier hs-type">I.FromNat</span></a><span> </span><a href="#local-6989586621679063586"><span class="hs-identifier hs-type">j</span></a><span class="hs-special">)</span><span class="hs-special">,</span><span>
361+</span><a name="line-361"></a><span> </span><a href="Matrix.Internal.html#FromLists"><span class="hs-identifier hs-type">I.FromLists</span></a><span> </span><a href="#local-6989586621679063585"><span class="hs-identifier hs-type">e</span></a><span> </span><span class="hs-special">(</span><a href="Matrix.Internal.html#FromNat"><span class="hs-identifier hs-type">I.FromNat</span></a><span> </span><a href="#local-6989586621679063586"><span class="hs-identifier hs-type">j</span></a><span class="hs-special">)</span><span> </span><span class="hs-special">(</span><a href="Matrix.Internal.html#FromNat"><span class="hs-identifier hs-type">I.FromNat</span></a><span> </span><a href="#local-6989586621679063586"><span class="hs-identifier hs-type">j</span></a><span class="hs-special">)</span><span class="hs-special">,</span><span>
362+</span><a name="line-362"></a><span> </span><span class="hs-identifier hs-type">I.FromNat</span><span> </span><span class="hs-special">(</span><span class="hs-identifier hs-type">n</span><span> </span><span class="hs-operator hs-type">+</span><span> </span><a href="#local-6989586621679063589"><span class="hs-identifier hs-type">m</span></a><span class="hs-special">)</span><span> </span><span class="hs-glyph">~</span><span> </span><span class="hs-identifier hs-type">Either</span><span> </span><span class="hs-special">(</span><a href="Matrix.Internal.html#FromNat"><span class="hs-identifier hs-type">I.FromNat</span></a><span> </span><a href="#local-6989586621679063588"><span class="hs-identifier hs-type">n</span></a><span class="hs-special">)</span><span> </span><span class="hs-special">(</span><a href="Matrix.Internal.html#FromNat"><span class="hs-identifier hs-type">I.FromNat</span></a><span> </span><a href="#local-6989586621679063589"><span class="hs-identifier hs-type">m</span></a><span class="hs-special">)</span><span class="hs-special">,</span><span>
363+</span><a name="line-363"></a><span> </span><span class="hs-identifier hs-type">I.FromNat</span><span> </span><span class="hs-special">(</span><span class="hs-identifier hs-type">k</span><span> </span><span class="hs-operator hs-type">+</span><span> </span><a href="#local-6989586621679063586"><span class="hs-identifier hs-type">j</span></a><span class="hs-special">)</span><span> </span><span class="hs-glyph">~</span><span> </span><span class="hs-identifier hs-type">Either</span><span> </span><span class="hs-special">(</span><a href="Matrix.Internal.html#FromNat"><span class="hs-identifier hs-type">I.FromNat</span></a><span> </span><a href="#local-6989586621679063587"><span class="hs-identifier hs-type">k</span></a><span class="hs-special">)</span><span> </span><span class="hs-special">(</span><a href="Matrix.Internal.html#FromNat"><span class="hs-identifier hs-type">I.FromNat</span></a><span> </span><a href="#local-6989586621679063586"><span class="hs-identifier hs-type">j</span></a><span class="hs-special">)</span><span>
364+</span><a name="line-364"></a><span> </span><span class="hs-special">)</span><span> </span><span class="hs-glyph">=&gt;</span><span>
365+</span><a name="line-365"></a><span> </span><a href="Matrix.Nat.html#Matrix"><span class="hs-identifier hs-type">Matrix</span></a><span> </span><a href="#local-6989586621679063585"><span class="hs-identifier hs-type">e</span></a><span> </span><a href="#local-6989586621679063588"><span class="hs-identifier hs-type">n</span></a><span> </span><a href="#local-6989586621679063587"><span class="hs-identifier hs-type">k</span></a><span> </span><span class="hs-glyph">-&gt;</span><span>
366+</span><a name="line-366"></a><span> </span><a href="Matrix.Nat.html#Matrix"><span class="hs-identifier hs-type">Matrix</span></a><span> </span><a href="#local-6989586621679063585"><span class="hs-identifier hs-type">e</span></a><span> </span><a href="#local-6989586621679063589"><span class="hs-identifier hs-type">m</span></a><span> </span><a href="#local-6989586621679063586"><span class="hs-identifier hs-type">j</span></a><span> </span><span class="hs-glyph">-&gt;</span><span>
367+</span><a name="line-367"></a><span> </span><a href="Matrix.Nat.html#Matrix"><span class="hs-identifier hs-type">Matrix</span></a><span> </span><a href="#local-6989586621679063585"><span class="hs-identifier hs-type">e</span></a><span> </span><span class="hs-special">(</span><span class="hs-identifier hs-type">n</span><span> </span><span class="hs-operator hs-type">+</span><span> </span><a href="#local-6989586621679063589"><span class="hs-identifier hs-type">m</span></a><span class="hs-special">)</span><span> </span><span class="hs-special">(</span><span class="hs-identifier hs-type">k</span><span> </span><span class="hs-operator hs-type">+</span><span> </span><a href="#local-6989586621679063586"><span class="hs-identifier hs-type">j</span></a><span class="hs-special">)</span><span>
368+</span><a name="line-368"></a><span class="hs-special">(</span><a name="-%7C-"><a href="Matrix.Nat.html#-%7C-"><span class="hs-operator">-|-</span></a></a><span class="hs-special">)</span><span> </span><span class="hs-special">(</span><a href="Matrix.Nat.html#M"><span class="hs-identifier hs-var">M</span></a><span> </span><a name="local-6989586621679063681"><a href="#local-6989586621679063681"><span class="hs-identifier">a</span></a></a><span class="hs-special">)</span><span> </span><span class="hs-special">(</span><a href="Matrix.Nat.html#M"><span class="hs-identifier hs-var">M</span></a><span> </span><a name="local-6989586621679063682"><a href="#local-6989586621679063682"><span class="hs-identifier">b</span></a></a><span class="hs-special">)</span><span> </span><span class="hs-glyph">=</span><span> </span><a href="Matrix.Nat.html#M"><span class="hs-identifier hs-var">M</span></a><span> </span><span class="hs-special">(</span><span class="hs-special">(</span><a href="Matrix.Internal.html#-%7C-"><span class="hs-operator hs-var">I.-|-</span></a><span class="hs-special">)</span><span> </span><a href="#local-6989586621679063681"><span class="hs-identifier hs-var">a</span></a><span> </span><a href="#local-6989586621679063682"><span class="hs-identifier hs-var">b</span></a><span class="hs-special">)</span><span>
369+</span><a name="line-369"></a><span>
370+</span><a name="line-370"></a><span class="hs-comment">-- Khatri Rao Product and projections</span><span>
371+</span><a name="line-371"></a><span>
372+</span><a name="line-372"></a><span class="hs-identifier">kp1</span><span> </span><span class="hs-glyph">::</span><span>
373+</span><a name="line-373"></a><span> </span><span class="hs-keyword">forall</span><span> </span><a name="local-6989586621679063582"><a href="#local-6989586621679063582"><span class="hs-identifier">e</span></a></a><span> </span><a name="local-6989586621679063583"><a href="#local-6989586621679063583"><span class="hs-identifier">m</span></a></a><span> </span><a name="local-6989586621679063584"><a href="#local-6989586621679063584"><span class="hs-identifier">k</span></a></a><span> </span><span class="hs-operator">.</span><span>
374+</span><a name="line-374"></a><span> </span><span class="hs-special">(</span><span> </span><span class="hs-identifier hs-type">Num</span><span> </span><a href="#local-6989586621679063582"><span class="hs-identifier hs-type">e</span></a><span class="hs-special">,</span><span>
375+</span><a name="line-375"></a><span> </span><span class="hs-identifier hs-type">KnownNat</span><span> </span><span class="hs-special">(</span><a href="Matrix.Internal.html#Count"><span class="hs-identifier hs-type">I.Count</span></a><span> </span><span class="hs-special">(</span><a href="Matrix.Internal.html#FromNat"><span class="hs-identifier hs-type">I.FromNat</span></a><span> </span><a href="#local-6989586621679063583"><span class="hs-identifier hs-type">m</span></a><span class="hs-special">)</span><span class="hs-special">)</span><span class="hs-special">,</span><span>
376+</span><a name="line-376"></a><span> </span><span class="hs-identifier hs-type">KnownNat</span><span> </span><span class="hs-special">(</span><a href="Matrix.Internal.html#Count"><span class="hs-identifier hs-type">I.Count</span></a><span> </span><span class="hs-special">(</span><a href="Matrix.Internal.html#FromNat"><span class="hs-identifier hs-type">I.FromNat</span></a><span> </span><a href="#local-6989586621679063584"><span class="hs-identifier hs-type">k</span></a><span class="hs-special">)</span><span class="hs-special">)</span><span class="hs-special">,</span><span>
377+</span><a name="line-377"></a><span> </span><span class="hs-identifier hs-type">KnownNat</span><span> </span><span class="hs-special">(</span><a href="Matrix.Internal.html#Count"><span class="hs-identifier hs-type">I.Count</span></a><span> </span><span class="hs-special">(</span><a href="Matrix.Internal.html#FromNat"><span class="hs-identifier hs-type">I.FromNat</span></a><span> </span><span class="hs-special">(</span><span class="hs-identifier hs-type">m</span><span> </span><span class="hs-operator hs-type">*</span><span> </span><a href="#local-6989586621679063584"><span class="hs-identifier hs-type">k</span></a><span class="hs-special">)</span><span class="hs-special">)</span><span class="hs-special">)</span><span class="hs-special">,</span><span>
378+</span><a name="line-378"></a><span> </span><a href="Matrix.Internal.html#FromLists"><span class="hs-identifier hs-type">I.FromLists</span></a><span> </span><a href="#local-6989586621679063582"><span class="hs-identifier hs-type">e</span></a><span> </span><span class="hs-special">(</span><a href="Matrix.Internal.html#FromNat"><span class="hs-identifier hs-type">I.FromNat</span></a><span> </span><span class="hs-special">(</span><span class="hs-identifier hs-type">m</span><span> </span><span class="hs-operator hs-type">*</span><span> </span><a href="#local-6989586621679063584"><span class="hs-identifier hs-type">k</span></a><span class="hs-special">)</span><span class="hs-special">)</span><span> </span><span class="hs-special">(</span><a href="Matrix.Internal.html#FromNat"><span class="hs-identifier hs-type">I.FromNat</span></a><span> </span><a href="#local-6989586621679063583"><span class="hs-identifier hs-type">m</span></a><span class="hs-special">)</span><span class="hs-special">,</span><span>
379+</span><a name="line-379"></a><span> </span><span class="hs-identifier hs-type">I.FromNat</span><span> </span><span class="hs-special">(</span><span class="hs-identifier hs-type">m</span><span> </span><span class="hs-operator hs-type">*</span><span> </span><a href="#local-6989586621679063584"><span class="hs-identifier hs-type">k</span></a><span class="hs-special">)</span><span> </span><span class="hs-glyph">~</span><span> </span><a href="Matrix.Internal.html#FromNat"><span class="hs-identifier hs-type">I.FromNat</span></a><span> </span><span class="hs-special">(</span><span class="hs-identifier hs-type">I.Count</span><span> </span><span class="hs-special">(</span><a href="Matrix.Internal.html#FromNat"><span class="hs-identifier hs-type">I.FromNat</span></a><span> </span><a href="#local-6989586621679063583"><span class="hs-identifier hs-type">m</span></a><span class="hs-special">)</span><span> </span><span class="hs-operator">*</span><span> </span><a href="Matrix.Internal.html#Count"><span class="hs-identifier hs-type">I.Count</span></a><span> </span><span class="hs-special">(</span><a href="Matrix.Internal.html#FromNat"><span class="hs-identifier hs-type">I.FromNat</span></a><span> </span><a href="#local-6989586621679063584"><span class="hs-identifier hs-type">k</span></a><span class="hs-special">)</span><span class="hs-special">)</span><span>
380+</span><a name="line-380"></a><span> </span><span class="hs-special">)</span><span> </span><span class="hs-glyph">=&gt;</span><span> </span><a href="Matrix.Nat.html#Matrix"><span class="hs-identifier hs-type">Matrix</span></a><span> </span><a href="#local-6989586621679063582"><span class="hs-identifier hs-type">e</span></a><span> </span><span class="hs-special">(</span><span class="hs-identifier hs-type">m</span><span> </span><span class="hs-operator hs-type">*</span><span> </span><a href="#local-6989586621679063584"><span class="hs-identifier hs-type">k</span></a><span class="hs-special">)</span><span> </span><a href="#local-6989586621679063583"><span class="hs-identifier hs-type">m</span></a><span>
381+</span><a name="line-381"></a><a name="kp1"><a href="Matrix.Nat.html#kp1"><span class="hs-identifier">kp1</span></a></a><span> </span><span class="hs-glyph">=</span><span> </span><a href="Matrix.Nat.html#M"><span class="hs-identifier hs-var">M</span></a><span> </span><span class="hs-special">(</span><a href="Matrix.Internal.html#kp1"><span class="hs-identifier hs-var">I.kp1</span></a><span> </span><span class="hs-glyph">@</span><a href="#local-6989586621679063582"><span class="hs-identifier hs-type">e</span></a><span> </span><span class="hs-glyph">@</span><span class="hs-special">(</span><a href="Matrix.Internal.html#FromNat"><span class="hs-identifier hs-type">I.FromNat</span></a><span> </span><a href="#local-6989586621679063583"><span class="hs-identifier hs-type">m</span></a><span class="hs-special">)</span><span> </span><span class="hs-glyph">@</span><span class="hs-special">(</span><a href="Matrix.Internal.html#FromNat"><span class="hs-identifier hs-type">I.FromNat</span></a><span> </span><a href="#local-6989586621679063584"><span class="hs-identifier hs-type">k</span></a><span class="hs-special">)</span><span class="hs-special">)</span><span>
382+</span><a name="line-382"></a><span>
383+</span><a name="line-383"></a><span class="hs-identifier">kp2</span><span> </span><span class="hs-glyph">::</span><span>
384+</span><a name="line-384"></a><span> </span><span class="hs-keyword">forall</span><span> </span><a name="local-6989586621679063579"><a href="#local-6989586621679063579"><span class="hs-identifier">e</span></a></a><span> </span><a name="local-6989586621679063580"><a href="#local-6989586621679063580"><span class="hs-identifier">m</span></a></a><span> </span><a name="local-6989586621679063581"><a href="#local-6989586621679063581"><span class="hs-identifier">k</span></a></a><span class="hs-operator">.</span><span>
385+</span><a name="line-385"></a><span> </span><span class="hs-special">(</span><span> </span><span class="hs-identifier hs-type">Num</span><span> </span><a href="#local-6989586621679063579"><span class="hs-identifier hs-type">e</span></a><span class="hs-special">,</span><span>
386+</span><a name="line-386"></a><span> </span><span class="hs-identifier hs-type">KnownNat</span><span> </span><span class="hs-special">(</span><a href="Matrix.Internal.html#Count"><span class="hs-identifier hs-type">I.Count</span></a><span> </span><span class="hs-special">(</span><a href="Matrix.Internal.html#FromNat"><span class="hs-identifier hs-type">I.FromNat</span></a><span> </span><a href="#local-6989586621679063581"><span class="hs-identifier hs-type">k</span></a><span class="hs-special">)</span><span class="hs-special">)</span><span class="hs-special">,</span><span>
387+</span><a name="line-387"></a><span> </span><a href="Matrix.Internal.html#FromLists"><span class="hs-identifier hs-type">I.FromLists</span></a><span> </span><a href="#local-6989586621679063579"><span class="hs-identifier hs-type">e</span></a><span> </span><span class="hs-special">(</span><a href="Matrix.Internal.html#FromNat"><span class="hs-identifier hs-type">I.FromNat</span></a><span> </span><span class="hs-special">(</span><span class="hs-identifier hs-type">m</span><span> </span><span class="hs-operator hs-type">*</span><span> </span><a href="#local-6989586621679063581"><span class="hs-identifier hs-type">k</span></a><span class="hs-special">)</span><span class="hs-special">)</span><span> </span><span class="hs-special">(</span><a href="Matrix.Internal.html#FromNat"><span class="hs-identifier hs-type">I.FromNat</span></a><span> </span><a href="#local-6989586621679063581"><span class="hs-identifier hs-type">k</span></a><span class="hs-special">)</span><span class="hs-special">,</span><span>
388+</span><a name="line-388"></a><span> </span><span class="hs-identifier hs-type">KnownNat</span><span> </span><span class="hs-special">(</span><a href="Matrix.Internal.html#Count"><span class="hs-identifier hs-type">I.Count</span></a><span> </span><span class="hs-special">(</span><a href="Matrix.Internal.html#FromNat"><span class="hs-identifier hs-type">I.FromNat</span></a><span> </span><a href="#local-6989586621679063580"><span class="hs-identifier hs-type">m</span></a><span class="hs-special">)</span><span class="hs-special">)</span><span class="hs-special">,</span><span>
389+</span><a name="line-389"></a><span> </span><span class="hs-identifier hs-type">KnownNat</span><span> </span><span class="hs-special">(</span><a href="Matrix.Internal.html#Count"><span class="hs-identifier hs-type">I.Count</span></a><span> </span><span class="hs-special">(</span><a href="Matrix.Internal.html#FromNat"><span class="hs-identifier hs-type">I.FromNat</span></a><span> </span><span class="hs-special">(</span><span class="hs-identifier hs-type">m</span><span> </span><span class="hs-operator hs-type">*</span><span> </span><a href="#local-6989586621679063581"><span class="hs-identifier hs-type">k</span></a><span class="hs-special">)</span><span class="hs-special">)</span><span class="hs-special">)</span><span class="hs-special">,</span><span>
390+</span><a name="line-390"></a><span> </span><span class="hs-identifier hs-type">I.FromNat</span><span> </span><span class="hs-special">(</span><span class="hs-identifier hs-type">m</span><span> </span><span class="hs-operator hs-type">*</span><span> </span><a href="#local-6989586621679063581"><span class="hs-identifier hs-type">k</span></a><span class="hs-special">)</span><span> </span><span class="hs-glyph">~</span><span> </span><a href="Matrix.Internal.html#FromNat"><span class="hs-identifier hs-type">I.FromNat</span></a><span> </span><span class="hs-special">(</span><span class="hs-identifier hs-type">I.Count</span><span> </span><span class="hs-special">(</span><a href="Matrix.Internal.html#FromNat"><span class="hs-identifier hs-type">I.FromNat</span></a><span> </span><a href="#local-6989586621679063580"><span class="hs-identifier hs-type">m</span></a><span class="hs-special">)</span><span> </span><span class="hs-operator">*</span><span> </span><a href="Matrix.Internal.html#Count"><span class="hs-identifier hs-type">I.Count</span></a><span> </span><span class="hs-special">(</span><a href="Matrix.Internal.html#FromNat"><span class="hs-identifier hs-type">I.FromNat</span></a><span> </span><a href="#local-6989586621679063581"><span class="hs-identifier hs-type">k</span></a><span class="hs-special">)</span><span class="hs-special">)</span><span>
391+</span><a name="line-391"></a><span> </span><span class="hs-special">)</span><span> </span><span class="hs-glyph">=&gt;</span><span> </span><a href="Matrix.Nat.html#Matrix"><span class="hs-identifier hs-type">Matrix</span></a><span> </span><a href="#local-6989586621679063579"><span class="hs-identifier hs-type">e</span></a><span> </span><span class="hs-special">(</span><span class="hs-identifier hs-type">m</span><span> </span><span class="hs-operator hs-type">*</span><span> </span><a href="#local-6989586621679063581"><span class="hs-identifier hs-type">k</span></a><span class="hs-special">)</span><span> </span><a href="#local-6989586621679063581"><span class="hs-identifier hs-type">k</span></a><span>
392+</span><a name="line-392"></a><a name="kp2"><a href="Matrix.Nat.html#kp2"><span class="hs-identifier">kp2</span></a></a><span> </span><span class="hs-glyph">=</span><span> </span><a href="Matrix.Nat.html#M"><span class="hs-identifier hs-var">M</span></a><span> </span><span class="hs-special">(</span><a href="Matrix.Internal.html#kp2"><span class="hs-identifier hs-var">I.kp2</span></a><span> </span><span class="hs-glyph">@</span><a href="#local-6989586621679063579"><span class="hs-identifier hs-type">e</span></a><span> </span><span class="hs-glyph">@</span><span class="hs-special">(</span><a href="Matrix.Internal.html#FromNat"><span class="hs-identifier hs-type">I.FromNat</span></a><span> </span><a href="#local-6989586621679063580"><span class="hs-identifier hs-type">m</span></a><span class="hs-special">)</span><span> </span><span class="hs-glyph">@</span><span class="hs-special">(</span><a href="Matrix.Internal.html#FromNat"><span class="hs-identifier hs-type">I.FromNat</span></a><span> </span><a href="#local-6989586621679063581"><span class="hs-identifier hs-type">k</span></a><span class="hs-special">)</span><span class="hs-special">)</span><span>
393+</span><a name="line-393"></a><span>
394+</span><a name="line-394"></a><span class="hs-identifier">khatri</span><span> </span><span class="hs-glyph">::</span><span>
395+</span><a name="line-395"></a><span> </span><span class="hs-keyword">forall</span><span> </span><a name="local-6989586621679063575"><a href="#local-6989586621679063575"><span class="hs-identifier">e</span></a></a><span> </span><a name="local-6989586621679063576"><a href="#local-6989586621679063576"><span class="hs-identifier">cols</span></a></a><span> </span><a name="local-6989586621679063577"><a href="#local-6989586621679063577"><span class="hs-identifier">a</span></a></a><span> </span><a name="local-6989586621679063578"><a href="#local-6989586621679063578"><span class="hs-identifier">b</span></a></a><span class="hs-operator">.</span><span>
396+</span><a name="line-396"></a><span> </span><span class="hs-special">(</span><span> </span><span class="hs-identifier hs-type">Num</span><span> </span><a href="#local-6989586621679063575"><span class="hs-identifier hs-type">e</span></a><span class="hs-special">,</span><span>
397+</span><a name="line-397"></a><span> </span><span class="hs-identifier hs-type">KnownNat</span><span> </span><span class="hs-special">(</span><a href="Matrix.Internal.html#Count"><span class="hs-identifier hs-type">I.Count</span></a><span> </span><span class="hs-special">(</span><a href="Matrix.Internal.html#FromNat"><span class="hs-identifier hs-type">I.FromNat</span></a><span> </span><a href="#local-6989586621679063577"><span class="hs-identifier hs-type">a</span></a><span class="hs-special">)</span><span class="hs-special">)</span><span class="hs-special">,</span><span>
398+</span><a name="line-398"></a><span> </span><span class="hs-identifier hs-type">KnownNat</span><span> </span><span class="hs-special">(</span><a href="Matrix.Internal.html#Count"><span class="hs-identifier hs-type">I.Count</span></a><span> </span><span class="hs-special">(</span><a href="Matrix.Internal.html#FromNat"><span class="hs-identifier hs-type">I.FromNat</span></a><span> </span><a href="#local-6989586621679063578"><span class="hs-identifier hs-type">b</span></a><span class="hs-special">)</span><span class="hs-special">)</span><span class="hs-special">,</span><span>
399+</span><a name="line-399"></a><span> </span><span class="hs-identifier hs-type">KnownNat</span><span> </span><span class="hs-special">(</span><a href="Matrix.Internal.html#Count"><span class="hs-identifier hs-type">I.Count</span></a><span> </span><span class="hs-special">(</span><a href="Matrix.Internal.html#FromNat"><span class="hs-identifier hs-type">I.FromNat</span></a><span> </span><span class="hs-special">(</span><span class="hs-identifier hs-type">a</span><span> </span><span class="hs-operator hs-type">*</span><span> </span><a href="#local-6989586621679063578"><span class="hs-identifier hs-type">b</span></a><span class="hs-special">)</span><span class="hs-special">)</span><span class="hs-special">)</span><span class="hs-special">,</span><span>
400+</span><a name="line-400"></a><span> </span><a href="Matrix.Internal.html#FromLists"><span class="hs-identifier hs-type">I.FromLists</span></a><span> </span><a href="#local-6989586621679063575"><span class="hs-identifier hs-type">e</span></a><span> </span><span class="hs-special">(</span><a href="Matrix.Internal.html#FromNat"><span class="hs-identifier hs-type">I.FromNat</span></a><span> </span><span class="hs-special">(</span><span class="hs-identifier hs-type">a</span><span> </span><span class="hs-operator hs-type">*</span><span> </span><a href="#local-6989586621679063578"><span class="hs-identifier hs-type">b</span></a><span class="hs-special">)</span><span class="hs-special">)</span><span> </span><span class="hs-special">(</span><a href="Matrix.Internal.html#FromNat"><span class="hs-identifier hs-type">I.FromNat</span></a><span> </span><a href="#local-6989586621679063577"><span class="hs-identifier hs-type">a</span></a><span class="hs-special">)</span><span class="hs-special">,</span><span>
401+</span><a name="line-401"></a><span> </span><a href="Matrix.Internal.html#FromLists"><span class="hs-identifier hs-type">I.FromLists</span></a><span> </span><a href="#local-6989586621679063575"><span class="hs-identifier hs-type">e</span></a><span> </span><span class="hs-special">(</span><a href="Matrix.Internal.html#FromNat"><span class="hs-identifier hs-type">I.FromNat</span></a><span> </span><span class="hs-special">(</span><span class="hs-identifier hs-type">a</span><span> </span><span class="hs-operator hs-type">*</span><span> </span><a href="#local-6989586621679063578"><span class="hs-identifier hs-type">b</span></a><span class="hs-special">)</span><span class="hs-special">)</span><span> </span><span class="hs-special">(</span><a href="Matrix.Internal.html#FromNat"><span class="hs-identifier hs-type">I.FromNat</span></a><span> </span><a href="#local-6989586621679063578"><span class="hs-identifier hs-type">b</span></a><span class="hs-special">)</span><span class="hs-special">,</span><span>
402+</span><a name="line-402"></a><span> </span><span class="hs-identifier hs-type">I.FromNat</span><span> </span><span class="hs-special">(</span><span class="hs-identifier hs-type">a</span><span> </span><span class="hs-operator hs-type">*</span><span> </span><a href="#local-6989586621679063578"><span class="hs-identifier hs-type">b</span></a><span class="hs-special">)</span><span> </span><span class="hs-glyph">~</span><span> </span><a href="Matrix.Internal.html#FromNat"><span class="hs-identifier hs-type">I.FromNat</span></a><span> </span><span class="hs-special">(</span><span class="hs-identifier hs-type">I.Count</span><span> </span><span class="hs-special">(</span><a href="Matrix.Internal.html#FromNat"><span class="hs-identifier hs-type">I.FromNat</span></a><span> </span><a href="#local-6989586621679063577"><span class="hs-identifier hs-type">a</span></a><span class="hs-special">)</span><span> </span><span class="hs-operator">*</span><span> </span><a href="Matrix.Internal.html#Count"><span class="hs-identifier hs-type">I.Count</span></a><span> </span><span class="hs-special">(</span><a href="Matrix.Internal.html#FromNat"><span class="hs-identifier hs-type">I.FromNat</span></a><span> </span><a href="#local-6989586621679063578"><span class="hs-identifier hs-type">b</span></a><span class="hs-special">)</span><span class="hs-special">)</span><span>
403+</span><a name="line-403"></a><span> </span><span class="hs-special">)</span><span> </span><span class="hs-glyph">=&gt;</span><span> </span><a href="Matrix.Nat.html#Matrix"><span class="hs-identifier hs-type">Matrix</span></a><span> </span><a href="#local-6989586621679063575"><span class="hs-identifier hs-type">e</span></a><span> </span><a href="#local-6989586621679063576"><span class="hs-identifier hs-type">cols</span></a><span> </span><a href="#local-6989586621679063577"><span class="hs-identifier hs-type">a</span></a><span> </span><span class="hs-glyph">-&gt;</span><span> </span><a href="Matrix.Nat.html#Matrix"><span class="hs-identifier hs-type">Matrix</span></a><span> </span><a href="#local-6989586621679063575"><span class="hs-identifier hs-type">e</span></a><span> </span><a href="#local-6989586621679063576"><span class="hs-identifier hs-type">cols</span></a><span> </span><a href="#local-6989586621679063578"><span class="hs-identifier hs-type">b</span></a><span> </span><span class="hs-glyph">-&gt;</span><span> </span><a href="Matrix.Nat.html#Matrix"><span class="hs-identifier hs-type">Matrix</span></a><span> </span><a href="#local-6989586621679063575"><span class="hs-identifier hs-type">e</span></a><span> </span><a href="#local-6989586621679063576"><span class="hs-identifier hs-type">cols</span></a><span> </span><span class="hs-special">(</span><span class="hs-identifier hs-type">a</span><span> </span><span class="hs-operator hs-type">*</span><span> </span><a href="#local-6989586621679063578"><span class="hs-identifier hs-type">b</span></a><span class="hs-special">)</span><span>
404+</span><a name="line-404"></a><a name="khatri"><a href="Matrix.Nat.html#khatri"><span class="hs-identifier">khatri</span></a></a><span> </span><a name="local-6989586621679063683"><a href="#local-6989586621679063683"><span class="hs-identifier">a</span></a></a><span> </span><a name="local-6989586621679063684"><a href="#local-6989586621679063684"><span class="hs-identifier">b</span></a></a><span> </span><span class="hs-glyph">=</span><span>
405+</span><a name="line-405"></a><span> </span><span class="hs-keyword">let</span><span> </span><a name="local-6989586621679063685"><a href="#local-6989586621679063685"><span class="hs-identifier">kp1'</span></a></a><span> </span><span class="hs-glyph">=</span><span> </span><a href="Matrix.Nat.html#kp1"><span class="hs-identifier hs-var">kp1</span></a><span> </span><span class="hs-glyph">@</span><a href="#local-6989586621679063575"><span class="hs-identifier hs-type">e</span></a><span> </span><span class="hs-glyph">@</span><a href="#local-6989586621679063577"><span class="hs-identifier hs-type">a</span></a><span> </span><span class="hs-glyph">@</span><a href="#local-6989586621679063578"><span class="hs-identifier hs-type">b</span></a><span>
406+</span><a name="line-406"></a><span> </span><a name="local-6989586621679063686"><a href="#local-6989586621679063686"><span class="hs-identifier">kp2'</span></a></a><span> </span><span class="hs-glyph">=</span><span> </span><a href="Matrix.Nat.html#kp2"><span class="hs-identifier hs-var">kp2</span></a><span> </span><span class="hs-glyph">@</span><a href="#local-6989586621679063575"><span class="hs-identifier hs-type">e</span></a><span> </span><span class="hs-glyph">@</span><a href="#local-6989586621679063577"><span class="hs-identifier hs-type">a</span></a><span> </span><span class="hs-glyph">@</span><a href="#local-6989586621679063578"><span class="hs-identifier hs-type">b</span></a><span>
407+</span><a name="line-407"></a><span> </span><span class="hs-keyword">in</span><span> </span><a href="Matrix.Nat.html#comp"><span class="hs-identifier hs-var">comp</span></a><span> </span><span class="hs-special">(</span><a href="Matrix.Nat.html#tr"><span class="hs-identifier hs-var">tr</span></a><span> </span><a href="#local-6989586621679063685"><span class="hs-identifier hs-var">kp1'</span></a><span class="hs-special">)</span><span> </span><a href="#local-6989586621679063683"><span class="hs-identifier hs-var">a</span></a><span> </span><span class="hs-operator hs-var">*</span><span> </span><a href="Matrix.Nat.html#comp"><span class="hs-identifier hs-var">comp</span></a><span> </span><span class="hs-special">(</span><a href="Matrix.Nat.html#tr"><span class="hs-identifier hs-var">tr</span></a><span> </span><a href="#local-6989586621679063686"><span class="hs-identifier hs-var">kp2'</span></a><span class="hs-special">)</span><span> </span><a href="#local-6989586621679063684"><span class="hs-identifier hs-var">b</span></a><span>
408+</span><a name="line-408"></a><span>
409+</span><a name="line-409"></a><span class="hs-comment">-- Product Bifunctor (Kronecker)</span><span>
410+</span><a name="line-410"></a><span>
411+</span><a name="line-411"></a><span class="hs-keyword">infixl</span><span> </span><span class="hs-number">4</span><span> </span><a href="Matrix.Nat.html#%3E%3C"><span class="hs-operator hs-var">&gt;&lt;</span></a><span>
412+</span><a name="line-412"></a><span>
413+</span><a name="line-413"></a><span class="hs-special">(</span><span class="hs-operator">&gt;&lt;</span><span class="hs-special">)</span><span> </span><span class="hs-glyph">::</span><span>
414+</span><a name="line-414"></a><span> </span><span class="hs-keyword">forall</span><span> </span><a name="local-6989586621679063570"><a href="#local-6989586621679063570"><span class="hs-identifier">e</span></a></a><span> </span><a name="local-6989586621679063571"><a href="#local-6989586621679063571"><span class="hs-identifier">m</span></a></a><span> </span><a name="local-6989586621679063572"><a href="#local-6989586621679063572"><span class="hs-identifier">p</span></a></a><span> </span><a name="local-6989586621679063573"><a href="#local-6989586621679063573"><span class="hs-identifier">n</span></a></a><span> </span><a name="local-6989586621679063574"><a href="#local-6989586621679063574"><span class="hs-identifier">q</span></a></a><span class="hs-operator">.</span><span>
415+</span><a name="line-415"></a><span> </span><span class="hs-special">(</span><span> </span><span class="hs-identifier hs-type">Num</span><span> </span><a href="#local-6989586621679063570"><span class="hs-identifier hs-type">e</span></a><span class="hs-special">,</span><span>
416+</span><a name="line-416"></a><span> </span><span class="hs-identifier hs-type">KnownNat</span><span> </span><span class="hs-special">(</span><a href="Matrix.Internal.html#Count"><span class="hs-identifier hs-type">I.Count</span></a><span> </span><span class="hs-special">(</span><a href="Matrix.Internal.html#FromNat"><span class="hs-identifier hs-type">I.FromNat</span></a><span> </span><a href="#local-6989586621679063571"><span class="hs-identifier hs-type">m</span></a><span class="hs-special">)</span><span class="hs-special">)</span><span class="hs-special">,</span><span>
417+</span><a name="line-417"></a><span> </span><span class="hs-identifier hs-type">KnownNat</span><span> </span><span class="hs-special">(</span><a href="Matrix.Internal.html#Count"><span class="hs-identifier hs-type">I.Count</span></a><span> </span><span class="hs-special">(</span><a href="Matrix.Internal.html#FromNat"><span class="hs-identifier hs-type">I.FromNat</span></a><span> </span><a href="#local-6989586621679063573"><span class="hs-identifier hs-type">n</span></a><span class="hs-special">)</span><span class="hs-special">)</span><span class="hs-special">,</span><span>
418+</span><a name="line-418"></a><span> </span><span class="hs-identifier hs-type">KnownNat</span><span> </span><span class="hs-special">(</span><a href="Matrix.Internal.html#Count"><span class="hs-identifier hs-type">I.Count</span></a><span> </span><span class="hs-special">(</span><a href="Matrix.Internal.html#FromNat"><span class="hs-identifier hs-type">I.FromNat</span></a><span> </span><a href="#local-6989586621679063572"><span class="hs-identifier hs-type">p</span></a><span class="hs-special">)</span><span class="hs-special">)</span><span class="hs-special">,</span><span>
419+</span><a name="line-419"></a><span> </span><span class="hs-identifier hs-type">KnownNat</span><span> </span><span class="hs-special">(</span><a href="Matrix.Internal.html#Count"><span class="hs-identifier hs-type">I.Count</span></a><span> </span><span class="hs-special">(</span><a href="Matrix.Internal.html#FromNat"><span class="hs-identifier hs-type">I.FromNat</span></a><span> </span><a href="#local-6989586621679063574"><span class="hs-identifier hs-type">q</span></a><span class="hs-special">)</span><span class="hs-special">)</span><span class="hs-special">,</span><span>
420+</span><a name="line-420"></a><span> </span><span class="hs-identifier hs-type">KnownNat</span><span> </span><span class="hs-special">(</span><a href="Matrix.Internal.html#Count"><span class="hs-identifier hs-type">I.Count</span></a><span> </span><span class="hs-special">(</span><a href="Matrix.Internal.html#FromNat"><span class="hs-identifier hs-type">I.FromNat</span></a><span> </span><span class="hs-special">(</span><span class="hs-identifier hs-type">m</span><span> </span><span class="hs-operator hs-type">*</span><span> </span><a href="#local-6989586621679063573"><span class="hs-identifier hs-type">n</span></a><span class="hs-special">)</span><span class="hs-special">)</span><span class="hs-special">)</span><span class="hs-special">,</span><span>
421+</span><a name="line-421"></a><span> </span><span class="hs-identifier hs-type">KnownNat</span><span> </span><span class="hs-special">(</span><a href="Matrix.Internal.html#Count"><span class="hs-identifier hs-type">I.Count</span></a><span> </span><span class="hs-special">(</span><a href="Matrix.Internal.html#FromNat"><span class="hs-identifier hs-type">I.FromNat</span></a><span> </span><span class="hs-special">(</span><span class="hs-identifier hs-type">p</span><span> </span><span class="hs-operator hs-type">*</span><span> </span><a href="#local-6989586621679063574"><span class="hs-identifier hs-type">q</span></a><span class="hs-special">)</span><span class="hs-special">)</span><span class="hs-special">)</span><span class="hs-special">,</span><span>
422+</span><a name="line-422"></a><span> </span><a href="Matrix.Internal.html#FromLists"><span class="hs-identifier hs-type">I.FromLists</span></a><span> </span><a href="#local-6989586621679063570"><span class="hs-identifier hs-type">e</span></a><span> </span><span class="hs-special">(</span><a href="Matrix.Internal.html#FromNat"><span class="hs-identifier hs-type">I.FromNat</span></a><span> </span><span class="hs-special">(</span><span class="hs-identifier hs-type">m</span><span> </span><span class="hs-operator hs-type">*</span><span> </span><a href="#local-6989586621679063573"><span class="hs-identifier hs-type">n</span></a><span class="hs-special">)</span><span class="hs-special">)</span><span> </span><span class="hs-special">(</span><a href="Matrix.Internal.html#FromNat"><span class="hs-identifier hs-type">I.FromNat</span></a><span> </span><a href="#local-6989586621679063571"><span class="hs-identifier hs-type">m</span></a><span class="hs-special">)</span><span class="hs-special">,</span><span>
423+</span><a name="line-423"></a><span> </span><a href="Matrix.Internal.html#FromLists"><span class="hs-identifier hs-type">I.FromLists</span></a><span> </span><a href="#local-6989586621679063570"><span class="hs-identifier hs-type">e</span></a><span> </span><span class="hs-special">(</span><a href="Matrix.Internal.html#FromNat"><span class="hs-identifier hs-type">I.FromNat</span></a><span> </span><span class="hs-special">(</span><span class="hs-identifier hs-type">m</span><span> </span><span class="hs-operator hs-type">*</span><span> </span><a href="#local-6989586621679063573"><span class="hs-identifier hs-type">n</span></a><span class="hs-special">)</span><span class="hs-special">)</span><span> </span><span class="hs-special">(</span><a href="Matrix.Internal.html#FromNat"><span class="hs-identifier hs-type">I.FromNat</span></a><span> </span><a href="#local-6989586621679063573"><span class="hs-identifier hs-type">n</span></a><span class="hs-special">)</span><span class="hs-special">,</span><span>
424+</span><a name="line-424"></a><span> </span><a href="Matrix.Internal.html#FromLists"><span class="hs-identifier hs-type">I.FromLists</span></a><span> </span><a href="#local-6989586621679063570"><span class="hs-identifier hs-type">e</span></a><span> </span><span class="hs-special">(</span><a href="Matrix.Internal.html#FromNat"><span class="hs-identifier hs-type">I.FromNat</span></a><span> </span><span class="hs-special">(</span><span class="hs-identifier hs-type">p</span><span> </span><span class="hs-operator hs-type">*</span><span> </span><a href="#local-6989586621679063574"><span class="hs-identifier hs-type">q</span></a><span class="hs-special">)</span><span class="hs-special">)</span><span> </span><span class="hs-special">(</span><a href="Matrix.Internal.html#FromNat"><span class="hs-identifier hs-type">I.FromNat</span></a><span> </span><a href="#local-6989586621679063572"><span class="hs-identifier hs-type">p</span></a><span class="hs-special">)</span><span class="hs-special">,</span><span>
425+</span><a name="line-425"></a><span> </span><a href="Matrix.Internal.html#FromLists"><span class="hs-identifier hs-type">I.FromLists</span></a><span> </span><a href="#local-6989586621679063570"><span class="hs-identifier hs-type">e</span></a><span> </span><span class="hs-special">(</span><a href="Matrix.Internal.html#FromNat"><span class="hs-identifier hs-type">I.FromNat</span></a><span> </span><span class="hs-special">(</span><span class="hs-identifier hs-type">p</span><span> </span><span class="hs-operator hs-type">*</span><span> </span><a href="#local-6989586621679063574"><span class="hs-identifier hs-type">q</span></a><span class="hs-special">)</span><span class="hs-special">)</span><span> </span><span class="hs-special">(</span><a href="Matrix.Internal.html#FromNat"><span class="hs-identifier hs-type">I.FromNat</span></a><span> </span><a href="#local-6989586621679063574"><span class="hs-identifier hs-type">q</span></a><span class="hs-special">)</span><span class="hs-special">,</span><span>
426+</span><a name="line-426"></a><span> </span><span class="hs-identifier hs-type">I.FromNat</span><span> </span><span class="hs-special">(</span><span class="hs-identifier hs-type">m</span><span> </span><span class="hs-operator hs-type">*</span><span> </span><a href="#local-6989586621679063573"><span class="hs-identifier hs-type">n</span></a><span class="hs-special">)</span><span> </span><span class="hs-glyph">~</span><span> </span><a href="Matrix.Internal.html#FromNat"><span class="hs-identifier hs-type">I.FromNat</span></a><span> </span><span class="hs-special">(</span><span class="hs-identifier hs-type">I.Count</span><span> </span><span class="hs-special">(</span><a href="Matrix.Internal.html#FromNat"><span class="hs-identifier hs-type">I.FromNat</span></a><span> </span><a href="#local-6989586621679063571"><span class="hs-identifier hs-type">m</span></a><span class="hs-special">)</span><span> </span><span class="hs-operator">*</span><span> </span><a href="Matrix.Internal.html#Count"><span class="hs-identifier hs-type">I.Count</span></a><span> </span><span class="hs-special">(</span><a href="Matrix.Internal.html#FromNat"><span class="hs-identifier hs-type">I.FromNat</span></a><span> </span><a href="#local-6989586621679063573"><span class="hs-identifier hs-type">n</span></a><span class="hs-special">)</span><span class="hs-special">)</span><span class="hs-special">,</span><span>
427+</span><a name="line-427"></a><span> </span><span class="hs-identifier hs-type">I.FromNat</span><span> </span><span class="hs-special">(</span><span class="hs-identifier hs-type">p</span><span> </span><span class="hs-operator hs-type">*</span><span> </span><a href="#local-6989586621679063574"><span class="hs-identifier hs-type">q</span></a><span class="hs-special">)</span><span> </span><span class="hs-glyph">~</span><span> </span><a href="Matrix.Internal.html#FromNat"><span class="hs-identifier hs-type">I.FromNat</span></a><span> </span><span class="hs-special">(</span><span class="hs-identifier hs-type">I.Count</span><span> </span><span class="hs-special">(</span><a href="Matrix.Internal.html#FromNat"><span class="hs-identifier hs-type">I.FromNat</span></a><span> </span><a href="#local-6989586621679063572"><span class="hs-identifier hs-type">p</span></a><span class="hs-special">)</span><span> </span><span class="hs-operator">*</span><span> </span><a href="Matrix.Internal.html#Count"><span class="hs-identifier hs-type">I.Count</span></a><span> </span><span class="hs-special">(</span><a href="Matrix.Internal.html#FromNat"><span class="hs-identifier hs-type">I.FromNat</span></a><span> </span><a href="#local-6989586621679063574"><span class="hs-identifier hs-type">q</span></a><span class="hs-special">)</span><span class="hs-special">)</span><span>
428+</span><a name="line-428"></a><span> </span><span class="hs-special">)</span><span> </span><span class="hs-glyph">=&gt;</span><span> </span><a href="Matrix.Nat.html#Matrix"><span class="hs-identifier hs-type">Matrix</span></a><span> </span><a href="#local-6989586621679063570"><span class="hs-identifier hs-type">e</span></a><span> </span><a href="#local-6989586621679063571"><span class="hs-identifier hs-type">m</span></a><span> </span><a href="#local-6989586621679063572"><span class="hs-identifier hs-type">p</span></a><span> </span><span class="hs-glyph">-&gt;</span><span> </span><a href="Matrix.Nat.html#Matrix"><span class="hs-identifier hs-type">Matrix</span></a><span> </span><a href="#local-6989586621679063570"><span class="hs-identifier hs-type">e</span></a><span> </span><a href="#local-6989586621679063573"><span class="hs-identifier hs-type">n</span></a><span> </span><a href="#local-6989586621679063574"><span class="hs-identifier hs-type">q</span></a><span> </span><span class="hs-glyph">-&gt;</span><span> </span><a href="Matrix.Nat.html#Matrix"><span class="hs-identifier hs-type">Matrix</span></a><span> </span><a href="#local-6989586621679063570"><span class="hs-identifier hs-type">e</span></a><span> </span><span class="hs-special">(</span><span class="hs-identifier hs-type">m</span><span> </span><span class="hs-operator hs-type">*</span><span> </span><a href="#local-6989586621679063573"><span class="hs-identifier hs-type">n</span></a><span class="hs-special">)</span><span> </span><span class="hs-special">(</span><span class="hs-identifier hs-type">p</span><span> </span><span class="hs-operator hs-type">*</span><span> </span><a href="#local-6989586621679063574"><span class="hs-identifier hs-type">q</span></a><span class="hs-special">)</span><span>
429+</span><a name="line-429"></a><span class="hs-special">(</span><a name="%3E%3C"><a href="Matrix.Nat.html#%3E%3C"><span class="hs-operator">&gt;&lt;</span></a></a><span class="hs-special">)</span><span> </span><a name="local-6989586621679063687"><a href="#local-6989586621679063687"><span class="hs-identifier">a</span></a></a><span> </span><a name="local-6989586621679063688"><a href="#local-6989586621679063688"><span class="hs-identifier">b</span></a></a><span> </span><span class="hs-glyph">=</span><span>
430+</span><a name="line-430"></a><span> </span><span class="hs-keyword">let</span><span> </span><a name="local-6989586621679063689"><a href="#local-6989586621679063689"><span class="hs-identifier">kp1'</span></a></a><span> </span><span class="hs-glyph">=</span><span> </span><a href="Matrix.Nat.html#kp1"><span class="hs-identifier hs-var">kp1</span></a><span> </span><span class="hs-glyph">@</span><a href="#local-6989586621679063570"><span class="hs-identifier hs-type">e</span></a><span> </span><span class="hs-glyph">@</span><a href="#local-6989586621679063571"><span class="hs-identifier hs-type">m</span></a><span> </span><span class="hs-glyph">@</span><a href="#local-6989586621679063573"><span class="hs-identifier hs-type">n</span></a><span>
431+</span><a name="line-431"></a><span> </span><a name="local-6989586621679063690"><a href="#local-6989586621679063690"><span class="hs-identifier">kp2'</span></a></a><span> </span><span class="hs-glyph">=</span><span> </span><a href="Matrix.Nat.html#kp2"><span class="hs-identifier hs-var">kp2</span></a><span> </span><span class="hs-glyph">@</span><a href="#local-6989586621679063570"><span class="hs-identifier hs-type">e</span></a><span> </span><span class="hs-glyph">@</span><a href="#local-6989586621679063571"><span class="hs-identifier hs-type">m</span></a><span> </span><span class="hs-glyph">@</span><a href="#local-6989586621679063573"><span class="hs-identifier hs-type">n</span></a><span>
432+</span><a name="line-432"></a><span> </span><span class="hs-keyword">in</span><span> </span><a href="Matrix.Nat.html#khatri"><span class="hs-identifier hs-var">khatri</span></a><span> </span><span class="hs-special">(</span><a href="Matrix.Nat.html#comp"><span class="hs-identifier hs-var">comp</span></a><span> </span><a href="#local-6989586621679063687"><span class="hs-identifier hs-var">a</span></a><span> </span><a href="#local-6989586621679063689"><span class="hs-identifier hs-var">kp1'</span></a><span class="hs-special">)</span><span> </span><span class="hs-special">(</span><a href="Matrix.Nat.html#comp"><span class="hs-identifier hs-var">comp</span></a><span> </span><a href="#local-6989586621679063688"><span class="hs-identifier hs-var">b</span></a><span> </span><a href="#local-6989586621679063690"><span class="hs-identifier hs-var">kp2'</span></a><span class="hs-special">)</span><span>
433+</span><a name="line-433"></a><span>
434+</span><a name="line-434"></a><span class="hs-comment">-- Matrix abide Junc Split</span><span>
435+</span><a name="line-435"></a><span>
436+</span><a name="line-436"></a><span class="hs-identifier">abideJS</span><span> </span><span class="hs-glyph">::</span><span> </span><a href="Matrix.Nat.html#Matrix"><span class="hs-identifier hs-type">Matrix</span></a><span> </span><a href="#local-6989586621679063567"><span class="hs-identifier hs-type">e</span></a><span> </span><a href="#local-6989586621679063568"><span class="hs-identifier hs-type">cols</span></a><span> </span><a href="#local-6989586621679063569"><span class="hs-identifier hs-type">rows</span></a><span> </span><span class="hs-glyph">-&gt;</span><span> </span><a href="Matrix.Nat.html#Matrix"><span class="hs-identifier hs-type">Matrix</span></a><span> </span><a href="#local-6989586621679063567"><span class="hs-identifier hs-type">e</span></a><span> </span><a href="#local-6989586621679063568"><span class="hs-identifier hs-type">cols</span></a><span> </span><a href="#local-6989586621679063569"><span class="hs-identifier hs-type">rows</span></a><span>
437+</span><a name="line-437"></a><a name="abideJS"><a href="Matrix.Nat.html#abideJS"><span class="hs-identifier">abideJS</span></a></a><span> </span><span class="hs-special">(</span><a href="Matrix.Nat.html#M"><span class="hs-identifier hs-var">M</span></a><span> </span><a name="local-6989586621679063691"><a href="#local-6989586621679063691"><span class="hs-identifier">m</span></a></a><span class="hs-special">)</span><span> </span><span class="hs-glyph">=</span><span> </span><a href="Matrix.Nat.html#M"><span class="hs-identifier hs-var">M</span></a><span> </span><span class="hs-special">(</span><a href="Matrix.Internal.html#abideJS"><span class="hs-identifier hs-var">I.abideJS</span></a><span> </span><a href="#local-6989586621679063691"><span class="hs-identifier hs-var">m</span></a><span class="hs-special">)</span><span>
438+</span><a name="line-438"></a><span>
439+</span><a name="line-439"></a><span class="hs-comment">-- Matrix abide Split Junc</span><span>
440+</span><a name="line-440"></a><span>
441+</span><a name="line-441"></a><span class="hs-identifier">abideSJ</span><span> </span><span class="hs-glyph">::</span><span> </span><a href="Matrix.Nat.html#Matrix"><span class="hs-identifier hs-type">Matrix</span></a><span> </span><a href="#local-6989586621679063564"><span class="hs-identifier hs-type">e</span></a><span> </span><a href="#local-6989586621679063565"><span class="hs-identifier hs-type">cols</span></a><span> </span><a href="#local-6989586621679063566"><span class="hs-identifier hs-type">rows</span></a><span> </span><span class="hs-glyph">-&gt;</span><span> </span><a href="Matrix.Nat.html#Matrix"><span class="hs-identifier hs-type">Matrix</span></a><span> </span><a href="#local-6989586621679063564"><span class="hs-identifier hs-type">e</span></a><span> </span><a href="#local-6989586621679063565"><span class="hs-identifier hs-type">cols</span></a><span> </span><a href="#local-6989586621679063566"><span class="hs-identifier hs-type">rows</span></a><span>
442+</span><a name="line-442"></a><a name="abideSJ"><a href="Matrix.Nat.html#abideSJ"><span class="hs-identifier">abideSJ</span></a></a><span> </span><span class="hs-special">(</span><a href="Matrix.Nat.html#M"><span class="hs-identifier hs-var">M</span></a><span> </span><a name="local-6989586621679063692"><a href="#local-6989586621679063692"><span class="hs-identifier">m</span></a></a><span class="hs-special">)</span><span> </span><span class="hs-glyph">=</span><span> </span><a href="Matrix.Nat.html#M"><span class="hs-identifier hs-var">M</span></a><span> </span><span class="hs-special">(</span><a href="Matrix.Internal.html#abideSJ"><span class="hs-identifier hs-var">I.abideSJ</span></a><span> </span><a href="#local-6989586621679063692"><span class="hs-identifier hs-var">m</span></a><span class="hs-special">)</span><span>
443+</span><a name="line-443"></a><span>
444+</span><a name="line-444"></a><span class="hs-comment">-- Matrix transposition</span><span>
445+</span><a name="line-445"></a><span>
446+</span><a name="line-446"></a><span class="hs-identifier">tr</span><span> </span><span class="hs-glyph">::</span><span> </span><a href="Matrix.Nat.html#Matrix"><span class="hs-identifier hs-type">Matrix</span></a><span> </span><a href="#local-6989586621679063561"><span class="hs-identifier hs-type">e</span></a><span> </span><a href="#local-6989586621679063562"><span class="hs-identifier hs-type">cols</span></a><span> </span><a href="#local-6989586621679063563"><span class="hs-identifier hs-type">rows</span></a><span> </span><span class="hs-glyph">-&gt;</span><span> </span><a href="Matrix.Nat.html#Matrix"><span class="hs-identifier hs-type">Matrix</span></a><span> </span><a href="#local-6989586621679063561"><span class="hs-identifier hs-type">e</span></a><span> </span><a href="#local-6989586621679063563"><span class="hs-identifier hs-type">rows</span></a><span> </span><a href="#local-6989586621679063562"><span class="hs-identifier hs-type">cols</span></a><span>
447+</span><a name="line-447"></a><a name="tr"><a href="Matrix.Nat.html#tr"><span class="hs-identifier">tr</span></a></a><span> </span><span class="hs-special">(</span><a href="Matrix.Nat.html#M"><span class="hs-identifier hs-var">M</span></a><span> </span><a name="local-6989586621679063693"><a href="#local-6989586621679063693"><span class="hs-identifier">m</span></a></a><span class="hs-special">)</span><span> </span><span class="hs-glyph">=</span><span> </span><a href="Matrix.Nat.html#M"><span class="hs-identifier hs-var">M</span></a><span> </span><span class="hs-special">(</span><a href="Matrix.Internal.html#tr"><span class="hs-identifier hs-var">I.tr</span></a><span> </span><a href="#local-6989586621679063693"><span class="hs-identifier hs-var">m</span></a><span class="hs-special">)</span><span>
448+</span><a name="line-448"></a><span>
449+</span><a name="line-449"></a><span class="hs-comment">-- Selective 'select' operator</span><span>
450+</span><a name="line-450"></a><span class="hs-identifier">select</span><span> </span><span class="hs-glyph">::</span><span>
451+</span><a name="line-451"></a><span> </span><span class="hs-special">(</span><span> </span><span class="hs-identifier hs-type">Num</span><span> </span><a href="#local-6989586621679063554"><span class="hs-identifier hs-type">e</span></a><span class="hs-special">,</span><span>
452+</span><a name="line-452"></a><span> </span><a href="Matrix.Internal.html#FromLists"><span class="hs-identifier hs-type">I.FromLists</span></a><span> </span><a href="#local-6989586621679063554"><span class="hs-identifier hs-type">e</span></a><span> </span><span class="hs-special">(</span><a href="Matrix.Internal.html#FromNat"><span class="hs-identifier hs-type">I.FromNat</span></a><span> </span><a href="#local-6989586621679063555"><span class="hs-identifier hs-type">rows1</span></a><span class="hs-special">)</span><span> </span><span class="hs-special">(</span><a href="Matrix.Internal.html#FromNat"><span class="hs-identifier hs-type">I.FromNat</span></a><span> </span><a href="#local-6989586621679063555"><span class="hs-identifier hs-type">rows1</span></a><span class="hs-special">)</span><span class="hs-special">,</span><span>
453+</span><a name="line-453"></a><span> </span><span class="hs-identifier hs-type">KnownNat</span><span> </span><span class="hs-special">(</span><a href="Matrix.Internal.html#Count"><span class="hs-identifier hs-type">I.Count</span></a><span> </span><span class="hs-special">(</span><a href="Matrix.Internal.html#FromNat"><span class="hs-identifier hs-type">I.FromNat</span></a><span> </span><a href="#local-6989586621679063555"><span class="hs-identifier hs-type">rows1</span></a><span class="hs-special">)</span><span class="hs-special">)</span><span class="hs-special">,</span><span>
454+</span><a name="line-454"></a><span> </span><span class="hs-identifier hs-type">I.FromNat</span><span> </span><a href="#local-6989586621679063556"><span class="hs-identifier hs-type">rows2</span></a><span> </span><span class="hs-glyph">~</span><span> </span><a href="Matrix.Internal.html#FromNat"><span class="hs-identifier hs-type">I.FromNat</span></a><span> </span><a href="#local-6989586621679063555"><span class="hs-identifier hs-type">rows1</span></a><span class="hs-special">,</span><span>
455+</span><a name="line-455"></a><span> </span><span class="hs-identifier hs-type">I.FromNat</span><span> </span><a href="#local-6989586621679063557"><span class="hs-identifier hs-type">cols1</span></a><span> </span><span class="hs-glyph">~</span><span> </span><a href="Matrix.Internal.html#FromNat"><span class="hs-identifier hs-type">I.FromNat</span></a><span> </span><a href="#local-6989586621679063558"><span class="hs-identifier hs-type">cols2</span></a><span class="hs-special">,</span><span>
456+</span><a name="line-456"></a><span> </span><span class="hs-identifier hs-type">I.FromNat</span><span> </span><a href="#local-6989586621679063559"><span class="hs-identifier hs-type">rows3</span></a><span> </span><span class="hs-glyph">~</span><span> </span><span class="hs-identifier hs-type">Either</span><span> </span><span class="hs-special">(</span><a href="Matrix.Internal.html#FromNat"><span class="hs-identifier hs-type">I.FromNat</span></a><span> </span><a href="#local-6989586621679063560"><span class="hs-identifier hs-type">cols3</span></a><span class="hs-special">)</span><span> </span><span class="hs-special">(</span><a href="Matrix.Internal.html#FromNat"><span class="hs-identifier hs-type">I.FromNat</span></a><span> </span><a href="#local-6989586621679063555"><span class="hs-identifier hs-type">rows1</span></a><span class="hs-special">)</span><span>
457+</span><a name="line-457"></a><span> </span><span class="hs-special">)</span><span> </span><span class="hs-glyph">=&gt;</span><span> </span><a href="Matrix.Nat.html#Matrix"><span class="hs-identifier hs-type">Matrix</span></a><span> </span><a href="#local-6989586621679063554"><span class="hs-identifier hs-type">e</span></a><span> </span><a href="#local-6989586621679063557"><span class="hs-identifier hs-type">cols1</span></a><span> </span><a href="#local-6989586621679063559"><span class="hs-identifier hs-type">rows3</span></a><span> </span><span class="hs-glyph">-&gt;</span><span> </span><a href="Matrix.Nat.html#Matrix"><span class="hs-identifier hs-type">Matrix</span></a><span> </span><a href="#local-6989586621679063554"><span class="hs-identifier hs-type">e</span></a><span> </span><a href="#local-6989586621679063560"><span class="hs-identifier hs-type">cols3</span></a><span> </span><a href="#local-6989586621679063555"><span class="hs-identifier hs-type">rows1</span></a><span> </span><span class="hs-glyph">-&gt;</span><span> </span><a href="Matrix.Nat.html#Matrix"><span class="hs-identifier hs-type">Matrix</span></a><span> </span><a href="#local-6989586621679063554"><span class="hs-identifier hs-type">e</span></a><span> </span><a href="#local-6989586621679063558"><span class="hs-identifier hs-type">cols2</span></a><span> </span><a href="#local-6989586621679063556"><span class="hs-identifier hs-type">rows2</span></a><span>
458+</span><a name="line-458"></a><a name="select"><a href="Matrix.Nat.html#select"><span class="hs-identifier">select</span></a></a><span> </span><span class="hs-special">(</span><a href="Matrix.Nat.html#M"><span class="hs-identifier hs-var">M</span></a><span> </span><a name="local-6989586621679063694"><a href="#local-6989586621679063694"><span class="hs-identifier">m</span></a></a><span class="hs-special">)</span><span> </span><span class="hs-special">(</span><a href="Matrix.Nat.html#M"><span class="hs-identifier hs-var">M</span></a><span> </span><a name="local-6989586621679063695"><a href="#local-6989586621679063695"><span class="hs-identifier">y</span></a></a><span class="hs-special">)</span><span> </span><span class="hs-glyph">=</span><span> </span><a href="Matrix.Nat.html#M"><span class="hs-identifier hs-var">M</span></a><span> </span><span class="hs-special">(</span><a href="Matrix.Internal.html#select"><span class="hs-identifier hs-var">I.select</span></a><span> </span><a href="#local-6989586621679063694"><span class="hs-identifier hs-var">m</span></a><span> </span><a href="#local-6989586621679063695"><span class="hs-identifier hs-var">y</span></a><span class="hs-special">)</span><span>
459+</span><a name="line-459"></a><span>
460+</span><a name="line-460"></a><span class="hs-comment">-- McCarthy's Conditional</span><span>
461+</span><a name="line-461"></a><span>
462+</span><a name="line-462"></a><span class="hs-identifier">cond</span><span> </span><span class="hs-glyph">::</span><span>
463+</span><a name="line-463"></a><span> </span><span class="hs-special">(</span><span> </span><span class="hs-identifier hs-type">I.FromNat</span><span> </span><span class="hs-special">(</span><a href="Matrix.Internal.html#Count"><span class="hs-identifier hs-type">I.Count</span></a><span> </span><span class="hs-special">(</span><a href="Matrix.Internal.html#FromNat"><span class="hs-identifier hs-type">I.FromNat</span></a><span> </span><a href="#local-6989586621679063550"><span class="hs-identifier hs-type">cols</span></a><span class="hs-special">)</span><span class="hs-special">)</span><span> </span><span class="hs-glyph">~</span><span> </span><a href="Matrix.Internal.html#FromNat"><span class="hs-identifier hs-type">I.FromNat</span></a><span> </span><a href="#local-6989586621679063550"><span class="hs-identifier hs-type">cols</span></a><span class="hs-special">,</span><span>
464+</span><a name="line-464"></a><span> </span><span class="hs-identifier hs-type">KnownNat</span><span> </span><span class="hs-special">(</span><a href="Matrix.Internal.html#Count"><span class="hs-identifier hs-type">I.Count</span></a><span> </span><span class="hs-special">(</span><a href="Matrix.Internal.html#FromNat"><span class="hs-identifier hs-type">I.FromNat</span></a><span> </span><a href="#local-6989586621679063550"><span class="hs-identifier hs-type">cols</span></a><span class="hs-special">)</span><span class="hs-special">)</span><span class="hs-special">,</span><span>
465+</span><a name="line-465"></a><span> </span><a href="Matrix.Internal.html#FromLists"><span class="hs-identifier hs-type">I.FromLists</span></a><span> </span><a href="#local-6989586621679063551"><span class="hs-identifier hs-type">e</span></a><span> </span><span class="hs-special">(</span><span class="hs-special">)</span><span> </span><span class="hs-special">(</span><a href="Matrix.Internal.html#FromNat"><span class="hs-identifier hs-type">I.FromNat</span></a><span> </span><a href="#local-6989586621679063550"><span class="hs-identifier hs-type">cols</span></a><span class="hs-special">)</span><span class="hs-special">,</span><span>
466+</span><a name="line-466"></a><span> </span><a href="Matrix.Internal.html#FromLists"><span class="hs-identifier hs-type">I.FromLists</span></a><span> </span><a href="#local-6989586621679063551"><span class="hs-identifier hs-type">e</span></a><span> </span><span class="hs-special">(</span><a href="Matrix.Internal.html#FromNat"><span class="hs-identifier hs-type">I.FromNat</span></a><span> </span><a href="#local-6989586621679063550"><span class="hs-identifier hs-type">cols</span></a><span class="hs-special">)</span><span> </span><span class="hs-special">(</span><span class="hs-special">)</span><span class="hs-special">,</span><span>
467+</span><a name="line-467"></a><span> </span><a href="Matrix.Internal.html#FromLists"><span class="hs-identifier hs-type">I.FromLists</span></a><span> </span><a href="#local-6989586621679063551"><span class="hs-identifier hs-type">e</span></a><span> </span><span class="hs-special">(</span><a href="Matrix.Internal.html#FromNat"><span class="hs-identifier hs-type">I.FromNat</span></a><span> </span><a href="#local-6989586621679063550"><span class="hs-identifier hs-type">cols</span></a><span class="hs-special">)</span><span> </span><span class="hs-special">(</span><a href="Matrix.Internal.html#FromNat"><span class="hs-identifier hs-type">I.FromNat</span></a><span> </span><a href="#local-6989586621679063550"><span class="hs-identifier hs-type">cols</span></a><span class="hs-special">)</span><span class="hs-special">,</span><span>
468+</span><a name="line-468"></a><span> </span><span class="hs-identifier hs-type">Bounded</span><span> </span><a href="#local-6989586621679063552"><span class="hs-identifier hs-type">a</span></a><span class="hs-special">,</span><span>
469+</span><a name="line-469"></a><span> </span><span class="hs-identifier hs-type">Enum</span><span> </span><a href="#local-6989586621679063552"><span class="hs-identifier hs-type">a</span></a><span class="hs-special">,</span><span>
470+</span><a name="line-470"></a><span> </span><span class="hs-identifier hs-type">Num</span><span> </span><a href="#local-6989586621679063551"><span class="hs-identifier hs-type">e</span></a><span class="hs-special">,</span><span>
471+</span><a name="line-471"></a><span> </span><span class="hs-identifier hs-type">Ord</span><span> </span><a href="#local-6989586621679063551"><span class="hs-identifier hs-type">e</span></a><span>
472+</span><a name="line-472"></a><span> </span><span class="hs-special">)</span><span>
473+</span><a name="line-473"></a><span> </span><span class="hs-glyph">=&gt;</span><span>
474+</span><a name="line-474"></a><span> </span><span class="hs-special">(</span><a href="#local-6989586621679063552"><span class="hs-identifier hs-type">a</span></a><span> </span><span class="hs-glyph">-&gt;</span><span> </span><span class="hs-identifier hs-type">Bool</span><span class="hs-special">)</span><span> </span><span class="hs-glyph">-&gt;</span><span> </span><a href="Matrix.Nat.html#Matrix"><span class="hs-identifier hs-type">Matrix</span></a><span> </span><a href="#local-6989586621679063551"><span class="hs-identifier hs-type">e</span></a><span> </span><a href="#local-6989586621679063550"><span class="hs-identifier hs-type">cols</span></a><span> </span><a href="#local-6989586621679063553"><span class="hs-identifier hs-type">rows</span></a><span> </span><span class="hs-glyph">-&gt;</span><span> </span><a href="Matrix.Nat.html#Matrix"><span class="hs-identifier hs-type">Matrix</span></a><span> </span><a href="#local-6989586621679063551"><span class="hs-identifier hs-type">e</span></a><span> </span><a href="#local-6989586621679063550"><span class="hs-identifier hs-type">cols</span></a><span> </span><a href="#local-6989586621679063553"><span class="hs-identifier hs-type">rows</span></a><span> </span><span class="hs-glyph">-&gt;</span><span> </span><a href="Matrix.Nat.html#Matrix"><span class="hs-identifier hs-type">Matrix</span></a><span> </span><a href="#local-6989586621679063551"><span class="hs-identifier hs-type">e</span></a><span> </span><a href="#local-6989586621679063550"><span class="hs-identifier hs-type">cols</span></a><span> </span><a href="#local-6989586621679063553"><span class="hs-identifier hs-type">rows</span></a><span>
475+</span><a name="line-475"></a><a name="cond"><a href="Matrix.Nat.html#cond"><span class="hs-identifier">cond</span></a></a><span> </span><a name="local-6989586621679063696"><a href="#local-6989586621679063696"><span class="hs-identifier">p</span></a></a><span> </span><span class="hs-special">(</span><a href="Matrix.Nat.html#M"><span class="hs-identifier hs-var">M</span></a><span> </span><a name="local-6989586621679063697"><a href="#local-6989586621679063697"><span class="hs-identifier">a</span></a></a><span class="hs-special">)</span><span> </span><span class="hs-special">(</span><a href="Matrix.Nat.html#M"><span class="hs-identifier hs-var">M</span></a><span> </span><a name="local-6989586621679063698"><a href="#local-6989586621679063698"><span class="hs-identifier">b</span></a></a><span class="hs-special">)</span><span> </span><span class="hs-glyph">=</span><span> </span><a href="Matrix.Nat.html#M"><span class="hs-identifier hs-var">M</span></a><span> </span><span class="hs-special">(</span><a href="Matrix.Internal.html#cond"><span class="hs-identifier hs-var">I.cond</span></a><span> </span><a href="#local-6989586621679063696"><span class="hs-identifier hs-var">p</span></a><span> </span><a href="#local-6989586621679063697"><span class="hs-identifier hs-var">a</span></a><span> </span><a href="#local-6989586621679063698"><span class="hs-identifier hs-var">b</span></a><span class="hs-special">)</span><span>
476+</span><a name="line-476"></a><span>
477+</span><a name="line-477"></a><span class="hs-comment">-- Pretty print</span><span>
478+</span><a name="line-478"></a><span>
479+</span><a name="line-479"></a><span class="hs-identifier">pretty</span><span> </span><span class="hs-glyph">::</span><span> </span><span class="hs-special">(</span><span class="hs-identifier hs-type">KnownNat</span><span> </span><span class="hs-special">(</span><a href="Matrix.Internal.html#Count"><span class="hs-identifier hs-type">I.Count</span></a><span> </span><span class="hs-special">(</span><a href="Matrix.Internal.html#FromNat"><span class="hs-identifier hs-type">I.FromNat</span></a><span> </span><a href="#local-6989586621679063547"><span class="hs-identifier hs-type">cols</span></a><span class="hs-special">)</span><span class="hs-special">)</span><span class="hs-special">,</span><span> </span><span class="hs-identifier hs-type">Show</span><span> </span><a href="#local-6989586621679063548"><span class="hs-identifier hs-type">e</span></a><span class="hs-special">)</span><span> </span><span class="hs-glyph">=&gt;</span><span> </span><a href="Matrix.Nat.html#Matrix"><span class="hs-identifier hs-type">Matrix</span></a><span> </span><a href="#local-6989586621679063548"><span class="hs-identifier hs-type">e</span></a><span> </span><a href="#local-6989586621679063547"><span class="hs-identifier hs-type">cols</span></a><span> </span><a href="#local-6989586621679063549"><span class="hs-identifier hs-type">rows</span></a><span> </span><span class="hs-glyph">-&gt;</span><span> </span><span class="hs-identifier hs-type">String</span><span>
480+</span><a name="line-480"></a><a name="pretty"><a href="Matrix.Nat.html#pretty"><span class="hs-identifier">pretty</span></a></a><span> </span><span class="hs-special">(</span><a href="Matrix.Nat.html#M"><span class="hs-identifier hs-var">M</span></a><span> </span><a name="local-6989586621679063699"><a href="#local-6989586621679063699"><span class="hs-identifier">m</span></a></a><span class="hs-special">)</span><span> </span><span class="hs-glyph">=</span><span> </span><a href="Matrix.Internal.html#pretty"><span class="hs-identifier hs-var">I.pretty</span></a><span> </span><a href="#local-6989586621679063699"><span class="hs-identifier hs-var">m</span></a><span>
481+</span><a name="line-481"></a><span>
482+</span><a name="line-482"></a><span class="hs-identifier">prettyPrint</span><span> </span><span class="hs-glyph">::</span><span> </span><span class="hs-special">(</span><span class="hs-identifier hs-type">KnownNat</span><span> </span><span class="hs-special">(</span><a href="Matrix.Internal.html#Count"><span class="hs-identifier hs-type">I.Count</span></a><span> </span><span class="hs-special">(</span><a href="Matrix.Internal.html#FromNat"><span class="hs-identifier hs-type">I.FromNat</span></a><span> </span><a href="#local-6989586621679063544"><span class="hs-identifier hs-type">cols</span></a><span class="hs-special">)</span><span class="hs-special">)</span><span class="hs-special">,</span><span> </span><span class="hs-identifier hs-type">Show</span><span> </span><a href="#local-6989586621679063545"><span class="hs-identifier hs-type">e</span></a><span class="hs-special">)</span><span> </span><span class="hs-glyph">=&gt;</span><span> </span><a href="Matrix.Nat.html#Matrix"><span class="hs-identifier hs-type">Matrix</span></a><span> </span><a href="#local-6989586621679063545"><span class="hs-identifier hs-type">e</span></a><span> </span><a href="#local-6989586621679063544"><span class="hs-identifier hs-type">cols</span></a><span> </span><a href="#local-6989586621679063546"><span class="hs-identifier hs-type">rows</span></a><span> </span><span class="hs-glyph">-&gt;</span><span> </span><span class="hs-identifier hs-type">IO</span><span> </span><span class="hs-special">(</span><span class="hs-special">)</span><span>
483+</span><a name="line-483"></a><a name="prettyPrint"><a href="Matrix.Nat.html#prettyPrint"><span class="hs-identifier">prettyPrint</span></a></a><span> </span><span class="hs-special">(</span><a href="Matrix.Nat.html#M"><span class="hs-identifier hs-var">M</span></a><span> </span><a name="local-6989586621679063700"><a href="#local-6989586621679063700"><span class="hs-identifier">m</span></a></a><span class="hs-special">)</span><span> </span><span class="hs-glyph">=</span><span> </span><a href="Matrix.Internal.html#prettyPrint"><span class="hs-identifier hs-var">I.prettyPrint</span></a><span> </span><a href="#local-6989586621679063700"><span class="hs-identifier hs-var">m</span></a><span>
484+</span><a name="line-484"></a></pre></body></html>
build/x86_64-linux/ghc-8.6.5/laop-0.1.0.0/doc/html/laop-0.1.0.0-docs/src/Matrix.Type.htmlnew file+648
@@ -0,0 +1,648 @@
1+<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"><html xmlns="http://www.w3.org/1999/xhtml"><head><link rel="stylesheet" type="text/css" href="style.css" /><script type="text/javascript" src="highlight.js"></script></head><body><pre><span class="hs-pragma">{-# LANGUAGE AllowAmbiguousTypes #-}</span><span>
2+</span><a name="line-2"></a><span class="hs-pragma">{-# LANGUAGE DataKinds #-}</span><span>
3+</span><a name="line-3"></a><span class="hs-pragma">{-# LANGUAGE DerivingVia #-}</span><span>
4+</span><a name="line-4"></a><span class="hs-pragma">{-# LANGUAGE FlexibleContexts #-}</span><span>
5+</span><a name="line-5"></a><span class="hs-pragma">{-# LANGUAGE FlexibleInstances #-}</span><span>
6+</span><a name="line-6"></a><span class="hs-pragma">{-# LANGUAGE GADTs #-}</span><span>
7+</span><a name="line-7"></a><span class="hs-pragma">{-# LANGUAGE KindSignatures #-}</span><span>
8+</span><a name="line-8"></a><span class="hs-pragma">{-# LANGUAGE MultiParamTypeClasses #-}</span><span>
9+</span><a name="line-9"></a><span class="hs-pragma">{-# LANGUAGE NoStarIsType #-}</span><span>
10+</span><a name="line-10"></a><span class="hs-pragma">{-# LANGUAGE RankNTypes #-}</span><span>
11+</span><a name="line-11"></a><span class="hs-pragma">{-# LANGUAGE ScopedTypeVariables #-}</span><span>
12+</span><a name="line-12"></a><span class="hs-pragma">{-# LANGUAGE TypeApplications #-}</span><span>
13+</span><a name="line-13"></a><span class="hs-pragma">{-# LANGUAGE TypeOperators #-}</span><span>
14+</span><a name="line-14"></a><span class="hs-pragma">{-# LANGUAGE UndecidableInstances #-}</span><span>
15+</span><a name="line-15"></a><span>
16+</span><a name="line-16"></a><span class="hs-comment">-----------------------------------------------------------------------------</span><span>
17+</span><a name="line-17"></a><span class="hs-comment">-- |</span><span>
18+</span><a name="line-18"></a><span class="hs-comment">-- Module : Matrix.Type</span><span>
19+</span><a name="line-19"></a><span class="hs-comment">-- Copyright : (c) Armando Santos 2019-2020</span><span>
20+</span><a name="line-20"></a><span class="hs-comment">-- Maintainer : armandoifsantos@gmail.com</span><span>
21+</span><a name="line-21"></a><span class="hs-comment">-- Stability : experimental</span><span>
22+</span><a name="line-22"></a><span class="hs-comment">--</span><span>
23+</span><a name="line-23"></a><span class="hs-comment">-- The LAoP discipline generalises relations and functions treating them as</span><span>
24+</span><a name="line-24"></a><span class="hs-comment">-- Boolean matrices and in turn consider these as arrows.</span><span>
25+</span><a name="line-25"></a><span class="hs-comment">--</span><span>
26+</span><a name="line-26"></a><span class="hs-comment">-- __LAoP__ is a library for algebraic (inductive) construction and manipulation of matrices</span><span>
27+</span><a name="line-27"></a><span class="hs-comment">-- in Haskell. See &lt;https://github.com/bolt12/master-thesis my Msc Thesis&gt; for the</span><span>
28+</span><a name="line-28"></a><span class="hs-comment">-- motivation behind the library, the underlying theory, and implementation details.</span><span>
29+</span><a name="line-29"></a><span class="hs-comment">--</span><span>
30+</span><a name="line-30"></a><span class="hs-comment">-- This module offers a newtype wrapper around 'Matrix.Type.Matrix' that</span><span>
31+</span><a name="line-31"></a><span class="hs-comment">-- uses arbitrary types instead of canonical data types for the matrices</span><span>
32+</span><a name="line-32"></a><span class="hs-comment">-- dimensions.</span><span>
33+</span><a name="line-33"></a><span class="hs-comment">--</span><span>
34+</span><a name="line-34"></a><span class="hs-comment">-- __NOTE__: If the types in the dimensions are custom they must need to</span><span>
35+</span><a name="line-35"></a><span class="hs-comment">-- implement a 'Generic' instance.</span><span>
36+</span><a name="line-36"></a><span class="hs-comment">--</span><span>
37+</span><a name="line-37"></a><span class="hs-comment">-----------------------------------------------------------------------------</span><span>
38+</span><a name="line-38"></a><span>
39+</span><a name="line-39"></a><span class="hs-keyword">module</span><span> </span><span class="hs-identifier">Matrix.Type</span><span>
40+</span><a name="line-40"></a><span> </span><span class="hs-special">(</span><span> </span><span class="hs-comment">-- | LAoP (Linear Algebra of Programming) Inductive Matrix definition.</span><span>
41+</span><a name="line-41"></a><span> </span><span class="hs-comment">--</span><span>
42+</span><a name="line-42"></a><span> </span><span class="hs-comment">-- LAoP generalises relations and functions treating them as</span><span>
43+</span><a name="line-43"></a><span> </span><span class="hs-comment">-- Boolean matrices and in turn consider these as arrows.</span><span>
44+</span><a name="line-44"></a><span> </span><span class="hs-comment">-- This library offers many of the combinators mentioned in the work of</span><span>
45+</span><a name="line-45"></a><span> </span><span class="hs-comment">-- Macedo (2012) and Oliveira (2012).</span><span>
46+</span><a name="line-46"></a><span> </span><span class="hs-comment">--</span><span>
47+</span><a name="line-47"></a><span> </span><span class="hs-comment">-- This definition is a wrapper around 'Matrix.Type' but</span><span>
48+</span><a name="line-48"></a><span> </span><span class="hs-comment">-- dimensions are arbitrary data types. Type inference might not</span><span>
49+</span><a name="line-49"></a><span> </span><span class="hs-comment">-- be as desired.</span><span>
50+</span><a name="line-50"></a><span>
51+</span><a name="line-51"></a><span> </span><span class="hs-comment">-- __NOTE__: If the types in the dimensions are custom they must need to</span><span>
52+</span><a name="line-52"></a><span> </span><span class="hs-comment">-- implement a 'Generic' instance.</span><span>
53+</span><a name="line-53"></a><span> </span><span class="hs-comment">--</span><span>
54+</span><a name="line-54"></a><span>
55+</span><a name="line-55"></a><span> </span><span class="hs-comment">-- * Type safe matrix representation</span><span>
56+</span><a name="line-56"></a><span> </span><a href="Matrix.Type.html#Matrix"><span class="hs-identifier hs-type">Matrix</span></a><span> </span><span class="hs-special">(</span><span class="hs-glyph">..</span><span class="hs-special">)</span><span class="hs-special">,</span><span>
57+</span><a name="line-57"></a><span>
58+</span><a name="line-58"></a><span> </span><span class="hs-comment">-- * Type aliases</span><span>
59+</span><a name="line-59"></a><span> </span><a href="Matrix.Type.html#Zero"><span class="hs-identifier hs-type">Zero</span></a><span class="hs-special">,</span><span>
60+</span><a name="line-60"></a><span> </span><a href="Matrix.Type.html#One"><span class="hs-identifier hs-type">One</span></a><span class="hs-special">,</span><span>
61+</span><a name="line-61"></a><span>
62+</span><a name="line-62"></a><span> </span><span class="hs-comment">-- * Primitives</span><span>
63+</span><a name="line-63"></a><span> </span><a href="Matrix.Type.html#empty"><span class="hs-identifier hs-var">empty</span></a><span class="hs-special">,</span><span>
64+</span><a name="line-64"></a><span> </span><a href="Matrix.Type.html#one"><span class="hs-identifier hs-var">one</span></a><span class="hs-special">,</span><span>
65+</span><a name="line-65"></a><span> </span><a href="Matrix.Type.html#junc"><span class="hs-identifier hs-var">junc</span></a><span class="hs-special">,</span><span>
66+</span><a name="line-66"></a><span> </span><a href="Matrix.Type.html#split"><span class="hs-identifier hs-var">split</span></a><span class="hs-special">,</span><span>
67+</span><a name="line-67"></a><span>
68+</span><a name="line-68"></a><span> </span><span class="hs-comment">-- * Auxiliary type families</span><span>
69+</span><a name="line-69"></a><span> </span><a href="Matrix.Internal.html#FromNat"><span class="hs-identifier hs-type">I.FromNat</span></a><span class="hs-special">,</span><span>
70+</span><a name="line-70"></a><span> </span><a href="Matrix.Internal.html#Count"><span class="hs-identifier hs-type">I.Count</span></a><span class="hs-special">,</span><span>
71+</span><a name="line-71"></a><span> </span><a href="Matrix.Internal.html#Normalize"><span class="hs-identifier hs-type">I.Normalize</span></a><span class="hs-special">,</span><span>
72+</span><a name="line-72"></a><span>
73+</span><a name="line-73"></a><span> </span><span class="hs-comment">-- * Matrix construction and conversion</span><span>
74+</span><a name="line-74"></a><span> </span><a href="Matrix.Internal.html#FromLists"><span class="hs-identifier hs-type">I.FromLists</span></a><span class="hs-special">,</span><span>
75+</span><a name="line-75"></a><span> </span><a href="Matrix.Type.html#fromLists"><span class="hs-identifier hs-var">fromLists</span></a><span class="hs-special">,</span><span>
76+</span><a name="line-76"></a><span> </span><a href="Matrix.Type.html#toLists"><span class="hs-identifier hs-var">toLists</span></a><span class="hs-special">,</span><span>
77+</span><a name="line-77"></a><span> </span><a href="Matrix.Type.html#toList"><span class="hs-identifier hs-var">toList</span></a><span class="hs-special">,</span><span>
78+</span><a name="line-78"></a><span> </span><a href="Matrix.Type.html#matrixBuilder"><span class="hs-identifier hs-var">matrixBuilder</span></a><span class="hs-special">,</span><span>
79+</span><a name="line-79"></a><span> </span><a href="Matrix.Type.html#row"><span class="hs-identifier hs-var">row</span></a><span class="hs-special">,</span><span>
80+</span><a name="line-80"></a><span> </span><a href="Matrix.Type.html#col"><span class="hs-identifier hs-var">col</span></a><span class="hs-special">,</span><span>
81+</span><a name="line-81"></a><span> </span><a href="Matrix.Type.html#zeros"><span class="hs-identifier hs-var">zeros</span></a><span class="hs-special">,</span><span>
82+</span><a name="line-82"></a><span> </span><a href="Matrix.Type.html#ones"><span class="hs-identifier hs-var">ones</span></a><span class="hs-special">,</span><span>
83+</span><a name="line-83"></a><span> </span><a href="Matrix.Type.html#bang"><span class="hs-identifier hs-var">bang</span></a><span class="hs-special">,</span><span>
84+</span><a name="line-84"></a><span> </span><a href="Matrix.Type.html#constant"><span class="hs-identifier hs-var">constant</span></a><span class="hs-special">,</span><span>
85+</span><a name="line-85"></a><span>
86+</span><a name="line-86"></a><span> </span><span class="hs-comment">-- * Functor instance equivalent function</span><span>
87+</span><a name="line-87"></a><span> </span><a href="Matrix.Type.html#fmapM"><span class="hs-identifier hs-var">fmapM</span></a><span class="hs-special">,</span><span>
88+</span><a name="line-88"></a><span>
89+</span><a name="line-89"></a><span> </span><span class="hs-comment">-- * Applicative/Monoidal instance equivalent functions</span><span>
90+</span><a name="line-90"></a><span> </span><a href="Matrix.Type.html#unitM"><span class="hs-identifier hs-var">unitM</span></a><span class="hs-special">,</span><span>
91+</span><a name="line-91"></a><span> </span><a href="Matrix.Type.html#multM"><span class="hs-identifier hs-var">multM</span></a><span class="hs-special">,</span><span>
92+</span><a name="line-92"></a><span>
93+</span><a name="line-93"></a><span> </span><span class="hs-comment">-- * Selective equivalent instance function</span><span>
94+</span><a name="line-94"></a><span> </span><a href="Matrix.Type.html#selectM"><span class="hs-identifier hs-var">selectM</span></a><span class="hs-special">,</span><span>
95+</span><a name="line-95"></a><span>
96+</span><a name="line-96"></a><span> </span><span class="hs-comment">-- * Monad equivalent instance function</span><span>
97+</span><a name="line-97"></a><span> </span><a href="Matrix.Type.html#returnM"><span class="hs-identifier hs-var">returnM</span></a><span class="hs-special">,</span><span>
98+</span><a name="line-98"></a><span> </span><a href="Matrix.Type.html#bindM"><span class="hs-identifier hs-var">bindM</span></a><span class="hs-special">,</span><span>
99+</span><a name="line-99"></a><span>
100+</span><a name="line-100"></a><span> </span><span class="hs-comment">-- * Misc</span><span>
101+</span><a name="line-101"></a><span> </span><span class="hs-comment">-- ** Get dimensions</span><span>
102+</span><a name="line-102"></a><span> </span><a href="Matrix.Type.html#columns"><span class="hs-identifier hs-var">columns</span></a><span class="hs-special">,</span><span>
103+</span><a name="line-103"></a><span> </span><a href="Matrix.Type.html#rows"><span class="hs-identifier hs-var">rows</span></a><span class="hs-special">,</span><span>
104+</span><a name="line-104"></a><span>
105+</span><a name="line-105"></a><span> </span><span class="hs-comment">-- ** Matrix Transposition</span><span>
106+</span><a name="line-106"></a><span> </span><a href="Matrix.Type.html#tr"><span class="hs-identifier hs-var">tr</span></a><span class="hs-special">,</span><span>
107+</span><a name="line-107"></a><span>
108+</span><a name="line-108"></a><span> </span><span class="hs-comment">-- ** McCarthy's Conditional</span><span>
109+</span><a name="line-109"></a><span> </span><a href="Matrix.Type.html#cond"><span class="hs-identifier hs-var">cond</span></a><span class="hs-special">,</span><span>
110+</span><a name="line-110"></a><span>
111+</span><a name="line-111"></a><span> </span><span class="hs-comment">-- ** Matrix &quot;abiding&quot;</span><span>
112+</span><a name="line-112"></a><span> </span><a href="Matrix.Type.html#abideJS"><span class="hs-identifier hs-var">abideJS</span></a><span class="hs-special">,</span><span>
113+</span><a name="line-113"></a><span> </span><a href="Matrix.Type.html#abideSJ"><span class="hs-identifier hs-var">abideSJ</span></a><span class="hs-special">,</span><span>
114+</span><a name="line-114"></a><span>
115+</span><a name="line-115"></a><span> </span><span class="hs-comment">-- * Biproduct approach</span><span>
116+</span><a name="line-116"></a><span> </span><span class="hs-comment">-- ** Split</span><span>
117+</span><a name="line-117"></a><span> </span><span class="hs-special">(</span><a href="Matrix.Type.html#%3D%3D%3D"><span class="hs-operator hs-var">===</span></a><span class="hs-special">)</span><span class="hs-special">,</span><span>
118+</span><a name="line-118"></a><span> </span><span class="hs-comment">-- *** Projections</span><span>
119+</span><a name="line-119"></a><span> </span><a href="Matrix.Type.html#p1"><span class="hs-identifier hs-var">p1</span></a><span class="hs-special">,</span><span>
120+</span><a name="line-120"></a><span> </span><a href="Matrix.Type.html#p2"><span class="hs-identifier hs-var">p2</span></a><span class="hs-special">,</span><span>
121+</span><a name="line-121"></a><span> </span><span class="hs-comment">-- ** Junc</span><span>
122+</span><a name="line-122"></a><span> </span><span class="hs-special">(</span><a href="Matrix.Type.html#%7C%7C%7C"><span class="hs-operator hs-var">|||</span></a><span class="hs-special">)</span><span class="hs-special">,</span><span>
123+</span><a name="line-123"></a><span> </span><span class="hs-comment">-- *** Injections</span><span>
124+</span><a name="line-124"></a><span> </span><a href="Matrix.Type.html#i1"><span class="hs-identifier hs-var">i1</span></a><span class="hs-special">,</span><span>
125+</span><a name="line-125"></a><span> </span><a href="Matrix.Type.html#i2"><span class="hs-identifier hs-var">i2</span></a><span class="hs-special">,</span><span>
126+</span><a name="line-126"></a><span> </span><span class="hs-comment">-- ** Bifunctors</span><span>
127+</span><a name="line-127"></a><span> </span><span class="hs-special">(</span><a href="Matrix.Type.html#-%7C-"><span class="hs-operator hs-var">-|-</span></a><span class="hs-special">)</span><span class="hs-special">,</span><span>
128+</span><a name="line-128"></a><span> </span><span class="hs-special">(</span><a href="Matrix.Type.html#%3E%3C"><span class="hs-operator hs-var">&gt;&lt;</span></a><span class="hs-special">)</span><span class="hs-special">,</span><span>
129+</span><a name="line-129"></a><span>
130+</span><a name="line-130"></a><span> </span><span class="hs-comment">-- ** Applicative matrix combinators</span><span>
131+</span><a name="line-131"></a><span>
132+</span><a name="line-132"></a><span> </span><span class="hs-comment">-- | Note that given the restrictions imposed it is not possible to</span><span>
133+</span><a name="line-133"></a><span> </span><span class="hs-comment">-- implement the standard type classes present in standard Haskell.</span><span>
134+</span><a name="line-134"></a><span> </span><span class="hs-comment">-- *** Matrix pairing projections</span><span>
135+</span><a name="line-135"></a><span> </span><a href="Matrix.Type.html#kp1"><span class="hs-identifier hs-var">kp1</span></a><span class="hs-special">,</span><span>
136+</span><a name="line-136"></a><span> </span><a href="Matrix.Type.html#kp2"><span class="hs-identifier hs-var">kp2</span></a><span class="hs-special">,</span><span>
137+</span><a name="line-137"></a><span>
138+</span><a name="line-138"></a><span> </span><span class="hs-comment">-- *** Matrix pairing</span><span>
139+</span><a name="line-139"></a><span> </span><a href="Matrix.Type.html#khatri"><span class="hs-identifier hs-var">khatri</span></a><span class="hs-special">,</span><span>
140+</span><a name="line-140"></a><span>
141+</span><a name="line-141"></a><span> </span><span class="hs-comment">-- * Matrix composition and lifting</span><span>
142+</span><a name="line-142"></a><span>
143+</span><a name="line-143"></a><span> </span><span class="hs-comment">-- ** Arrow matrix combinators</span><span>
144+</span><a name="line-144"></a><span>
145+</span><a name="line-145"></a><span> </span><span class="hs-comment">-- | Note that given the restrictions imposed it is not possible to</span><span>
146+</span><a name="line-146"></a><span> </span><span class="hs-comment">-- implement the standard type classes present in standard Haskell.</span><span>
147+</span><a name="line-147"></a><span> </span><a href="Matrix.Type.html#identity"><span class="hs-identifier hs-var">identity</span></a><span class="hs-special">,</span><span>
148+</span><a name="line-148"></a><span> </span><a href="Matrix.Type.html#comp"><span class="hs-identifier hs-var">comp</span></a><span class="hs-special">,</span><span>
149+</span><a name="line-149"></a><span> </span><a href="Matrix.Type.html#fromF"><span class="hs-identifier hs-var">fromF</span></a><span class="hs-special">,</span><span>
150+</span><a name="line-150"></a><span> </span><a href="Matrix.Type.html#fromF%27"><span class="hs-identifier hs-var">fromF'</span></a><span class="hs-special">,</span><span>
151+</span><a name="line-151"></a><span>
152+</span><a name="line-152"></a><span> </span><span class="hs-comment">-- * Matrix printing</span><span>
153+</span><a name="line-153"></a><span> </span><a href="Matrix.Type.html#pretty"><span class="hs-identifier hs-var">pretty</span></a><span class="hs-special">,</span><span>
154+</span><a name="line-154"></a><span> </span><a href="Matrix.Type.html#prettyPrint"><span class="hs-identifier hs-var">prettyPrint</span></a><span>
155+</span><a name="line-155"></a><span> </span><span class="hs-special">)</span><span>
156+</span><a name="line-156"></a><span class="hs-keyword">where</span><span>
157+</span><a name="line-157"></a><span>
158+</span><a name="line-158"></a><span class="hs-keyword">import</span><span> </span><span class="hs-identifier">Data.Void</span><span>
159+</span><a name="line-159"></a><span class="hs-keyword">import</span><span> </span><span class="hs-identifier">Data.Proxy</span><span>
160+</span><a name="line-160"></a><span class="hs-keyword">import</span><span> </span><span class="hs-identifier">Data.Kind</span><span>
161+</span><a name="line-161"></a><span class="hs-keyword">import</span><span> </span><span class="hs-identifier">GHC.TypeLits</span><span>
162+</span><a name="line-162"></a><span class="hs-keyword">import</span><span> </span><span class="hs-identifier">Control.DeepSeq</span><span>
163+</span><a name="line-163"></a><span class="hs-keyword">import</span><span> </span><span class="hs-keyword">qualified</span><span> </span><span class="hs-identifier">Control.Category</span><span> </span><span class="hs-keyword">as</span><span> </span><span class="hs-identifier">C</span><span>
164+</span><a name="line-164"></a><span class="hs-keyword">import</span><span> </span><span class="hs-keyword">qualified</span><span> </span><a href="Matrix.Internal.html"><span class="hs-identifier">Matrix.Internal</span></a><span> </span><span class="hs-keyword">as</span><span> </span><span class="hs-identifier">I</span><span>
165+</span><a name="line-165"></a><span>
166+</span><a name="line-166"></a><span class="hs-keyword">newtype</span><span> </span><a name="Matrix"><a href="Matrix.Type.html#Matrix"><span class="hs-identifier">Matrix</span></a></a><span> </span><a name="local-6989586621679046459"><a href="#local-6989586621679046459"><span class="hs-identifier">e</span></a></a><span> </span><span class="hs-special">(</span><a name="local-6989586621679046460"><a href="#local-6989586621679046460"><span class="hs-identifier">cols</span></a></a><span> </span><span class="hs-glyph">::</span><span> </span><span class="hs-identifier hs-type">Type</span><span class="hs-special">)</span><span> </span><span class="hs-special">(</span><a name="local-6989586621679046461"><a href="#local-6989586621679046461"><span class="hs-identifier">rows</span></a></a><span> </span><span class="hs-glyph">::</span><span> </span><span class="hs-identifier hs-type">Type</span><span class="hs-special">)</span><span> </span><span class="hs-glyph">=</span><span> </span><a name="M"><a href="Matrix.Type.html#M"><span class="hs-identifier">M</span></a></a><span> </span><span class="hs-special">(</span><a href="Matrix.Internal.html#Matrix"><span class="hs-identifier hs-type">I.Matrix</span></a><span> </span><a href="#local-6989586621679046459"><span class="hs-identifier hs-type">e</span></a><span> </span><span class="hs-special">(</span><a href="Matrix.Internal.html#Normalize"><span class="hs-identifier hs-type">I.Normalize</span></a><span> </span><a href="#local-6989586621679046460"><span class="hs-identifier hs-type">cols</span></a><span class="hs-special">)</span><span> </span><span class="hs-special">(</span><a href="Matrix.Internal.html#Normalize"><span class="hs-identifier hs-type">I.Normalize</span></a><span> </span><a href="#local-6989586621679046461"><span class="hs-identifier hs-type">rows</span></a><span class="hs-special">)</span><span class="hs-special">)</span><span>
167+</span><a name="line-167"></a><span> </span><span class="hs-keyword">deriving</span><span> </span><span class="hs-special">(</span><span class="hs-identifier hs-type">Show</span><span class="hs-special">,</span><span> </span><span class="hs-identifier hs-type">Num</span><span class="hs-special">,</span><span> </span><span class="hs-identifier hs-type">Eq</span><span class="hs-special">,</span><span> </span><span class="hs-identifier hs-type">Ord</span><span class="hs-special">,</span><span> </span><span class="hs-identifier hs-type">NFData</span><span class="hs-special">)</span><span> </span><span class="hs-keyword">via</span><span> </span><span class="hs-special">(</span><a href="Matrix.Internal.html#Matrix"><span class="hs-identifier hs-type">I.Matrix</span></a><span> </span><a href="#local-6989586621679046459"><span class="hs-identifier hs-type">e</span></a><span> </span><span class="hs-special">(</span><a href="Matrix.Internal.html#Normalize"><span class="hs-identifier hs-type">I.Normalize</span></a><span> </span><a href="#local-6989586621679046460"><span class="hs-identifier hs-type">cols</span></a><span class="hs-special">)</span><span> </span><span class="hs-special">(</span><a href="Matrix.Internal.html#Normalize"><span class="hs-identifier hs-type">I.Normalize</span></a><span> </span><a href="#local-6989586621679046461"><span class="hs-identifier hs-type">rows</span></a><span class="hs-special">)</span><span class="hs-special">)</span><span>
168+</span><a name="line-168"></a><span>
169+</span><a name="line-169"></a><span class="hs-comment">-- | It isn't possible to implement the 'id' function so it's</span><span>
170+</span><a name="line-170"></a><span class="hs-comment">-- implementation is 'undefined'. However 'comp' can be and this partial</span><span>
171+</span><a name="line-171"></a><span class="hs-comment">-- class implementation exists just to make the code more readable.</span><span>
172+</span><a name="line-172"></a><span class="hs-comment">--</span><span>
173+</span><a name="line-173"></a><span class="hs-comment">-- Please use 'identity' instead.</span><span>
174+</span><a name="line-174"></a><span class="hs-keyword">instance</span><span> </span><span class="hs-special">(</span><span class="hs-identifier hs-type">Num</span><span> </span><a href="#local-6989586621679046462"><span class="hs-identifier hs-type">e</span></a><span class="hs-special">)</span><span> </span><span class="hs-glyph">=&gt;</span><span> </span><span class="hs-identifier hs-type">C.Category</span><span> </span><span class="hs-special">(</span><a href="Matrix.Type.html#Matrix"><span class="hs-identifier hs-type">Matrix</span></a><span> </span><a href="#local-6989586621679046462"><span class="hs-identifier hs-type">e</span></a><span class="hs-special">)</span><span> </span><span class="hs-keyword">where</span><span>
175+</span><a name="line-175"></a><span> </span><a name="local-8214565720323789508"><span class="hs-identifier">id</span></a><span> </span><span class="hs-glyph">=</span><span> </span><span class="hs-identifier hs-var">undefined</span><span>
176+</span><a name="line-176"></a><span> </span><span class="hs-special">(</span><a name="local-8214565720323789507"><span class="hs-operator">.</span></a><span class="hs-special">)</span><span> </span><span class="hs-glyph">=</span><span> </span><a href="Matrix.Type.html#comp"><span class="hs-identifier hs-var">comp</span></a><span>
177+</span><a name="line-177"></a><span>
178+</span><a name="line-178"></a><span class="hs-comment">-- | Zero type alias</span><span>
179+</span><a name="line-179"></a><span class="hs-keyword">type</span><span> </span><a name="Zero"><a href="Matrix.Type.html#Zero"><span class="hs-identifier">Zero</span></a></a><span> </span><span class="hs-glyph">=</span><span> </span><span class="hs-identifier hs-type">Void</span><span>
180+</span><a name="line-180"></a><span>
181+</span><a name="line-181"></a><span class="hs-comment">-- | One type alias</span><span>
182+</span><a name="line-182"></a><span class="hs-keyword">type</span><span> </span><a name="One"><a href="Matrix.Type.html#One"><span class="hs-identifier">One</span></a></a><span> </span><span class="hs-glyph">=</span><span> </span><span class="hs-special">(</span><span class="hs-special">)</span><span>
183+</span><a name="line-183"></a><span>
184+</span><a name="line-184"></a><span class="hs-comment">-- Primitives</span><span>
185+</span><a name="line-185"></a><span>
186+</span><a name="line-186"></a><span class="hs-comment">-- | Empty matrix constructor</span><span>
187+</span><a name="line-187"></a><span class="hs-identifier">empty</span><span> </span><span class="hs-glyph">::</span><span> </span><a href="Matrix.Type.html#Matrix"><span class="hs-identifier hs-type">Matrix</span></a><span> </span><a href="#local-6989586621679046596"><span class="hs-identifier hs-type">e</span></a><span> </span><a href="Matrix.Type.html#Zero"><span class="hs-identifier hs-type">Zero</span></a><span> </span><a href="Matrix.Type.html#Zero"><span class="hs-identifier hs-type">Zero</span></a><span>
188+</span><a name="line-188"></a><a name="empty"><a href="Matrix.Type.html#empty"><span class="hs-identifier">empty</span></a></a><span> </span><span class="hs-glyph">=</span><span> </span><a href="Matrix.Type.html#M"><span class="hs-identifier hs-var">M</span></a><span> </span><a href="Matrix.Internal.html#Empty"><span class="hs-identifier hs-var">I.Empty</span></a><span>
189+</span><a name="line-189"></a><span>
190+</span><a name="line-190"></a><span class="hs-comment">-- | Unit matrix constructor</span><span>
191+</span><a name="line-191"></a><span class="hs-identifier">one</span><span> </span><span class="hs-glyph">::</span><span> </span><a href="#local-6989586621679046595"><span class="hs-identifier hs-type">e</span></a><span> </span><span class="hs-glyph">-&gt;</span><span> </span><a href="Matrix.Type.html#Matrix"><span class="hs-identifier hs-type">Matrix</span></a><span> </span><a href="#local-6989586621679046595"><span class="hs-identifier hs-type">e</span></a><span> </span><a href="Matrix.Type.html#One"><span class="hs-identifier hs-type">One</span></a><span> </span><a href="Matrix.Type.html#One"><span class="hs-identifier hs-type">One</span></a><span>
192+</span><a name="line-192"></a><a name="one"><a href="Matrix.Type.html#one"><span class="hs-identifier">one</span></a></a><span> </span><span class="hs-glyph">=</span><span> </span><a href="Matrix.Type.html#M"><span class="hs-identifier hs-var">M</span></a><span> </span><span class="hs-operator hs-var">.</span><span> </span><a href="Matrix.Internal.html#One"><span class="hs-identifier hs-var">I.One</span></a><span>
193+</span><a name="line-193"></a><span>
194+</span><a name="line-194"></a><span class="hs-comment">-- | Matrix 'Junc' constructor</span><span>
195+</span><a name="line-195"></a><span class="hs-identifier">junc</span><span> </span><span class="hs-glyph">::</span><span>
196+</span><a name="line-196"></a><span> </span><span class="hs-special">(</span><span class="hs-identifier hs-type">I.Normalize</span><span> </span><span class="hs-special">(</span><span class="hs-identifier hs-type">Either</span><span> </span><a href="#local-6989586621679046591"><span class="hs-identifier hs-type">a</span></a><span> </span><a href="#local-6989586621679046592"><span class="hs-identifier hs-type">b</span></a><span class="hs-special">)</span><span> </span><span class="hs-glyph">~</span><span> </span><span class="hs-identifier hs-type">Either</span><span> </span><span class="hs-special">(</span><a href="Matrix.Internal.html#Normalize"><span class="hs-identifier hs-type">I.Normalize</span></a><span> </span><a href="#local-6989586621679046591"><span class="hs-identifier hs-type">a</span></a><span class="hs-special">)</span><span> </span><span class="hs-special">(</span><a href="Matrix.Internal.html#Normalize"><span class="hs-identifier hs-type">I.Normalize</span></a><span> </span><a href="#local-6989586621679046592"><span class="hs-identifier hs-type">b</span></a><span class="hs-special">)</span><span class="hs-special">)</span><span> </span><span class="hs-glyph">=&gt;</span><span>
197+</span><a name="line-197"></a><span> </span><a href="Matrix.Type.html#Matrix"><span class="hs-identifier hs-type">Matrix</span></a><span> </span><a href="#local-6989586621679046593"><span class="hs-identifier hs-type">e</span></a><span> </span><a href="#local-6989586621679046591"><span class="hs-identifier hs-type">a</span></a><span> </span><a href="#local-6989586621679046594"><span class="hs-identifier hs-type">rows</span></a><span> </span><span class="hs-glyph">-&gt;</span><span>
198+</span><a name="line-198"></a><span> </span><a href="Matrix.Type.html#Matrix"><span class="hs-identifier hs-type">Matrix</span></a><span> </span><a href="#local-6989586621679046593"><span class="hs-identifier hs-type">e</span></a><span> </span><a href="#local-6989586621679046592"><span class="hs-identifier hs-type">b</span></a><span> </span><a href="#local-6989586621679046594"><span class="hs-identifier hs-type">rows</span></a><span> </span><span class="hs-glyph">-&gt;</span><span>
199+</span><a name="line-199"></a><span> </span><a href="Matrix.Type.html#Matrix"><span class="hs-identifier hs-type">Matrix</span></a><span> </span><a href="#local-6989586621679046593"><span class="hs-identifier hs-type">e</span></a><span> </span><span class="hs-special">(</span><span class="hs-identifier hs-type">Either</span><span> </span><a href="#local-6989586621679046591"><span class="hs-identifier hs-type">a</span></a><span> </span><a href="#local-6989586621679046592"><span class="hs-identifier hs-type">b</span></a><span class="hs-special">)</span><span> </span><a href="#local-6989586621679046594"><span class="hs-identifier hs-type">rows</span></a><span>
200+</span><a name="line-200"></a><a name="junc"><a href="Matrix.Type.html#junc"><span class="hs-identifier">junc</span></a></a><span> </span><span class="hs-special">(</span><a href="Matrix.Type.html#M"><span class="hs-identifier hs-var">M</span></a><span> </span><a name="local-6989586621679046597"><a href="#local-6989586621679046597"><span class="hs-identifier">a</span></a></a><span class="hs-special">)</span><span> </span><span class="hs-special">(</span><a href="Matrix.Type.html#M"><span class="hs-identifier hs-var">M</span></a><span> </span><a name="local-6989586621679046598"><a href="#local-6989586621679046598"><span class="hs-identifier">b</span></a></a><span class="hs-special">)</span><span> </span><span class="hs-glyph">=</span><span> </span><a href="Matrix.Type.html#M"><span class="hs-identifier hs-var">M</span></a><span> </span><span class="hs-special">(</span><a href="Matrix.Internal.html#Junc"><span class="hs-identifier hs-var">I.Junc</span></a><span> </span><a href="#local-6989586621679046597"><span class="hs-identifier hs-var">a</span></a><span> </span><a href="#local-6989586621679046598"><span class="hs-identifier hs-var">b</span></a><span class="hs-special">)</span><span>
201+</span><a name="line-201"></a><span>
202+</span><a name="line-202"></a><span class="hs-keyword">infixl</span><span> </span><span class="hs-number">3</span><span> </span><a href="Matrix.Type.html#%7C%7C%7C"><span class="hs-operator hs-var">|||</span></a><span>
203+</span><a name="line-203"></a><span class="hs-comment">-- | Matrix 'Junc' constructor</span><span>
204+</span><a name="line-204"></a><span class="hs-special">(</span><span class="hs-operator">|||</span><span class="hs-special">)</span><span> </span><span class="hs-glyph">::</span><span>
205+</span><a name="line-205"></a><span> </span><span class="hs-special">(</span><span class="hs-identifier hs-type">I.Normalize</span><span> </span><span class="hs-special">(</span><span class="hs-identifier hs-type">Either</span><span> </span><a href="#local-6989586621679046587"><span class="hs-identifier hs-type">a</span></a><span> </span><a href="#local-6989586621679046588"><span class="hs-identifier hs-type">b</span></a><span class="hs-special">)</span><span> </span><span class="hs-glyph">~</span><span> </span><span class="hs-identifier hs-type">Either</span><span> </span><span class="hs-special">(</span><a href="Matrix.Internal.html#Normalize"><span class="hs-identifier hs-type">I.Normalize</span></a><span> </span><a href="#local-6989586621679046587"><span class="hs-identifier hs-type">a</span></a><span class="hs-special">)</span><span> </span><span class="hs-special">(</span><a href="Matrix.Internal.html#Normalize"><span class="hs-identifier hs-type">I.Normalize</span></a><span> </span><a href="#local-6989586621679046588"><span class="hs-identifier hs-type">b</span></a><span class="hs-special">)</span><span class="hs-special">)</span><span> </span><span class="hs-glyph">=&gt;</span><span>
206+</span><a name="line-206"></a><span> </span><a href="Matrix.Type.html#Matrix"><span class="hs-identifier hs-type">Matrix</span></a><span> </span><a href="#local-6989586621679046589"><span class="hs-identifier hs-type">e</span></a><span> </span><a href="#local-6989586621679046587"><span class="hs-identifier hs-type">a</span></a><span> </span><a href="#local-6989586621679046590"><span class="hs-identifier hs-type">rows</span></a><span> </span><span class="hs-glyph">-&gt;</span><span>
207+</span><a name="line-207"></a><span> </span><a href="Matrix.Type.html#Matrix"><span class="hs-identifier hs-type">Matrix</span></a><span> </span><a href="#local-6989586621679046589"><span class="hs-identifier hs-type">e</span></a><span> </span><a href="#local-6989586621679046588"><span class="hs-identifier hs-type">b</span></a><span> </span><a href="#local-6989586621679046590"><span class="hs-identifier hs-type">rows</span></a><span> </span><span class="hs-glyph">-&gt;</span><span>
208+</span><a name="line-208"></a><span> </span><a href="Matrix.Type.html#Matrix"><span class="hs-identifier hs-type">Matrix</span></a><span> </span><a href="#local-6989586621679046589"><span class="hs-identifier hs-type">e</span></a><span> </span><span class="hs-special">(</span><span class="hs-identifier hs-type">Either</span><span> </span><a href="#local-6989586621679046587"><span class="hs-identifier hs-type">a</span></a><span> </span><a href="#local-6989586621679046588"><span class="hs-identifier hs-type">b</span></a><span class="hs-special">)</span><span> </span><a href="#local-6989586621679046590"><span class="hs-identifier hs-type">rows</span></a><span>
209+</span><a name="line-209"></a><span class="hs-special">(</span><a name="%7C%7C%7C"><a href="Matrix.Type.html#%7C%7C%7C"><span class="hs-operator">|||</span></a></a><span class="hs-special">)</span><span> </span><span class="hs-glyph">=</span><span> </span><a href="Matrix.Type.html#junc"><span class="hs-identifier hs-var">junc</span></a><span>
210+</span><a name="line-210"></a><span>
211+</span><a name="line-211"></a><span class="hs-comment">-- | Matrix 'Split' constructor</span><span>
212+</span><a name="line-212"></a><span class="hs-identifier">split</span><span> </span><span class="hs-glyph">::</span><span>
213+</span><a name="line-213"></a><span> </span><span class="hs-special">(</span><span class="hs-identifier hs-type">I.Normalize</span><span> </span><span class="hs-special">(</span><span class="hs-identifier hs-type">Either</span><span> </span><a href="#local-6989586621679046583"><span class="hs-identifier hs-type">a</span></a><span> </span><a href="#local-6989586621679046584"><span class="hs-identifier hs-type">b</span></a><span class="hs-special">)</span><span> </span><span class="hs-glyph">~</span><span> </span><span class="hs-identifier hs-type">Either</span><span> </span><span class="hs-special">(</span><a href="Matrix.Internal.html#Normalize"><span class="hs-identifier hs-type">I.Normalize</span></a><span> </span><a href="#local-6989586621679046583"><span class="hs-identifier hs-type">a</span></a><span class="hs-special">)</span><span> </span><span class="hs-special">(</span><a href="Matrix.Internal.html#Normalize"><span class="hs-identifier hs-type">I.Normalize</span></a><span> </span><a href="#local-6989586621679046584"><span class="hs-identifier hs-type">b</span></a><span class="hs-special">)</span><span class="hs-special">)</span><span> </span><span class="hs-glyph">=&gt;</span><span>
214+</span><a name="line-214"></a><span> </span><a href="Matrix.Type.html#Matrix"><span class="hs-identifier hs-type">Matrix</span></a><span> </span><a href="#local-6989586621679046585"><span class="hs-identifier hs-type">e</span></a><span> </span><a href="#local-6989586621679046586"><span class="hs-identifier hs-type">cols</span></a><span> </span><a href="#local-6989586621679046583"><span class="hs-identifier hs-type">a</span></a><span> </span><span class="hs-glyph">-&gt;</span><span>
215+</span><a name="line-215"></a><span> </span><a href="Matrix.Type.html#Matrix"><span class="hs-identifier hs-type">Matrix</span></a><span> </span><a href="#local-6989586621679046585"><span class="hs-identifier hs-type">e</span></a><span> </span><a href="#local-6989586621679046586"><span class="hs-identifier hs-type">cols</span></a><span> </span><a href="#local-6989586621679046584"><span class="hs-identifier hs-type">b</span></a><span> </span><span class="hs-glyph">-&gt;</span><span>
216+</span><a name="line-216"></a><span> </span><a href="Matrix.Type.html#Matrix"><span class="hs-identifier hs-type">Matrix</span></a><span> </span><a href="#local-6989586621679046585"><span class="hs-identifier hs-type">e</span></a><span> </span><a href="#local-6989586621679046586"><span class="hs-identifier hs-type">cols</span></a><span> </span><span class="hs-special">(</span><span class="hs-identifier hs-type">Either</span><span> </span><a href="#local-6989586621679046583"><span class="hs-identifier hs-type">a</span></a><span> </span><a href="#local-6989586621679046584"><span class="hs-identifier hs-type">b</span></a><span class="hs-special">)</span><span>
217+</span><a name="line-217"></a><a name="split"><a href="Matrix.Type.html#split"><span class="hs-identifier">split</span></a></a><span> </span><span class="hs-special">(</span><a href="Matrix.Type.html#M"><span class="hs-identifier hs-var">M</span></a><span> </span><a name="local-6989586621679046599"><a href="#local-6989586621679046599"><span class="hs-identifier">a</span></a></a><span class="hs-special">)</span><span> </span><span class="hs-special">(</span><a href="Matrix.Type.html#M"><span class="hs-identifier hs-var">M</span></a><span> </span><a name="local-6989586621679046600"><a href="#local-6989586621679046600"><span class="hs-identifier">b</span></a></a><span class="hs-special">)</span><span> </span><span class="hs-glyph">=</span><span> </span><a href="Matrix.Type.html#M"><span class="hs-identifier hs-var">M</span></a><span> </span><span class="hs-special">(</span><a href="Matrix.Internal.html#Split"><span class="hs-identifier hs-var">I.Split</span></a><span> </span><a href="#local-6989586621679046599"><span class="hs-identifier hs-var">a</span></a><span> </span><a href="#local-6989586621679046600"><span class="hs-identifier hs-var">b</span></a><span class="hs-special">)</span><span>
218+</span><a name="line-218"></a><span>
219+</span><a name="line-219"></a><span class="hs-keyword">infixl</span><span> </span><span class="hs-number">2</span><span> </span><a href="Matrix.Type.html#%3D%3D%3D"><span class="hs-operator hs-var">===</span></a><span>
220+</span><a name="line-220"></a><span class="hs-comment">-- | Matrix 'Split' constructor</span><span>
221+</span><a name="line-221"></a><span class="hs-special">(</span><span class="hs-operator">===</span><span class="hs-special">)</span><span> </span><span class="hs-glyph">::</span><span>
222+</span><a name="line-222"></a><span> </span><span class="hs-special">(</span><span class="hs-identifier hs-type">I.Normalize</span><span> </span><span class="hs-special">(</span><span class="hs-identifier hs-type">Either</span><span> </span><a href="#local-6989586621679046579"><span class="hs-identifier hs-type">a</span></a><span> </span><a href="#local-6989586621679046580"><span class="hs-identifier hs-type">b</span></a><span class="hs-special">)</span><span> </span><span class="hs-glyph">~</span><span> </span><span class="hs-identifier hs-type">Either</span><span> </span><span class="hs-special">(</span><a href="Matrix.Internal.html#Normalize"><span class="hs-identifier hs-type">I.Normalize</span></a><span> </span><a href="#local-6989586621679046579"><span class="hs-identifier hs-type">a</span></a><span class="hs-special">)</span><span> </span><span class="hs-special">(</span><a href="Matrix.Internal.html#Normalize"><span class="hs-identifier hs-type">I.Normalize</span></a><span> </span><a href="#local-6989586621679046580"><span class="hs-identifier hs-type">b</span></a><span class="hs-special">)</span><span class="hs-special">)</span><span> </span><span class="hs-glyph">=&gt;</span><span>
223+</span><a name="line-223"></a><span> </span><a href="Matrix.Type.html#Matrix"><span class="hs-identifier hs-type">Matrix</span></a><span> </span><a href="#local-6989586621679046581"><span class="hs-identifier hs-type">e</span></a><span> </span><a href="#local-6989586621679046582"><span class="hs-identifier hs-type">cols</span></a><span> </span><a href="#local-6989586621679046579"><span class="hs-identifier hs-type">a</span></a><span> </span><span class="hs-glyph">-&gt;</span><span>
224+</span><a name="line-224"></a><span> </span><a href="Matrix.Type.html#Matrix"><span class="hs-identifier hs-type">Matrix</span></a><span> </span><a href="#local-6989586621679046581"><span class="hs-identifier hs-type">e</span></a><span> </span><a href="#local-6989586621679046582"><span class="hs-identifier hs-type">cols</span></a><span> </span><a href="#local-6989586621679046580"><span class="hs-identifier hs-type">b</span></a><span> </span><span class="hs-glyph">-&gt;</span><span>
225+</span><a name="line-225"></a><span> </span><a href="Matrix.Type.html#Matrix"><span class="hs-identifier hs-type">Matrix</span></a><span> </span><a href="#local-6989586621679046581"><span class="hs-identifier hs-type">e</span></a><span> </span><a href="#local-6989586621679046582"><span class="hs-identifier hs-type">cols</span></a><span> </span><span class="hs-special">(</span><span class="hs-identifier hs-type">Either</span><span> </span><a href="#local-6989586621679046579"><span class="hs-identifier hs-type">a</span></a><span> </span><a href="#local-6989586621679046580"><span class="hs-identifier hs-type">b</span></a><span class="hs-special">)</span><span>
226+</span><a name="line-226"></a><span class="hs-special">(</span><a name="%3D%3D%3D"><a href="Matrix.Type.html#%3D%3D%3D"><span class="hs-operator">===</span></a></a><span class="hs-special">)</span><span> </span><span class="hs-glyph">=</span><span> </span><a href="Matrix.Type.html#split"><span class="hs-identifier hs-var">split</span></a><span>
227+</span><a name="line-227"></a><span>
228+</span><a name="line-228"></a><span class="hs-comment">-- Functor hierarchy</span><span>
229+</span><a name="line-229"></a><span>
230+</span><a name="line-230"></a><span class="hs-comment">-- | Functor instance equivalent function</span><span>
231+</span><a name="line-231"></a><span class="hs-identifier">fmapM</span><span> </span><span class="hs-glyph">::</span><span>
232+</span><a name="line-232"></a><span> </span><span class="hs-special">(</span><span> </span><span class="hs-identifier hs-type">Bounded</span><span> </span><a href="#local-6989586621679046575"><span class="hs-identifier hs-type">a</span></a><span class="hs-special">,</span><span>
233+</span><a name="line-233"></a><span> </span><span class="hs-identifier hs-type">Bounded</span><span> </span><a href="#local-6989586621679046576"><span class="hs-identifier hs-type">b</span></a><span class="hs-special">,</span><span>
234+</span><a name="line-234"></a><span> </span><span class="hs-identifier hs-type">Enum</span><span> </span><a href="#local-6989586621679046575"><span class="hs-identifier hs-type">a</span></a><span class="hs-special">,</span><span>
235+</span><a name="line-235"></a><span> </span><span class="hs-identifier hs-type">Enum</span><span> </span><a href="#local-6989586621679046576"><span class="hs-identifier hs-type">b</span></a><span class="hs-special">,</span><span>
236+</span><a name="line-236"></a><span> </span><span class="hs-identifier hs-type">Eq</span><span> </span><a href="#local-6989586621679046576"><span class="hs-identifier hs-type">b</span></a><span class="hs-special">,</span><span>
237+</span><a name="line-237"></a><span> </span><span class="hs-identifier hs-type">Num</span><span> </span><a href="#local-6989586621679046577"><span class="hs-identifier hs-type">e</span></a><span class="hs-special">,</span><span>
238+</span><a name="line-238"></a><span> </span><span class="hs-identifier hs-type">Ord</span><span> </span><a href="#local-6989586621679046577"><span class="hs-identifier hs-type">e</span></a><span class="hs-special">,</span><span>
239+</span><a name="line-239"></a><span> </span><span class="hs-identifier hs-type">KnownNat</span><span> </span><span class="hs-special">(</span><a href="Matrix.Internal.html#Count"><span class="hs-identifier hs-type">I.Count</span></a><span> </span><span class="hs-special">(</span><a href="Matrix.Internal.html#Normalize"><span class="hs-identifier hs-type">I.Normalize</span></a><span> </span><a href="#local-6989586621679046575"><span class="hs-identifier hs-type">a</span></a><span class="hs-special">)</span><span class="hs-special">)</span><span class="hs-special">,</span><span>
240+</span><a name="line-240"></a><span> </span><span class="hs-identifier hs-type">KnownNat</span><span> </span><span class="hs-special">(</span><a href="Matrix.Internal.html#Count"><span class="hs-identifier hs-type">I.Count</span></a><span> </span><span class="hs-special">(</span><a href="Matrix.Internal.html#Normalize"><span class="hs-identifier hs-type">I.Normalize</span></a><span> </span><a href="#local-6989586621679046576"><span class="hs-identifier hs-type">b</span></a><span class="hs-special">)</span><span class="hs-special">)</span><span class="hs-special">,</span><span>
241+</span><a name="line-241"></a><span> </span><a href="Matrix.Internal.html#FromLists"><span class="hs-identifier hs-type">I.FromLists</span></a><span> </span><a href="#local-6989586621679046577"><span class="hs-identifier hs-type">e</span></a><span> </span><span class="hs-special">(</span><a href="Matrix.Internal.html#Normalize"><span class="hs-identifier hs-type">I.Normalize</span></a><span> </span><a href="#local-6989586621679046576"><span class="hs-identifier hs-type">b</span></a><span class="hs-special">)</span><span> </span><span class="hs-special">(</span><a href="Matrix.Internal.html#Normalize"><span class="hs-identifier hs-type">I.Normalize</span></a><span> </span><a href="#local-6989586621679046575"><span class="hs-identifier hs-type">a</span></a><span class="hs-special">)</span><span>
242+</span><a name="line-242"></a><span> </span><span class="hs-special">)</span><span>
243+</span><a name="line-243"></a><span> </span><span class="hs-glyph">=&gt;</span><span>
244+</span><a name="line-244"></a><span> </span><span class="hs-special">(</span><a href="#local-6989586621679046575"><span class="hs-identifier hs-type">a</span></a><span> </span><span class="hs-glyph">-&gt;</span><span> </span><a href="#local-6989586621679046576"><span class="hs-identifier hs-type">b</span></a><span class="hs-special">)</span><span> </span><span class="hs-glyph">-&gt;</span><span> </span><a href="Matrix.Type.html#Matrix"><span class="hs-identifier hs-type">Matrix</span></a><span> </span><a href="#local-6989586621679046577"><span class="hs-identifier hs-type">e</span></a><span> </span><a href="#local-6989586621679046578"><span class="hs-identifier hs-type">c</span></a><span> </span><a href="#local-6989586621679046575"><span class="hs-identifier hs-type">a</span></a><span> </span><span class="hs-glyph">-&gt;</span><span> </span><a href="Matrix.Type.html#Matrix"><span class="hs-identifier hs-type">Matrix</span></a><span> </span><a href="#local-6989586621679046577"><span class="hs-identifier hs-type">e</span></a><span> </span><a href="#local-6989586621679046578"><span class="hs-identifier hs-type">c</span></a><span> </span><a href="#local-6989586621679046576"><span class="hs-identifier hs-type">b</span></a><span>
245+</span><a name="line-245"></a><a name="fmapM"><a href="Matrix.Type.html#fmapM"><span class="hs-identifier">fmapM</span></a></a><span> </span><a name="local-6989586621679046601"><a href="#local-6989586621679046601"><span class="hs-identifier">f</span></a></a><span> </span><a name="local-6989586621679046602"><a href="#local-6989586621679046602"><span class="hs-identifier">m</span></a></a><span> </span><span class="hs-glyph">=</span><span> </span><a href="Matrix.Type.html#fromF%27"><span class="hs-identifier hs-var">fromF'</span></a><span> </span><a href="#local-6989586621679046601"><span class="hs-identifier hs-var">f</span></a><span> </span><span class="hs-special">`</span><a href="Matrix.Type.html#comp"><span class="hs-identifier hs-var">comp</span></a><span class="hs-special">`</span><span> </span><a href="#local-6989586621679046602"><span class="hs-identifier hs-var">m</span></a><span>
246+</span><a name="line-246"></a><span>
247+</span><a name="line-247"></a><span class="hs-comment">-- | Applicative instance equivalent 'unit' function,</span><span>
248+</span><a name="line-248"></a><span class="hs-identifier">unitM</span><span> </span><span class="hs-glyph">::</span><span> </span><span class="hs-special">(</span><span class="hs-identifier hs-type">Num</span><span> </span><a href="#local-6989586621679046574"><span class="hs-identifier hs-type">e</span></a><span class="hs-special">)</span><span> </span><span class="hs-glyph">=&gt;</span><span> </span><a href="Matrix.Type.html#Matrix"><span class="hs-identifier hs-type">Matrix</span></a><span> </span><a href="#local-6989586621679046574"><span class="hs-identifier hs-type">e</span></a><span> </span><span class="hs-special">(</span><span class="hs-special">)</span><span> </span><span class="hs-special">(</span><span class="hs-special">)</span><span>
249+</span><a name="line-249"></a><a name="unitM"><a href="Matrix.Type.html#unitM"><span class="hs-identifier">unitM</span></a></a><span> </span><span class="hs-glyph">=</span><span> </span><a href="Matrix.Type.html#one"><span class="hs-identifier hs-var">one</span></a><span> </span><span class="hs-number">1</span><span>
250+</span><a name="line-250"></a><span>
251+</span><a name="line-251"></a><span class="hs-comment">-- | Applicative instance equivalent 'unit' function,</span><span>
252+</span><a name="line-252"></a><span class="hs-identifier">multM</span><span> </span><span class="hs-glyph">::</span><span>
253+</span><a name="line-253"></a><span> </span><span class="hs-special">(</span><span> </span><span class="hs-identifier hs-type">KnownNat</span><span> </span><span class="hs-special">(</span><a href="Matrix.Internal.html#Count"><span class="hs-identifier hs-type">I.Count</span></a><span> </span><span class="hs-special">(</span><a href="Matrix.Internal.html#Normalize"><span class="hs-identifier hs-type">I.Normalize</span></a><span> </span><a href="#local-6989586621679046570"><span class="hs-identifier hs-type">a</span></a><span class="hs-special">)</span><span class="hs-special">)</span><span class="hs-special">,</span><span>
254+</span><a name="line-254"></a><span> </span><span class="hs-identifier hs-type">KnownNat</span><span> </span><span class="hs-special">(</span><a href="Matrix.Internal.html#Count"><span class="hs-identifier hs-type">I.Count</span></a><span> </span><span class="hs-special">(</span><a href="Matrix.Internal.html#Normalize"><span class="hs-identifier hs-type">I.Normalize</span></a><span> </span><a href="#local-6989586621679046571"><span class="hs-identifier hs-type">b</span></a><span class="hs-special">)</span><span class="hs-special">)</span><span class="hs-special">,</span><span>
255+</span><a name="line-255"></a><span> </span><span class="hs-identifier hs-type">KnownNat</span><span> </span><span class="hs-special">(</span><a href="Matrix.Internal.html#Count"><span class="hs-identifier hs-type">I.Count</span></a><span> </span><span class="hs-special">(</span><a href="Matrix.Internal.html#Normalize"><span class="hs-identifier hs-type">I.Normalize</span></a><span> </span><span class="hs-special">(</span><a href="#local-6989586621679046570"><span class="hs-identifier hs-type">a</span></a><span class="hs-special">,</span><span> </span><a href="#local-6989586621679046571"><span class="hs-identifier hs-type">b</span></a><span class="hs-special">)</span><span class="hs-special">)</span><span class="hs-special">)</span><span class="hs-special">,</span><span>
256+</span><a name="line-256"></a><span> </span><span class="hs-identifier hs-type">Num</span><span> </span><a href="#local-6989586621679046572"><span class="hs-identifier hs-type">e</span></a><span class="hs-special">,</span><span>
257+</span><a name="line-257"></a><span> </span><a href="Matrix.Internal.html#FromLists"><span class="hs-identifier hs-type">I.FromLists</span></a><span> </span><a href="#local-6989586621679046572"><span class="hs-identifier hs-type">e</span></a><span> </span><span class="hs-special">(</span><a href="Matrix.Internal.html#Normalize"><span class="hs-identifier hs-type">I.Normalize</span></a><span> </span><span class="hs-special">(</span><a href="#local-6989586621679046570"><span class="hs-identifier hs-type">a</span></a><span class="hs-special">,</span><span> </span><a href="#local-6989586621679046571"><span class="hs-identifier hs-type">b</span></a><span class="hs-special">)</span><span class="hs-special">)</span><span> </span><span class="hs-special">(</span><a href="Matrix.Internal.html#Normalize"><span class="hs-identifier hs-type">I.Normalize</span></a><span> </span><a href="#local-6989586621679046570"><span class="hs-identifier hs-type">a</span></a><span class="hs-special">)</span><span class="hs-special">,</span><span>
258+</span><a name="line-258"></a><span> </span><a href="Matrix.Internal.html#FromLists"><span class="hs-identifier hs-type">I.FromLists</span></a><span> </span><a href="#local-6989586621679046572"><span class="hs-identifier hs-type">e</span></a><span> </span><span class="hs-special">(</span><a href="Matrix.Internal.html#Normalize"><span class="hs-identifier hs-type">I.Normalize</span></a><span> </span><span class="hs-special">(</span><a href="#local-6989586621679046570"><span class="hs-identifier hs-type">a</span></a><span class="hs-special">,</span><span> </span><a href="#local-6989586621679046571"><span class="hs-identifier hs-type">b</span></a><span class="hs-special">)</span><span class="hs-special">)</span><span> </span><span class="hs-special">(</span><a href="Matrix.Internal.html#Normalize"><span class="hs-identifier hs-type">I.Normalize</span></a><span> </span><a href="#local-6989586621679046571"><span class="hs-identifier hs-type">b</span></a><span class="hs-special">)</span><span class="hs-special">,</span><span>
259+</span><a name="line-259"></a><span> </span><span class="hs-identifier hs-type">I.Normalize</span><span> </span><span class="hs-special">(</span><a href="#local-6989586621679046570"><span class="hs-identifier hs-type">a</span></a><span class="hs-special">,</span><span> </span><a href="#local-6989586621679046571"><span class="hs-identifier hs-type">b</span></a><span class="hs-special">)</span><span> </span><span class="hs-glyph">~</span><span> </span><a href="Matrix.Internal.html#Normalize"><span class="hs-identifier hs-type">I.Normalize</span></a><span> </span><span class="hs-special">(</span><a href="Matrix.Internal.html#Normalize"><span class="hs-identifier hs-type">I.Normalize</span></a><span> </span><a href="#local-6989586621679046570"><span class="hs-identifier hs-type">a</span></a><span class="hs-special">,</span><span> </span><a href="Matrix.Internal.html#Normalize"><span class="hs-identifier hs-type">I.Normalize</span></a><span> </span><a href="#local-6989586621679046571"><span class="hs-identifier hs-type">b</span></a><span class="hs-special">)</span><span>
260+</span><a name="line-260"></a><span> </span><span class="hs-special">)</span><span> </span><span class="hs-glyph">=&gt;</span><span> </span><a href="Matrix.Type.html#Matrix"><span class="hs-identifier hs-type">Matrix</span></a><span> </span><a href="#local-6989586621679046572"><span class="hs-identifier hs-type">e</span></a><span> </span><a href="#local-6989586621679046573"><span class="hs-identifier hs-type">c</span></a><span> </span><a href="#local-6989586621679046570"><span class="hs-identifier hs-type">a</span></a><span> </span><span class="hs-glyph">-&gt;</span><span> </span><a href="Matrix.Type.html#Matrix"><span class="hs-identifier hs-type">Matrix</span></a><span> </span><a href="#local-6989586621679046572"><span class="hs-identifier hs-type">e</span></a><span> </span><a href="#local-6989586621679046573"><span class="hs-identifier hs-type">c</span></a><span> </span><a href="#local-6989586621679046571"><span class="hs-identifier hs-type">b</span></a><span> </span><span class="hs-glyph">-&gt;</span><span> </span><a href="Matrix.Type.html#Matrix"><span class="hs-identifier hs-type">Matrix</span></a><span> </span><a href="#local-6989586621679046572"><span class="hs-identifier hs-type">e</span></a><span> </span><a href="#local-6989586621679046573"><span class="hs-identifier hs-type">c</span></a><span> </span><span class="hs-special">(</span><a href="#local-6989586621679046570"><span class="hs-identifier hs-type">a</span></a><span class="hs-special">,</span><span> </span><a href="#local-6989586621679046571"><span class="hs-identifier hs-type">b</span></a><span class="hs-special">)</span><span>
261+</span><a name="line-261"></a><a name="multM"><a href="Matrix.Type.html#multM"><span class="hs-identifier">multM</span></a></a><span> </span><a name="local-6989586621679046603"><a href="#local-6989586621679046603"><span class="hs-identifier">a</span></a></a><span> </span><a name="local-6989586621679046604"><a href="#local-6989586621679046604"><span class="hs-identifier">b</span></a></a><span> </span><span class="hs-glyph">=</span><span> </span><a href="Matrix.Type.html#khatri"><span class="hs-identifier hs-var">khatri</span></a><span> </span><a href="#local-6989586621679046603"><span class="hs-identifier hs-var">a</span></a><span> </span><a href="#local-6989586621679046604"><span class="hs-identifier hs-var">b</span></a><span>
262+</span><a name="line-262"></a><span>
263+</span><a name="line-263"></a><span>
264+</span><a name="line-264"></a><span class="hs-comment">-- | Monad instance equivalent 'return' function,</span><span>
265+</span><a name="line-265"></a><span class="hs-identifier">returnM</span><span> </span><span class="hs-glyph">::</span><span>
266+</span><a name="line-266"></a><span> </span><span class="hs-keyword">forall</span><span> </span><a name="local-6989586621679046568"><a href="#local-6989586621679046568"><span class="hs-identifier">e</span></a></a><span> </span><a name="local-6989586621679046569"><a href="#local-6989586621679046569"><span class="hs-identifier">a</span></a></a><span> </span><span class="hs-operator">.</span><span>
267+</span><a name="line-267"></a><span> </span><span class="hs-special">(</span><span> </span><span class="hs-identifier hs-type">Num</span><span> </span><a href="#local-6989586621679046568"><span class="hs-identifier hs-type">e</span></a><span class="hs-special">,</span><span>
268+</span><a name="line-268"></a><span> </span><span class="hs-identifier hs-type">Enum</span><span> </span><a href="#local-6989586621679046568"><span class="hs-identifier hs-type">e</span></a><span class="hs-special">,</span><span>
269+</span><a name="line-269"></a><span> </span><span class="hs-identifier hs-type">Enum</span><span> </span><a href="#local-6989586621679046569"><span class="hs-identifier hs-type">a</span></a><span class="hs-special">,</span><span>
270+</span><a name="line-270"></a><span> </span><a href="Matrix.Internal.html#FromLists"><span class="hs-identifier hs-type">I.FromLists</span></a><span> </span><a href="#local-6989586621679046568"><span class="hs-identifier hs-type">e</span></a><span> </span><span class="hs-special">(</span><span class="hs-special">)</span><span> </span><span class="hs-special">(</span><a href="Matrix.Internal.html#Normalize"><span class="hs-identifier hs-type">I.Normalize</span></a><span> </span><a href="#local-6989586621679046569"><span class="hs-identifier hs-type">a</span></a><span class="hs-special">)</span><span class="hs-special">,</span><span>
271+</span><a name="line-271"></a><span> </span><span class="hs-identifier hs-type">KnownNat</span><span> </span><span class="hs-special">(</span><a href="Matrix.Internal.html#Count"><span class="hs-identifier hs-type">I.Count</span></a><span> </span><a href="#local-6989586621679046569"><span class="hs-identifier hs-type">a</span></a><span class="hs-special">)</span><span>
272+</span><a name="line-272"></a><span> </span><span class="hs-special">)</span><span> </span><span class="hs-glyph">=&gt;</span><span> </span><a href="#local-6989586621679046569"><span class="hs-identifier hs-type">a</span></a><span> </span><span class="hs-glyph">-&gt;</span><span> </span><a href="Matrix.Type.html#Matrix"><span class="hs-identifier hs-type">Matrix</span></a><span> </span><a href="#local-6989586621679046568"><span class="hs-identifier hs-type">e</span></a><span> </span><a href="Matrix.Type.html#One"><span class="hs-identifier hs-type">One</span></a><span> </span><a href="#local-6989586621679046569"><span class="hs-identifier hs-type">a</span></a><span>
273+</span><a name="line-273"></a><a name="returnM"><a href="Matrix.Type.html#returnM"><span class="hs-identifier">returnM</span></a></a><span> </span><a name="local-6989586621679046605"><a href="#local-6989586621679046605"><span class="hs-identifier">a</span></a></a><span> </span><span class="hs-glyph">=</span><span> </span><a href="Matrix.Type.html#col"><span class="hs-identifier hs-var">col</span></a><span> </span><a href="#local-6989586621679046608"><span class="hs-identifier hs-var">l</span></a><span>
274+</span><a name="line-274"></a><span> </span><span class="hs-keyword">where</span><span>
275+</span><a name="line-275"></a><span> </span><a name="local-6989586621679046606"><a href="#local-6989586621679046606"><span class="hs-identifier">i</span></a></a><span> </span><span class="hs-glyph">=</span><span> </span><span class="hs-identifier hs-var">fromInteger</span><span> </span><span class="hs-operator hs-var">$</span><span> </span><span class="hs-identifier hs-var">natVal</span><span> </span><span class="hs-special">(</span><span class="hs-identifier hs-var">Proxy</span><span> </span><span class="hs-glyph">::</span><span> </span><span class="hs-identifier hs-type">Proxy</span><span> </span><span class="hs-special">(</span><a href="Matrix.Internal.html#Count"><span class="hs-identifier hs-type">I.Count</span></a><span> </span><a href="#local-6989586621679046569"><span class="hs-identifier hs-type">a</span></a><span class="hs-special">)</span><span class="hs-special">)</span><span>
276+</span><a name="line-276"></a><span> </span><a name="local-6989586621679046607"><a href="#local-6989586621679046607"><span class="hs-identifier">x</span></a></a><span> </span><span class="hs-glyph">=</span><span> </span><span class="hs-identifier hs-var">fromEnum</span><span> </span><a href="#local-6989586621679046605"><span class="hs-identifier hs-var">a</span></a><span>
277+</span><a name="line-277"></a><span> </span><a name="local-6989586621679046608"><a href="#local-6989586621679046608"><span class="hs-identifier">l</span></a></a><span> </span><span class="hs-glyph">=</span><span> </span><span class="hs-identifier hs-var">take</span><span> </span><a href="#local-6989586621679046607"><span class="hs-identifier hs-var">x</span></a><span> </span><span class="hs-special">[</span><span class="hs-number">0</span><span class="hs-special">,</span><span class="hs-number">0</span><span class="hs-glyph">..</span><span class="hs-special">]</span><span> </span><span class="hs-operator hs-var">++</span><span> </span><span class="hs-special">[</span><span class="hs-number">1</span><span class="hs-special">]</span><span> </span><span class="hs-operator hs-var">++</span><span> </span><span class="hs-identifier hs-var">take</span><span> </span><span class="hs-special">(</span><a href="#local-6989586621679046606"><span class="hs-identifier hs-var">i</span></a><span> </span><span class="hs-glyph">-</span><span> </span><a href="#local-6989586621679046607"><span class="hs-identifier hs-var">x</span></a><span> </span><span class="hs-glyph">-</span><span> </span><span class="hs-number">1</span><span class="hs-special">)</span><span> </span><span class="hs-special">[</span><span class="hs-number">0</span><span class="hs-special">,</span><span class="hs-number">0</span><span class="hs-glyph">..</span><span class="hs-special">]</span><span>
278+</span><a name="line-278"></a><span>
279+</span><a name="line-279"></a><span class="hs-comment">-- | Monad instance equivalent '(&gt;&gt;=)' function,</span><span>
280+</span><a name="line-280"></a><span class="hs-identifier">bindM</span><span> </span><span class="hs-glyph">::</span><span> </span><span class="hs-special">(</span><span class="hs-identifier hs-type">Num</span><span> </span><a href="#local-6989586621679046564"><span class="hs-identifier hs-type">e</span></a><span class="hs-special">)</span><span> </span><span class="hs-glyph">=&gt;</span><span> </span><a href="Matrix.Type.html#Matrix"><span class="hs-identifier hs-type">Matrix</span></a><span> </span><a href="#local-6989586621679046564"><span class="hs-identifier hs-type">e</span></a><span> </span><a href="#local-6989586621679046565"><span class="hs-identifier hs-type">a</span></a><span> </span><a href="#local-6989586621679046566"><span class="hs-identifier hs-type">b</span></a><span> </span><span class="hs-glyph">-&gt;</span><span> </span><a href="Matrix.Type.html#Matrix"><span class="hs-identifier hs-type">Matrix</span></a><span> </span><a href="#local-6989586621679046564"><span class="hs-identifier hs-type">e</span></a><span> </span><a href="#local-6989586621679046566"><span class="hs-identifier hs-type">b</span></a><span> </span><a href="#local-6989586621679046567"><span class="hs-identifier hs-type">c</span></a><span> </span><span class="hs-glyph">-&gt;</span><span> </span><a href="Matrix.Type.html#Matrix"><span class="hs-identifier hs-type">Matrix</span></a><span> </span><a href="#local-6989586621679046564"><span class="hs-identifier hs-type">e</span></a><span> </span><a href="#local-6989586621679046565"><span class="hs-identifier hs-type">a</span></a><span> </span><a href="#local-6989586621679046567"><span class="hs-identifier hs-type">c</span></a><span>
281+</span><a name="line-281"></a><a name="bindM"><a href="Matrix.Type.html#bindM"><span class="hs-identifier">bindM</span></a></a><span> </span><span class="hs-glyph">=</span><span> </span><span class="hs-identifier hs-var">flip</span><span> </span><a href="Matrix.Type.html#comp"><span class="hs-identifier hs-var">comp</span></a><span>
282+</span><a name="line-282"></a><span>
283+</span><a name="line-283"></a><span class="hs-comment">-- Construction</span><span>
284+</span><a name="line-284"></a><span>
285+</span><a name="line-285"></a><span class="hs-comment">-- | Build a matrix out of a list of list of elements. Throws a runtime</span><span>
286+</span><a name="line-286"></a><span class="hs-comment">-- error if the dimensions do not match.</span><span>
287+</span><a name="line-287"></a><span class="hs-identifier">fromLists</span><span> </span><span class="hs-glyph">::</span><span> </span><span class="hs-special">(</span><a href="Matrix.Internal.html#FromLists"><span class="hs-identifier hs-type">I.FromLists</span></a><span> </span><a href="#local-6989586621679046561"><span class="hs-identifier hs-type">e</span></a><span> </span><span class="hs-special">(</span><a href="Matrix.Internal.html#Normalize"><span class="hs-identifier hs-type">I.Normalize</span></a><span> </span><a href="#local-6989586621679046562"><span class="hs-identifier hs-type">cols</span></a><span class="hs-special">)</span><span> </span><span class="hs-special">(</span><a href="Matrix.Internal.html#Normalize"><span class="hs-identifier hs-type">I.Normalize</span></a><span> </span><a href="#local-6989586621679046563"><span class="hs-identifier hs-type">rows</span></a><span class="hs-special">)</span><span class="hs-special">)</span><span> </span><span class="hs-glyph">=&gt;</span><span> </span><span class="hs-special">[</span><span class="hs-special">[</span><a href="#local-6989586621679046561"><span class="hs-identifier hs-type">e</span></a><span class="hs-special">]</span><span class="hs-special">]</span><span> </span><span class="hs-glyph">-&gt;</span><span> </span><a href="Matrix.Type.html#Matrix"><span class="hs-identifier hs-type">Matrix</span></a><span> </span><a href="#local-6989586621679046561"><span class="hs-identifier hs-type">e</span></a><span> </span><a href="#local-6989586621679046562"><span class="hs-identifier hs-type">cols</span></a><span> </span><a href="#local-6989586621679046563"><span class="hs-identifier hs-type">rows</span></a><span>
288+</span><a name="line-288"></a><a name="fromLists"><a href="Matrix.Type.html#fromLists"><span class="hs-identifier">fromLists</span></a></a><span> </span><span class="hs-glyph">=</span><span> </span><a href="Matrix.Type.html#M"><span class="hs-identifier hs-var">M</span></a><span> </span><span class="hs-operator hs-var">.</span><span> </span><a href="Matrix.Internal.html#fromLists"><span class="hs-identifier hs-var">I.fromLists</span></a><span>
289+</span><a name="line-289"></a><span>
290+</span><a name="line-290"></a><span class="hs-comment">-- | Matrix builder function. Constructs a matrix provided with</span><span>
291+</span><a name="line-291"></a><span class="hs-comment">-- a construction function.</span><span>
292+</span><a name="line-292"></a><span class="hs-identifier">matrixBuilder</span><span> </span><span class="hs-glyph">::</span><span>
293+</span><a name="line-293"></a><span> </span><span class="hs-special">(</span><a href="Matrix.Internal.html#FromLists"><span class="hs-identifier hs-type">I.FromLists</span></a><span> </span><a href="#local-6989586621679046558"><span class="hs-identifier hs-type">e</span></a><span> </span><span class="hs-special">(</span><a href="Matrix.Internal.html#Normalize"><span class="hs-identifier hs-type">I.Normalize</span></a><span> </span><a href="#local-6989586621679046559"><span class="hs-identifier hs-type">cols</span></a><span class="hs-special">)</span><span> </span><span class="hs-special">(</span><a href="Matrix.Internal.html#Normalize"><span class="hs-identifier hs-type">I.Normalize</span></a><span> </span><a href="#local-6989586621679046560"><span class="hs-identifier hs-type">rows</span></a><span class="hs-special">)</span><span class="hs-special">,</span><span> </span><span class="hs-identifier hs-type">KnownNat</span><span> </span><span class="hs-special">(</span><a href="Matrix.Internal.html#Count"><span class="hs-identifier hs-type">I.Count</span></a><span> </span><span class="hs-special">(</span><a href="Matrix.Internal.html#Normalize"><span class="hs-identifier hs-type">I.Normalize</span></a><span> </span><a href="#local-6989586621679046559"><span class="hs-identifier hs-type">cols</span></a><span class="hs-special">)</span><span class="hs-special">)</span><span class="hs-special">,</span><span> </span><span class="hs-identifier hs-type">KnownNat</span><span> </span><span class="hs-special">(</span><a href="Matrix.Internal.html#Count"><span class="hs-identifier hs-type">I.Count</span></a><span> </span><span class="hs-special">(</span><a href="Matrix.Internal.html#Normalize"><span class="hs-identifier hs-type">I.Normalize</span></a><span> </span><a href="#local-6989586621679046560"><span class="hs-identifier hs-type">rows</span></a><span class="hs-special">)</span><span class="hs-special">)</span><span class="hs-special">)</span><span> </span><span class="hs-glyph">=&gt;</span><span>
294+</span><a name="line-294"></a><span> </span><span class="hs-special">(</span><span class="hs-special">(</span><span class="hs-identifier hs-type">Int</span><span class="hs-special">,</span><span> </span><span class="hs-identifier hs-type">Int</span><span class="hs-special">)</span><span> </span><span class="hs-glyph">-&gt;</span><span> </span><a href="#local-6989586621679046558"><span class="hs-identifier hs-type">e</span></a><span class="hs-special">)</span><span> </span><span class="hs-glyph">-&gt;</span><span>
295+</span><a name="line-295"></a><span> </span><a href="Matrix.Type.html#Matrix"><span class="hs-identifier hs-type">Matrix</span></a><span> </span><a href="#local-6989586621679046558"><span class="hs-identifier hs-type">e</span></a><span> </span><a href="#local-6989586621679046559"><span class="hs-identifier hs-type">cols</span></a><span> </span><a href="#local-6989586621679046560"><span class="hs-identifier hs-type">rows</span></a><span>
296+</span><a name="line-296"></a><a name="matrixBuilder"><a href="Matrix.Type.html#matrixBuilder"><span class="hs-identifier">matrixBuilder</span></a></a><span> </span><span class="hs-glyph">=</span><span> </span><a href="Matrix.Type.html#M"><span class="hs-identifier hs-var">M</span></a><span> </span><span class="hs-operator hs-var">.</span><span> </span><a href="Matrix.Internal.html#matrixBuilder"><span class="hs-identifier hs-var">I.matrixBuilder</span></a><span>
297+</span><a name="line-297"></a><span>
298+</span><a name="line-298"></a><span class="hs-comment">-- | Constructs a column vector matrix</span><span>
299+</span><a name="line-299"></a><span class="hs-identifier">col</span><span> </span><span class="hs-glyph">::</span><span> </span><span class="hs-special">(</span><a href="Matrix.Internal.html#FromLists"><span class="hs-identifier hs-type">I.FromLists</span></a><span> </span><a href="#local-6989586621679046556"><span class="hs-identifier hs-type">e</span></a><span> </span><span class="hs-special">(</span><span class="hs-special">)</span><span> </span><span class="hs-special">(</span><a href="Matrix.Internal.html#Normalize"><span class="hs-identifier hs-type">I.Normalize</span></a><span> </span><a href="#local-6989586621679046557"><span class="hs-identifier hs-type">rows</span></a><span class="hs-special">)</span><span class="hs-special">)</span><span> </span><span class="hs-glyph">=&gt;</span><span> </span><span class="hs-special">[</span><a href="#local-6989586621679046556"><span class="hs-identifier hs-type">e</span></a><span class="hs-special">]</span><span> </span><span class="hs-glyph">-&gt;</span><span> </span><a href="Matrix.Type.html#Matrix"><span class="hs-identifier hs-type">Matrix</span></a><span> </span><a href="#local-6989586621679046556"><span class="hs-identifier hs-type">e</span></a><span> </span><a href="Matrix.Type.html#One"><span class="hs-identifier hs-type">One</span></a><span> </span><a href="#local-6989586621679046557"><span class="hs-identifier hs-type">rows</span></a><span>
300+</span><a name="line-300"></a><a name="col"><a href="Matrix.Type.html#col"><span class="hs-identifier">col</span></a></a><span> </span><span class="hs-glyph">=</span><span> </span><a href="Matrix.Type.html#M"><span class="hs-identifier hs-var">M</span></a><span> </span><span class="hs-operator hs-var">.</span><span> </span><a href="Matrix.Internal.html#col"><span class="hs-identifier hs-var">I.col</span></a><span>
301+</span><a name="line-301"></a><span>
302+</span><a name="line-302"></a><span class="hs-comment">-- | Constructs a row vector matrix</span><span>
303+</span><a name="line-303"></a><span class="hs-identifier">row</span><span> </span><span class="hs-glyph">::</span><span> </span><span class="hs-special">(</span><a href="Matrix.Internal.html#FromLists"><span class="hs-identifier hs-type">I.FromLists</span></a><span> </span><a href="#local-6989586621679046554"><span class="hs-identifier hs-type">e</span></a><span> </span><span class="hs-special">(</span><a href="Matrix.Internal.html#Normalize"><span class="hs-identifier hs-type">I.Normalize</span></a><span> </span><a href="#local-6989586621679046555"><span class="hs-identifier hs-type">cols</span></a><span class="hs-special">)</span><span> </span><span class="hs-special">(</span><span class="hs-special">)</span><span class="hs-special">)</span><span> </span><span class="hs-glyph">=&gt;</span><span> </span><span class="hs-special">[</span><a href="#local-6989586621679046554"><span class="hs-identifier hs-type">e</span></a><span class="hs-special">]</span><span> </span><span class="hs-glyph">-&gt;</span><span> </span><a href="Matrix.Type.html#Matrix"><span class="hs-identifier hs-type">Matrix</span></a><span> </span><a href="#local-6989586621679046554"><span class="hs-identifier hs-type">e</span></a><span> </span><a href="#local-6989586621679046555"><span class="hs-identifier hs-type">cols</span></a><span> </span><a href="Matrix.Type.html#One"><span class="hs-identifier hs-type">One</span></a><span>
304+</span><a name="line-304"></a><a name="row"><a href="Matrix.Type.html#row"><span class="hs-identifier">row</span></a></a><span> </span><span class="hs-glyph">=</span><span> </span><a href="Matrix.Type.html#M"><span class="hs-identifier hs-var">M</span></a><span> </span><span class="hs-operator hs-var">.</span><span> </span><a href="Matrix.Internal.html#row"><span class="hs-identifier hs-var">I.row</span></a><span>
305+</span><a name="line-305"></a><span>
306+</span><a name="line-306"></a><span class="hs-comment">-- | Lifts functions to matrices with arbitrary dimensions.</span><span>
307+</span><a name="line-307"></a><span class="hs-comment">--</span><span>
308+</span><a name="line-308"></a><span class="hs-comment">-- NOTE: Be careful to not ask for a matrix bigger than the cardinality of</span><span>
309+</span><a name="line-309"></a><span class="hs-comment">-- types @a@ or @b@ allows.</span><span>
310+</span><a name="line-310"></a><span class="hs-identifier">fromF</span><span> </span><span class="hs-glyph">::</span><span>
311+</span><a name="line-311"></a><span> </span><span class="hs-special">(</span><span> </span><span class="hs-identifier hs-type">Bounded</span><span> </span><a href="#local-6989586621679046549"><span class="hs-identifier hs-type">a</span></a><span class="hs-special">,</span><span>
312+</span><a name="line-312"></a><span> </span><span class="hs-identifier hs-type">Bounded</span><span> </span><a href="#local-6989586621679046550"><span class="hs-identifier hs-type">b</span></a><span class="hs-special">,</span><span>
313+</span><a name="line-313"></a><span> </span><span class="hs-identifier hs-type">Enum</span><span> </span><a href="#local-6989586621679046549"><span class="hs-identifier hs-type">a</span></a><span class="hs-special">,</span><span>
314+</span><a name="line-314"></a><span> </span><span class="hs-identifier hs-type">Enum</span><span> </span><a href="#local-6989586621679046550"><span class="hs-identifier hs-type">b</span></a><span class="hs-special">,</span><span>
315+</span><a name="line-315"></a><span> </span><span class="hs-identifier hs-type">Eq</span><span> </span><a href="#local-6989586621679046550"><span class="hs-identifier hs-type">b</span></a><span class="hs-special">,</span><span>
316+</span><a name="line-316"></a><span> </span><span class="hs-identifier hs-type">Num</span><span> </span><a href="#local-6989586621679046551"><span class="hs-identifier hs-type">e</span></a><span class="hs-special">,</span><span>
317+</span><a name="line-317"></a><span> </span><span class="hs-identifier hs-type">Ord</span><span> </span><a href="#local-6989586621679046551"><span class="hs-identifier hs-type">e</span></a><span class="hs-special">,</span><span>
318+</span><a name="line-318"></a><span> </span><span class="hs-identifier hs-type">KnownNat</span><span> </span><span class="hs-special">(</span><a href="Matrix.Internal.html#Count"><span class="hs-identifier hs-type">I.Count</span></a><span> </span><span class="hs-special">(</span><a href="Matrix.Internal.html#Normalize"><span class="hs-identifier hs-type">I.Normalize</span></a><span> </span><a href="#local-6989586621679046552"><span class="hs-identifier hs-type">cols</span></a><span class="hs-special">)</span><span class="hs-special">)</span><span class="hs-special">,</span><span>
319+</span><a name="line-319"></a><span> </span><span class="hs-identifier hs-type">KnownNat</span><span> </span><span class="hs-special">(</span><a href="Matrix.Internal.html#Count"><span class="hs-identifier hs-type">I.Count</span></a><span> </span><span class="hs-special">(</span><a href="Matrix.Internal.html#Normalize"><span class="hs-identifier hs-type">I.Normalize</span></a><span> </span><a href="#local-6989586621679046553"><span class="hs-identifier hs-type">rows</span></a><span class="hs-special">)</span><span class="hs-special">)</span><span class="hs-special">,</span><span>
320+</span><a name="line-320"></a><span> </span><a href="Matrix.Internal.html#FromLists"><span class="hs-identifier hs-type">I.FromLists</span></a><span> </span><a href="#local-6989586621679046551"><span class="hs-identifier hs-type">e</span></a><span> </span><span class="hs-special">(</span><a href="Matrix.Internal.html#Normalize"><span class="hs-identifier hs-type">I.Normalize</span></a><span> </span><a href="#local-6989586621679046553"><span class="hs-identifier hs-type">rows</span></a><span class="hs-special">)</span><span> </span><span class="hs-special">(</span><a href="Matrix.Internal.html#Normalize"><span class="hs-identifier hs-type">I.Normalize</span></a><span> </span><a href="#local-6989586621679046552"><span class="hs-identifier hs-type">cols</span></a><span class="hs-special">)</span><span>
321+</span><a name="line-321"></a><span> </span><span class="hs-special">)</span><span> </span><span class="hs-glyph">=&gt;</span><span>
322+</span><a name="line-322"></a><span> </span><span class="hs-special">(</span><a href="#local-6989586621679046549"><span class="hs-identifier hs-type">a</span></a><span> </span><span class="hs-glyph">-&gt;</span><span> </span><a href="#local-6989586621679046550"><span class="hs-identifier hs-type">b</span></a><span class="hs-special">)</span><span> </span><span class="hs-glyph">-&gt;</span><span>
323+</span><a name="line-323"></a><span> </span><a href="Matrix.Type.html#Matrix"><span class="hs-identifier hs-type">Matrix</span></a><span> </span><a href="#local-6989586621679046551"><span class="hs-identifier hs-type">e</span></a><span> </span><a href="#local-6989586621679046552"><span class="hs-identifier hs-type">cols</span></a><span> </span><a href="#local-6989586621679046553"><span class="hs-identifier hs-type">rows</span></a><span>
324+</span><a name="line-324"></a><a name="fromF"><a href="Matrix.Type.html#fromF"><span class="hs-identifier">fromF</span></a></a><span> </span><span class="hs-glyph">=</span><span> </span><a href="Matrix.Type.html#M"><span class="hs-identifier hs-var">M</span></a><span> </span><span class="hs-operator hs-var">.</span><span> </span><a href="Matrix.Internal.html#fromF"><span class="hs-identifier hs-var">I.fromF</span></a><span>
325+</span><a name="line-325"></a><span>
326+</span><a name="line-326"></a><span class="hs-comment">-- | Lifts functions to matrices with dimensions matching @a@ and @b@</span><span>
327+</span><a name="line-327"></a><span class="hs-comment">-- cardinality's.</span><span>
328+</span><a name="line-328"></a><span class="hs-identifier">fromF'</span><span> </span><span class="hs-glyph">::</span><span>
329+</span><a name="line-329"></a><span> </span><span class="hs-special">(</span><span> </span><span class="hs-identifier hs-type">Bounded</span><span> </span><a href="#local-6989586621679046546"><span class="hs-identifier hs-type">a</span></a><span class="hs-special">,</span><span>
330+</span><a name="line-330"></a><span> </span><span class="hs-identifier hs-type">Bounded</span><span> </span><a href="#local-6989586621679046547"><span class="hs-identifier hs-type">b</span></a><span class="hs-special">,</span><span>
331+</span><a name="line-331"></a><span> </span><span class="hs-identifier hs-type">Enum</span><span> </span><a href="#local-6989586621679046546"><span class="hs-identifier hs-type">a</span></a><span class="hs-special">,</span><span>
332+</span><a name="line-332"></a><span> </span><span class="hs-identifier hs-type">Enum</span><span> </span><a href="#local-6989586621679046547"><span class="hs-identifier hs-type">b</span></a><span class="hs-special">,</span><span>
333+</span><a name="line-333"></a><span> </span><span class="hs-identifier hs-type">Eq</span><span> </span><a href="#local-6989586621679046547"><span class="hs-identifier hs-type">b</span></a><span class="hs-special">,</span><span>
334+</span><a name="line-334"></a><span> </span><span class="hs-identifier hs-type">Num</span><span> </span><a href="#local-6989586621679046548"><span class="hs-identifier hs-type">e</span></a><span class="hs-special">,</span><span>
335+</span><a name="line-335"></a><span> </span><span class="hs-identifier hs-type">Ord</span><span> </span><a href="#local-6989586621679046548"><span class="hs-identifier hs-type">e</span></a><span class="hs-special">,</span><span>
336+</span><a name="line-336"></a><span> </span><span class="hs-identifier hs-type">KnownNat</span><span> </span><span class="hs-special">(</span><a href="Matrix.Internal.html#Count"><span class="hs-identifier hs-type">I.Count</span></a><span> </span><span class="hs-special">(</span><a href="Matrix.Internal.html#Normalize"><span class="hs-identifier hs-type">I.Normalize</span></a><span> </span><a href="#local-6989586621679046546"><span class="hs-identifier hs-type">a</span></a><span class="hs-special">)</span><span class="hs-special">)</span><span class="hs-special">,</span><span>
337+</span><a name="line-337"></a><span> </span><span class="hs-identifier hs-type">KnownNat</span><span> </span><span class="hs-special">(</span><a href="Matrix.Internal.html#Count"><span class="hs-identifier hs-type">I.Count</span></a><span> </span><span class="hs-special">(</span><a href="Matrix.Internal.html#Normalize"><span class="hs-identifier hs-type">I.Normalize</span></a><span> </span><a href="#local-6989586621679046547"><span class="hs-identifier hs-type">b</span></a><span class="hs-special">)</span><span class="hs-special">)</span><span class="hs-special">,</span><span>
338+</span><a name="line-338"></a><span> </span><a href="Matrix.Internal.html#FromLists"><span class="hs-identifier hs-type">I.FromLists</span></a><span> </span><a href="#local-6989586621679046548"><span class="hs-identifier hs-type">e</span></a><span> </span><span class="hs-special">(</span><a href="Matrix.Internal.html#Normalize"><span class="hs-identifier hs-type">I.Normalize</span></a><span> </span><a href="#local-6989586621679046547"><span class="hs-identifier hs-type">b</span></a><span class="hs-special">)</span><span> </span><span class="hs-special">(</span><a href="Matrix.Internal.html#Normalize"><span class="hs-identifier hs-type">I.Normalize</span></a><span> </span><a href="#local-6989586621679046546"><span class="hs-identifier hs-type">a</span></a><span class="hs-special">)</span><span>
339+</span><a name="line-339"></a><span> </span><span class="hs-special">)</span><span> </span><span class="hs-glyph">=&gt;</span><span>
340+</span><a name="line-340"></a><span> </span><span class="hs-special">(</span><a href="#local-6989586621679046546"><span class="hs-identifier hs-type">a</span></a><span> </span><span class="hs-glyph">-&gt;</span><span> </span><a href="#local-6989586621679046547"><span class="hs-identifier hs-type">b</span></a><span class="hs-special">)</span><span> </span><span class="hs-glyph">-&gt;</span><span>
341+</span><a name="line-341"></a><span> </span><a href="Matrix.Type.html#Matrix"><span class="hs-identifier hs-type">Matrix</span></a><span> </span><a href="#local-6989586621679046548"><span class="hs-identifier hs-type">e</span></a><span> </span><a href="#local-6989586621679046546"><span class="hs-identifier hs-type">a</span></a><span> </span><a href="#local-6989586621679046547"><span class="hs-identifier hs-type">b</span></a><span>
342+</span><a name="line-342"></a><a name="fromF%27"><a href="Matrix.Type.html#fromF%27"><span class="hs-identifier">fromF'</span></a></a><span> </span><span class="hs-glyph">=</span><span> </span><a href="Matrix.Type.html#M"><span class="hs-identifier hs-var">M</span></a><span> </span><span class="hs-operator hs-var">.</span><span> </span><a href="Matrix.Internal.html#fromF%27"><span class="hs-identifier hs-var">I.fromF'</span></a><span>
343+</span><a name="line-343"></a><span>
344+</span><a name="line-344"></a><span class="hs-comment">-- Conversion</span><span>
345+</span><a name="line-345"></a><span>
346+</span><a name="line-346"></a><span class="hs-comment">-- | Converts a matrix to a list of lists of elements.</span><span>
347+</span><a name="line-347"></a><span class="hs-identifier">toLists</span><span> </span><span class="hs-glyph">::</span><span> </span><a href="Matrix.Type.html#Matrix"><span class="hs-identifier hs-type">Matrix</span></a><span> </span><a href="#local-6989586621679046543"><span class="hs-identifier hs-type">e</span></a><span> </span><a href="#local-6989586621679046544"><span class="hs-identifier hs-type">cols</span></a><span> </span><a href="#local-6989586621679046545"><span class="hs-identifier hs-type">rows</span></a><span> </span><span class="hs-glyph">-&gt;</span><span> </span><span class="hs-special">[</span><span class="hs-special">[</span><a href="#local-6989586621679046543"><span class="hs-identifier hs-type">e</span></a><span class="hs-special">]</span><span class="hs-special">]</span><span>
348+</span><a name="line-348"></a><a name="toLists"><a href="Matrix.Type.html#toLists"><span class="hs-identifier">toLists</span></a></a><span> </span><span class="hs-special">(</span><a href="Matrix.Type.html#M"><span class="hs-identifier hs-var">M</span></a><span> </span><a name="local-6989586621679046609"><a href="#local-6989586621679046609"><span class="hs-identifier">m</span></a></a><span class="hs-special">)</span><span> </span><span class="hs-glyph">=</span><span> </span><a href="Matrix.Internal.html#toLists"><span class="hs-identifier hs-var">I.toLists</span></a><span> </span><a href="#local-6989586621679046609"><span class="hs-identifier hs-var">m</span></a><span>
349+</span><a name="line-349"></a><span>
350+</span><a name="line-350"></a><span class="hs-comment">-- | Converts a matrix to a list of elements.</span><span>
351+</span><a name="line-351"></a><span class="hs-identifier">toList</span><span> </span><span class="hs-glyph">::</span><span> </span><a href="Matrix.Type.html#Matrix"><span class="hs-identifier hs-type">Matrix</span></a><span> </span><a href="#local-6989586621679046540"><span class="hs-identifier hs-type">e</span></a><span> </span><a href="#local-6989586621679046541"><span class="hs-identifier hs-type">cols</span></a><span> </span><a href="#local-6989586621679046542"><span class="hs-identifier hs-type">rows</span></a><span> </span><span class="hs-glyph">-&gt;</span><span> </span><span class="hs-special">[</span><a href="#local-6989586621679046540"><span class="hs-identifier hs-type">e</span></a><span class="hs-special">]</span><span>
352+</span><a name="line-352"></a><a name="toList"><a href="Matrix.Type.html#toList"><span class="hs-identifier">toList</span></a></a><span> </span><span class="hs-special">(</span><a href="Matrix.Type.html#M"><span class="hs-identifier hs-var">M</span></a><span> </span><a name="local-6989586621679046610"><a href="#local-6989586621679046610"><span class="hs-identifier">m</span></a></a><span class="hs-special">)</span><span> </span><span class="hs-glyph">=</span><span> </span><a href="Matrix.Internal.html#toList"><span class="hs-identifier hs-var">I.toList</span></a><span> </span><a href="#local-6989586621679046610"><span class="hs-identifier hs-var">m</span></a><span>
353+</span><a name="line-353"></a><span>
354+</span><a name="line-354"></a><span class="hs-comment">-- Zeros Matrix</span><span>
355+</span><a name="line-355"></a><span>
356+</span><a name="line-356"></a><span class="hs-comment">-- | The zero matrix. A matrix wholly filled with zeros.</span><span>
357+</span><a name="line-357"></a><span class="hs-identifier">zeros</span><span> </span><span class="hs-glyph">::</span><span>
358+</span><a name="line-358"></a><span> </span><span class="hs-special">(</span><span class="hs-identifier hs-type">Num</span><span> </span><a href="#local-6989586621679046537"><span class="hs-identifier hs-type">e</span></a><span class="hs-special">,</span><span> </span><a href="Matrix.Internal.html#FromLists"><span class="hs-identifier hs-type">I.FromLists</span></a><span> </span><a href="#local-6989586621679046537"><span class="hs-identifier hs-type">e</span></a><span> </span><span class="hs-special">(</span><a href="Matrix.Internal.html#Normalize"><span class="hs-identifier hs-type">I.Normalize</span></a><span> </span><a href="#local-6989586621679046538"><span class="hs-identifier hs-type">cols</span></a><span class="hs-special">)</span><span> </span><span class="hs-special">(</span><a href="Matrix.Internal.html#Normalize"><span class="hs-identifier hs-type">I.Normalize</span></a><span> </span><a href="#local-6989586621679046539"><span class="hs-identifier hs-type">rows</span></a><span class="hs-special">)</span><span class="hs-special">,</span><span> </span><span class="hs-identifier hs-type">KnownNat</span><span> </span><span class="hs-special">(</span><a href="Matrix.Internal.html#Count"><span class="hs-identifier hs-type">I.Count</span></a><span> </span><span class="hs-special">(</span><a href="Matrix.Internal.html#Normalize"><span class="hs-identifier hs-type">I.Normalize</span></a><span> </span><a href="#local-6989586621679046538"><span class="hs-identifier hs-type">cols</span></a><span class="hs-special">)</span><span class="hs-special">)</span><span class="hs-special">,</span><span> </span><span class="hs-identifier hs-type">KnownNat</span><span> </span><span class="hs-special">(</span><a href="Matrix.Internal.html#Count"><span class="hs-identifier hs-type">I.Count</span></a><span> </span><span class="hs-special">(</span><a href="Matrix.Internal.html#Normalize"><span class="hs-identifier hs-type">I.Normalize</span></a><span> </span><a href="#local-6989586621679046539"><span class="hs-identifier hs-type">rows</span></a><span class="hs-special">)</span><span class="hs-special">)</span><span class="hs-special">)</span><span> </span><span class="hs-glyph">=&gt;</span><span>
359+</span><a name="line-359"></a><span> </span><a href="Matrix.Type.html#Matrix"><span class="hs-identifier hs-type">Matrix</span></a><span> </span><a href="#local-6989586621679046537"><span class="hs-identifier hs-type">e</span></a><span> </span><a href="#local-6989586621679046538"><span class="hs-identifier hs-type">cols</span></a><span> </span><a href="#local-6989586621679046539"><span class="hs-identifier hs-type">rows</span></a><span>
360+</span><a name="line-360"></a><a name="zeros"><a href="Matrix.Type.html#zeros"><span class="hs-identifier">zeros</span></a></a><span> </span><span class="hs-glyph">=</span><span> </span><a href="Matrix.Type.html#M"><span class="hs-identifier hs-var">M</span></a><span> </span><a href="Matrix.Internal.html#zeros"><span class="hs-identifier hs-var">I.zeros</span></a><span>
361+</span><a name="line-361"></a><span>
362+</span><a name="line-362"></a><span class="hs-comment">-- Ones Matrix</span><span>
363+</span><a name="line-363"></a><span>
364+</span><a name="line-364"></a><span class="hs-comment">-- | The ones matrix. A matrix wholly filled with ones.</span><span>
365+</span><a name="line-365"></a><span class="hs-comment">--</span><span>
366+</span><a name="line-366"></a><span class="hs-comment">-- Also known as T (Top) matrix.</span><span>
367+</span><a name="line-367"></a><span class="hs-identifier">ones</span><span> </span><span class="hs-glyph">::</span><span>
368+</span><a name="line-368"></a><span> </span><span class="hs-special">(</span><span class="hs-identifier hs-type">Num</span><span> </span><a href="#local-6989586621679046534"><span class="hs-identifier hs-type">e</span></a><span class="hs-special">,</span><span> </span><a href="Matrix.Internal.html#FromLists"><span class="hs-identifier hs-type">I.FromLists</span></a><span> </span><a href="#local-6989586621679046534"><span class="hs-identifier hs-type">e</span></a><span> </span><span class="hs-special">(</span><a href="Matrix.Internal.html#Normalize"><span class="hs-identifier hs-type">I.Normalize</span></a><span> </span><a href="#local-6989586621679046535"><span class="hs-identifier hs-type">cols</span></a><span class="hs-special">)</span><span> </span><span class="hs-special">(</span><a href="Matrix.Internal.html#Normalize"><span class="hs-identifier hs-type">I.Normalize</span></a><span> </span><a href="#local-6989586621679046536"><span class="hs-identifier hs-type">rows</span></a><span class="hs-special">)</span><span class="hs-special">,</span><span> </span><span class="hs-identifier hs-type">KnownNat</span><span> </span><span class="hs-special">(</span><a href="Matrix.Internal.html#Count"><span class="hs-identifier hs-type">I.Count</span></a><span> </span><span class="hs-special">(</span><a href="Matrix.Internal.html#Normalize"><span class="hs-identifier hs-type">I.Normalize</span></a><span> </span><a href="#local-6989586621679046535"><span class="hs-identifier hs-type">cols</span></a><span class="hs-special">)</span><span class="hs-special">)</span><span class="hs-special">,</span><span> </span><span class="hs-identifier hs-type">KnownNat</span><span> </span><span class="hs-special">(</span><a href="Matrix.Internal.html#Count"><span class="hs-identifier hs-type">I.Count</span></a><span> </span><span class="hs-special">(</span><a href="Matrix.Internal.html#Normalize"><span class="hs-identifier hs-type">I.Normalize</span></a><span> </span><a href="#local-6989586621679046536"><span class="hs-identifier hs-type">rows</span></a><span class="hs-special">)</span><span class="hs-special">)</span><span class="hs-special">)</span><span> </span><span class="hs-glyph">=&gt;</span><span>
369+</span><a name="line-369"></a><span> </span><a href="Matrix.Type.html#Matrix"><span class="hs-identifier hs-type">Matrix</span></a><span> </span><a href="#local-6989586621679046534"><span class="hs-identifier hs-type">e</span></a><span> </span><a href="#local-6989586621679046535"><span class="hs-identifier hs-type">cols</span></a><span> </span><a href="#local-6989586621679046536"><span class="hs-identifier hs-type">rows</span></a><span>
370+</span><a name="line-370"></a><a name="ones"><a href="Matrix.Type.html#ones"><span class="hs-identifier">ones</span></a></a><span> </span><span class="hs-glyph">=</span><span> </span><a href="Matrix.Type.html#M"><span class="hs-identifier hs-var">M</span></a><span> </span><a href="Matrix.Internal.html#ones"><span class="hs-identifier hs-var">I.ones</span></a><span>
371+</span><a name="line-371"></a><span>
372+</span><a name="line-372"></a><span class="hs-comment">-- Const Matrix</span><span>
373+</span><a name="line-373"></a><span>
374+</span><a name="line-374"></a><span class="hs-comment">-- | The constant matrix constructor. A matrix wholly filled with a given</span><span>
375+</span><a name="line-375"></a><span class="hs-comment">-- value.</span><span>
376+</span><a name="line-376"></a><span class="hs-identifier">constant</span><span> </span><span class="hs-glyph">::</span><span>
377+</span><a name="line-377"></a><span> </span><span class="hs-special">(</span><span class="hs-identifier hs-type">Num</span><span> </span><a href="#local-6989586621679046531"><span class="hs-identifier hs-type">e</span></a><span class="hs-special">,</span><span> </span><a href="Matrix.Internal.html#FromLists"><span class="hs-identifier hs-type">I.FromLists</span></a><span> </span><a href="#local-6989586621679046531"><span class="hs-identifier hs-type">e</span></a><span> </span><span class="hs-special">(</span><a href="Matrix.Internal.html#Normalize"><span class="hs-identifier hs-type">I.Normalize</span></a><span> </span><a href="#local-6989586621679046532"><span class="hs-identifier hs-type">cols</span></a><span class="hs-special">)</span><span> </span><span class="hs-special">(</span><a href="Matrix.Internal.html#Normalize"><span class="hs-identifier hs-type">I.Normalize</span></a><span> </span><a href="#local-6989586621679046533"><span class="hs-identifier hs-type">rows</span></a><span class="hs-special">)</span><span class="hs-special">,</span><span> </span><span class="hs-identifier hs-type">KnownNat</span><span> </span><span class="hs-special">(</span><a href="Matrix.Internal.html#Count"><span class="hs-identifier hs-type">I.Count</span></a><span> </span><span class="hs-special">(</span><a href="Matrix.Internal.html#Normalize"><span class="hs-identifier hs-type">I.Normalize</span></a><span> </span><a href="#local-6989586621679046532"><span class="hs-identifier hs-type">cols</span></a><span class="hs-special">)</span><span class="hs-special">)</span><span class="hs-special">,</span><span> </span><span class="hs-identifier hs-type">KnownNat</span><span> </span><span class="hs-special">(</span><a href="Matrix.Internal.html#Count"><span class="hs-identifier hs-type">I.Count</span></a><span> </span><span class="hs-special">(</span><a href="Matrix.Internal.html#Normalize"><span class="hs-identifier hs-type">I.Normalize</span></a><span> </span><a href="#local-6989586621679046533"><span class="hs-identifier hs-type">rows</span></a><span class="hs-special">)</span><span class="hs-special">)</span><span class="hs-special">)</span><span> </span><span class="hs-glyph">=&gt;</span><span>
378+</span><a name="line-378"></a><span> </span><a href="#local-6989586621679046531"><span class="hs-identifier hs-type">e</span></a><span> </span><span class="hs-glyph">-&gt;</span><span>
379+</span><a name="line-379"></a><span> </span><a href="Matrix.Type.html#Matrix"><span class="hs-identifier hs-type">Matrix</span></a><span> </span><a href="#local-6989586621679046531"><span class="hs-identifier hs-type">e</span></a><span> </span><a href="#local-6989586621679046532"><span class="hs-identifier hs-type">cols</span></a><span> </span><a href="#local-6989586621679046533"><span class="hs-identifier hs-type">rows</span></a><span>
380+</span><a name="line-380"></a><a name="constant"><a href="Matrix.Type.html#constant"><span class="hs-identifier">constant</span></a></a><span> </span><span class="hs-glyph">=</span><span> </span><a href="Matrix.Type.html#M"><span class="hs-identifier hs-var">M</span></a><span> </span><span class="hs-operator hs-var">.</span><span> </span><a href="Matrix.Internal.html#constant"><span class="hs-identifier hs-var">I.constant</span></a><span>
381+</span><a name="line-381"></a><span>
382+</span><a name="line-382"></a><span class="hs-comment">-- Bang Matrix</span><span>
383+</span><a name="line-383"></a><span>
384+</span><a name="line-384"></a><span class="hs-comment">-- | The T (Top) row vector matrix.</span><span>
385+</span><a name="line-385"></a><span class="hs-identifier">bang</span><span> </span><span class="hs-glyph">::</span><span>
386+</span><a name="line-386"></a><span> </span><span class="hs-keyword">forall</span><span> </span><a name="local-6989586621679046529"><a href="#local-6989586621679046529"><span class="hs-identifier">e</span></a></a><span> </span><a name="local-6989586621679046530"><a href="#local-6989586621679046530"><span class="hs-identifier">cols</span></a></a><span class="hs-operator">.</span><span>
387+</span><a name="line-387"></a><span> </span><span class="hs-special">(</span><span class="hs-identifier hs-type">Num</span><span> </span><a href="#local-6989586621679046529"><span class="hs-identifier hs-type">e</span></a><span class="hs-special">,</span><span> </span><span class="hs-identifier hs-type">Enum</span><span> </span><a href="#local-6989586621679046529"><span class="hs-identifier hs-type">e</span></a><span class="hs-special">,</span><span> </span><a href="Matrix.Internal.html#FromLists"><span class="hs-identifier hs-type">I.FromLists</span></a><span> </span><a href="#local-6989586621679046529"><span class="hs-identifier hs-type">e</span></a><span> </span><span class="hs-special">(</span><a href="Matrix.Internal.html#Normalize"><span class="hs-identifier hs-type">I.Normalize</span></a><span> </span><a href="#local-6989586621679046530"><span class="hs-identifier hs-type">cols</span></a><span class="hs-special">)</span><span> </span><span class="hs-special">(</span><span class="hs-special">)</span><span class="hs-special">,</span><span> </span><span class="hs-identifier hs-type">KnownNat</span><span> </span><span class="hs-special">(</span><a href="Matrix.Internal.html#Count"><span class="hs-identifier hs-type">I.Count</span></a><span> </span><span class="hs-special">(</span><a href="Matrix.Internal.html#Normalize"><span class="hs-identifier hs-type">I.Normalize</span></a><span> </span><a href="#local-6989586621679046530"><span class="hs-identifier hs-type">cols</span></a><span class="hs-special">)</span><span class="hs-special">)</span><span class="hs-special">)</span><span> </span><span class="hs-glyph">=&gt;</span><span>
388+</span><a name="line-388"></a><span> </span><a href="Matrix.Type.html#Matrix"><span class="hs-identifier hs-type">Matrix</span></a><span> </span><a href="#local-6989586621679046529"><span class="hs-identifier hs-type">e</span></a><span> </span><a href="#local-6989586621679046530"><span class="hs-identifier hs-type">cols</span></a><span> </span><a href="Matrix.Type.html#One"><span class="hs-identifier hs-type">One</span></a><span>
389+</span><a name="line-389"></a><a name="bang"><a href="Matrix.Type.html#bang"><span class="hs-identifier">bang</span></a></a><span> </span><span class="hs-glyph">=</span><span> </span><a href="Matrix.Type.html#M"><span class="hs-identifier hs-var">M</span></a><span> </span><a href="Matrix.Internal.html#bang"><span class="hs-identifier hs-var">I.bang</span></a><span>
390+</span><a name="line-390"></a><span>
391+</span><a name="line-391"></a><span class="hs-comment">-- Identity Matrix</span><span>
392+</span><a name="line-392"></a><span>
393+</span><a name="line-393"></a><span class="hs-comment">-- | Identity matrix</span><span>
394+</span><a name="line-394"></a><span class="hs-identifier">identity</span><span> </span><span class="hs-glyph">::</span><span>
395+</span><a name="line-395"></a><span> </span><span class="hs-special">(</span><span class="hs-identifier hs-type">Num</span><span> </span><a href="#local-6989586621679046527"><span class="hs-identifier hs-type">e</span></a><span class="hs-special">,</span><span> </span><a href="Matrix.Internal.html#FromLists"><span class="hs-identifier hs-type">I.FromLists</span></a><span> </span><a href="#local-6989586621679046527"><span class="hs-identifier hs-type">e</span></a><span> </span><span class="hs-special">(</span><a href="Matrix.Internal.html#Normalize"><span class="hs-identifier hs-type">I.Normalize</span></a><span> </span><a href="#local-6989586621679046528"><span class="hs-identifier hs-type">a</span></a><span class="hs-special">)</span><span> </span><span class="hs-special">(</span><a href="Matrix.Internal.html#Normalize"><span class="hs-identifier hs-type">I.Normalize</span></a><span> </span><a href="#local-6989586621679046528"><span class="hs-identifier hs-type">a</span></a><span class="hs-special">)</span><span class="hs-special">,</span><span> </span><span class="hs-identifier hs-type">KnownNat</span><span> </span><span class="hs-special">(</span><a href="Matrix.Internal.html#Count"><span class="hs-identifier hs-type">I.Count</span></a><span> </span><span class="hs-special">(</span><a href="Matrix.Internal.html#Normalize"><span class="hs-identifier hs-type">I.Normalize</span></a><span> </span><a href="#local-6989586621679046528"><span class="hs-identifier hs-type">a</span></a><span class="hs-special">)</span><span class="hs-special">)</span><span class="hs-special">)</span><span> </span><span class="hs-glyph">=&gt;</span><span>
396+</span><a name="line-396"></a><span> </span><a href="Matrix.Type.html#Matrix"><span class="hs-identifier hs-type">Matrix</span></a><span> </span><a href="#local-6989586621679046527"><span class="hs-identifier hs-type">e</span></a><span> </span><a href="#local-6989586621679046528"><span class="hs-identifier hs-type">a</span></a><span> </span><a href="#local-6989586621679046528"><span class="hs-identifier hs-type">a</span></a><span>
397+</span><a name="line-397"></a><a name="identity"><a href="Matrix.Type.html#identity"><span class="hs-identifier">identity</span></a></a><span> </span><span class="hs-glyph">=</span><span> </span><a href="Matrix.Type.html#M"><span class="hs-identifier hs-var">M</span></a><span> </span><a href="Matrix.Internal.html#identity"><span class="hs-identifier hs-var">I.identity</span></a><span>
398+</span><a name="line-398"></a><span>
399+</span><a name="line-399"></a><span class="hs-comment">-- Matrix composition (MMM)</span><span>
400+</span><a name="line-400"></a><span>
401+</span><a name="line-401"></a><span class="hs-comment">-- | Matrix composition. Equivalent to matrix-matrix multiplication.</span><span>
402+</span><a name="line-402"></a><span class="hs-comment">--</span><span>
403+</span><a name="line-403"></a><span class="hs-comment">-- This definition takes advantage of divide-and-conquer and fusion laws</span><span>
404+</span><a name="line-404"></a><span class="hs-comment">-- from LAoP.</span><span>
405+</span><a name="line-405"></a><span class="hs-identifier">comp</span><span> </span><span class="hs-glyph">::</span><span> </span><span class="hs-special">(</span><span class="hs-identifier hs-type">Num</span><span> </span><a href="#local-6989586621679046523"><span class="hs-identifier hs-type">e</span></a><span class="hs-special">)</span><span> </span><span class="hs-glyph">=&gt;</span><span> </span><a href="Matrix.Type.html#Matrix"><span class="hs-identifier hs-type">Matrix</span></a><span> </span><a href="#local-6989586621679046523"><span class="hs-identifier hs-type">e</span></a><span> </span><a href="#local-6989586621679046524"><span class="hs-identifier hs-type">cr</span></a><span> </span><a href="#local-6989586621679046525"><span class="hs-identifier hs-type">rows</span></a><span> </span><span class="hs-glyph">-&gt;</span><span> </span><a href="Matrix.Type.html#Matrix"><span class="hs-identifier hs-type">Matrix</span></a><span> </span><a href="#local-6989586621679046523"><span class="hs-identifier hs-type">e</span></a><span> </span><a href="#local-6989586621679046526"><span class="hs-identifier hs-type">cols</span></a><span> </span><a href="#local-6989586621679046524"><span class="hs-identifier hs-type">cr</span></a><span> </span><span class="hs-glyph">-&gt;</span><span> </span><a href="Matrix.Type.html#Matrix"><span class="hs-identifier hs-type">Matrix</span></a><span> </span><a href="#local-6989586621679046523"><span class="hs-identifier hs-type">e</span></a><span> </span><a href="#local-6989586621679046526"><span class="hs-identifier hs-type">cols</span></a><span> </span><a href="#local-6989586621679046525"><span class="hs-identifier hs-type">rows</span></a><span>
406+</span><a name="line-406"></a><a name="comp"><a href="Matrix.Type.html#comp"><span class="hs-identifier">comp</span></a></a><span> </span><span class="hs-special">(</span><a href="Matrix.Type.html#M"><span class="hs-identifier hs-var">M</span></a><span> </span><a name="local-6989586621679046611"><a href="#local-6989586621679046611"><span class="hs-identifier">a</span></a></a><span class="hs-special">)</span><span> </span><span class="hs-special">(</span><a href="Matrix.Type.html#M"><span class="hs-identifier hs-var">M</span></a><span> </span><a name="local-6989586621679046612"><a href="#local-6989586621679046612"><span class="hs-identifier">b</span></a></a><span class="hs-special">)</span><span> </span><span class="hs-glyph">=</span><span> </span><a href="Matrix.Type.html#M"><span class="hs-identifier hs-var">M</span></a><span> </span><span class="hs-special">(</span><a href="Matrix.Internal.html#comp"><span class="hs-identifier hs-var">I.comp</span></a><span> </span><a href="#local-6989586621679046611"><span class="hs-identifier hs-var">a</span></a><span> </span><a href="#local-6989586621679046612"><span class="hs-identifier hs-var">b</span></a><span class="hs-special">)</span><span>
407+</span><a name="line-407"></a><span>
408+</span><a name="line-408"></a><span class="hs-comment">-- | Biproduct first component projection</span><span>
409+</span><a name="line-409"></a><span class="hs-identifier">p1</span><span> </span><span class="hs-glyph">::</span><span>
410+</span><a name="line-410"></a><span> </span><span class="hs-special">(</span><span> </span><span class="hs-identifier hs-type">Num</span><span> </span><a href="#local-6989586621679046520"><span class="hs-identifier hs-type">e</span></a><span class="hs-special">,</span><span>
411+</span><a name="line-411"></a><span> </span><span class="hs-identifier hs-type">KnownNat</span><span> </span><span class="hs-special">(</span><a href="Matrix.Internal.html#Count"><span class="hs-identifier hs-type">I.Count</span></a><span> </span><span class="hs-special">(</span><a href="Matrix.Internal.html#Normalize"><span class="hs-identifier hs-type">I.Normalize</span></a><span> </span><a href="#local-6989586621679046521"><span class="hs-identifier hs-type">n</span></a><span class="hs-special">)</span><span class="hs-special">)</span><span class="hs-special">,</span><span>
412+</span><a name="line-412"></a><span> </span><span class="hs-identifier hs-type">KnownNat</span><span> </span><span class="hs-special">(</span><a href="Matrix.Internal.html#Count"><span class="hs-identifier hs-type">I.Count</span></a><span> </span><span class="hs-special">(</span><a href="Matrix.Internal.html#Normalize"><span class="hs-identifier hs-type">I.Normalize</span></a><span> </span><a href="#local-6989586621679046522"><span class="hs-identifier hs-type">m</span></a><span class="hs-special">)</span><span class="hs-special">)</span><span class="hs-special">,</span><span>
413+</span><a name="line-413"></a><span> </span><a href="Matrix.Internal.html#FromLists"><span class="hs-identifier hs-type">I.FromLists</span></a><span> </span><a href="#local-6989586621679046520"><span class="hs-identifier hs-type">e</span></a><span> </span><span class="hs-special">(</span><a href="Matrix.Internal.html#Normalize"><span class="hs-identifier hs-type">I.Normalize</span></a><span> </span><a href="#local-6989586621679046521"><span class="hs-identifier hs-type">n</span></a><span class="hs-special">)</span><span> </span><span class="hs-special">(</span><a href="Matrix.Internal.html#Normalize"><span class="hs-identifier hs-type">I.Normalize</span></a><span> </span><a href="#local-6989586621679046522"><span class="hs-identifier hs-type">m</span></a><span class="hs-special">)</span><span class="hs-special">,</span><span>
414+</span><a name="line-414"></a><span> </span><a href="Matrix.Internal.html#FromLists"><span class="hs-identifier hs-type">I.FromLists</span></a><span> </span><a href="#local-6989586621679046520"><span class="hs-identifier hs-type">e</span></a><span> </span><span class="hs-special">(</span><a href="Matrix.Internal.html#Normalize"><span class="hs-identifier hs-type">I.Normalize</span></a><span> </span><a href="#local-6989586621679046522"><span class="hs-identifier hs-type">m</span></a><span class="hs-special">)</span><span> </span><span class="hs-special">(</span><a href="Matrix.Internal.html#Normalize"><span class="hs-identifier hs-type">I.Normalize</span></a><span> </span><a href="#local-6989586621679046522"><span class="hs-identifier hs-type">m</span></a><span class="hs-special">)</span><span class="hs-special">,</span><span>
415+</span><a name="line-415"></a><span> </span><span class="hs-identifier hs-type">I.Normalize</span><span> </span><span class="hs-special">(</span><span class="hs-identifier hs-type">Either</span><span> </span><a href="#local-6989586621679046522"><span class="hs-identifier hs-type">m</span></a><span> </span><a href="#local-6989586621679046521"><span class="hs-identifier hs-type">n</span></a><span class="hs-special">)</span><span> </span><span class="hs-glyph">~</span><span> </span><span class="hs-identifier hs-type">Either</span><span> </span><span class="hs-special">(</span><a href="Matrix.Internal.html#Normalize"><span class="hs-identifier hs-type">I.Normalize</span></a><span> </span><a href="#local-6989586621679046522"><span class="hs-identifier hs-type">m</span></a><span class="hs-special">)</span><span> </span><span class="hs-special">(</span><a href="Matrix.Internal.html#Normalize"><span class="hs-identifier hs-type">I.Normalize</span></a><span> </span><a href="#local-6989586621679046521"><span class="hs-identifier hs-type">n</span></a><span class="hs-special">)</span><span>
416+</span><a name="line-416"></a><span> </span><span class="hs-special">)</span><span> </span><span class="hs-glyph">=&gt;</span><span>
417+</span><a name="line-417"></a><span> </span><a href="Matrix.Type.html#Matrix"><span class="hs-identifier hs-type">Matrix</span></a><span> </span><a href="#local-6989586621679046520"><span class="hs-identifier hs-type">e</span></a><span> </span><span class="hs-special">(</span><span class="hs-identifier hs-type">Either</span><span> </span><a href="#local-6989586621679046522"><span class="hs-identifier hs-type">m</span></a><span> </span><a href="#local-6989586621679046521"><span class="hs-identifier hs-type">n</span></a><span class="hs-special">)</span><span> </span><a href="#local-6989586621679046522"><span class="hs-identifier hs-type">m</span></a><span>
418+</span><a name="line-418"></a><a name="p1"><a href="Matrix.Type.html#p1"><span class="hs-identifier">p1</span></a></a><span> </span><span class="hs-glyph">=</span><span> </span><a href="Matrix.Type.html#M"><span class="hs-identifier hs-var">M</span></a><span> </span><a href="Matrix.Internal.html#p1"><span class="hs-identifier hs-var">I.p1</span></a><span>
419+</span><a name="line-419"></a><span>
420+</span><a name="line-420"></a><span class="hs-comment">-- | Biproduct second component projection</span><span>
421+</span><a name="line-421"></a><span class="hs-identifier">p2</span><span> </span><span class="hs-glyph">::</span><span>
422+</span><a name="line-422"></a><span> </span><span class="hs-special">(</span><span> </span><span class="hs-identifier hs-type">Num</span><span> </span><a href="#local-6989586621679046517"><span class="hs-identifier hs-type">e</span></a><span class="hs-special">,</span><span>
423+</span><a name="line-423"></a><span> </span><span class="hs-identifier hs-type">KnownNat</span><span> </span><span class="hs-special">(</span><a href="Matrix.Internal.html#Count"><span class="hs-identifier hs-type">I.Count</span></a><span> </span><span class="hs-special">(</span><a href="Matrix.Internal.html#Normalize"><span class="hs-identifier hs-type">I.Normalize</span></a><span> </span><a href="#local-6989586621679046518"><span class="hs-identifier hs-type">n</span></a><span class="hs-special">)</span><span class="hs-special">)</span><span class="hs-special">,</span><span>
424+</span><a name="line-424"></a><span> </span><span class="hs-identifier hs-type">KnownNat</span><span> </span><span class="hs-special">(</span><a href="Matrix.Internal.html#Count"><span class="hs-identifier hs-type">I.Count</span></a><span> </span><span class="hs-special">(</span><a href="Matrix.Internal.html#Normalize"><span class="hs-identifier hs-type">I.Normalize</span></a><span> </span><a href="#local-6989586621679046519"><span class="hs-identifier hs-type">m</span></a><span class="hs-special">)</span><span class="hs-special">)</span><span class="hs-special">,</span><span>
425+</span><a name="line-425"></a><span> </span><a href="Matrix.Internal.html#FromLists"><span class="hs-identifier hs-type">I.FromLists</span></a><span> </span><a href="#local-6989586621679046517"><span class="hs-identifier hs-type">e</span></a><span> </span><span class="hs-special">(</span><a href="Matrix.Internal.html#Normalize"><span class="hs-identifier hs-type">I.Normalize</span></a><span> </span><a href="#local-6989586621679046519"><span class="hs-identifier hs-type">m</span></a><span class="hs-special">)</span><span> </span><span class="hs-special">(</span><a href="Matrix.Internal.html#Normalize"><span class="hs-identifier hs-type">I.Normalize</span></a><span> </span><a href="#local-6989586621679046518"><span class="hs-identifier hs-type">n</span></a><span class="hs-special">)</span><span class="hs-special">,</span><span>
426+</span><a name="line-426"></a><span> </span><a href="Matrix.Internal.html#FromLists"><span class="hs-identifier hs-type">I.FromLists</span></a><span> </span><a href="#local-6989586621679046517"><span class="hs-identifier hs-type">e</span></a><span> </span><span class="hs-special">(</span><a href="Matrix.Internal.html#Normalize"><span class="hs-identifier hs-type">I.Normalize</span></a><span> </span><a href="#local-6989586621679046518"><span class="hs-identifier hs-type">n</span></a><span class="hs-special">)</span><span> </span><span class="hs-special">(</span><a href="Matrix.Internal.html#Normalize"><span class="hs-identifier hs-type">I.Normalize</span></a><span> </span><a href="#local-6989586621679046518"><span class="hs-identifier hs-type">n</span></a><span class="hs-special">)</span><span class="hs-special">,</span><span>
427+</span><a name="line-427"></a><span> </span><span class="hs-identifier hs-type">I.Normalize</span><span> </span><span class="hs-special">(</span><span class="hs-identifier hs-type">Either</span><span> </span><a href="#local-6989586621679046519"><span class="hs-identifier hs-type">m</span></a><span> </span><a href="#local-6989586621679046518"><span class="hs-identifier hs-type">n</span></a><span class="hs-special">)</span><span> </span><span class="hs-glyph">~</span><span> </span><span class="hs-identifier hs-type">Either</span><span> </span><span class="hs-special">(</span><a href="Matrix.Internal.html#Normalize"><span class="hs-identifier hs-type">I.Normalize</span></a><span> </span><a href="#local-6989586621679046519"><span class="hs-identifier hs-type">m</span></a><span class="hs-special">)</span><span> </span><span class="hs-special">(</span><a href="Matrix.Internal.html#Normalize"><span class="hs-identifier hs-type">I.Normalize</span></a><span> </span><a href="#local-6989586621679046518"><span class="hs-identifier hs-type">n</span></a><span class="hs-special">)</span><span>
428+</span><a name="line-428"></a><span> </span><span class="hs-special">)</span><span> </span><span class="hs-glyph">=&gt;</span><span>
429+</span><a name="line-429"></a><span> </span><a href="Matrix.Type.html#Matrix"><span class="hs-identifier hs-type">Matrix</span></a><span> </span><a href="#local-6989586621679046517"><span class="hs-identifier hs-type">e</span></a><span> </span><span class="hs-special">(</span><span class="hs-identifier hs-type">Either</span><span> </span><a href="#local-6989586621679046519"><span class="hs-identifier hs-type">m</span></a><span> </span><a href="#local-6989586621679046518"><span class="hs-identifier hs-type">n</span></a><span class="hs-special">)</span><span> </span><a href="#local-6989586621679046518"><span class="hs-identifier hs-type">n</span></a><span>
430+</span><a name="line-430"></a><a name="p2"><a href="Matrix.Type.html#p2"><span class="hs-identifier">p2</span></a></a><span> </span><span class="hs-glyph">=</span><span> </span><a href="Matrix.Type.html#M"><span class="hs-identifier hs-var">M</span></a><span> </span><a href="Matrix.Internal.html#p2"><span class="hs-identifier hs-var">I.p2</span></a><span>
431+</span><a name="line-431"></a><span>
432+</span><a name="line-432"></a><span class="hs-comment">-- Injections</span><span>
433+</span><a name="line-433"></a><span>
434+</span><a name="line-434"></a><span class="hs-comment">-- | Biproduct first component injection</span><span>
435+</span><a name="line-435"></a><span class="hs-identifier">i1</span><span> </span><span class="hs-glyph">::</span><span>
436+</span><a name="line-436"></a><span> </span><span class="hs-special">(</span><span> </span><span class="hs-identifier hs-type">Num</span><span> </span><a href="#local-6989586621679046514"><span class="hs-identifier hs-type">e</span></a><span class="hs-special">,</span><span>
437+</span><a name="line-437"></a><span> </span><span class="hs-identifier hs-type">KnownNat</span><span> </span><span class="hs-special">(</span><a href="Matrix.Internal.html#Count"><span class="hs-identifier hs-type">I.Count</span></a><span> </span><span class="hs-special">(</span><a href="Matrix.Internal.html#Normalize"><span class="hs-identifier hs-type">I.Normalize</span></a><span> </span><a href="#local-6989586621679046515"><span class="hs-identifier hs-type">n</span></a><span class="hs-special">)</span><span class="hs-special">)</span><span class="hs-special">,</span><span>
438+</span><a name="line-438"></a><span> </span><span class="hs-identifier hs-type">KnownNat</span><span> </span><span class="hs-special">(</span><a href="Matrix.Internal.html#Count"><span class="hs-identifier hs-type">I.Count</span></a><span> </span><span class="hs-special">(</span><a href="Matrix.Internal.html#Normalize"><span class="hs-identifier hs-type">I.Normalize</span></a><span> </span><a href="#local-6989586621679046516"><span class="hs-identifier hs-type">m</span></a><span class="hs-special">)</span><span class="hs-special">)</span><span class="hs-special">,</span><span>
439+</span><a name="line-439"></a><span> </span><a href="Matrix.Internal.html#FromLists"><span class="hs-identifier hs-type">I.FromLists</span></a><span> </span><a href="#local-6989586621679046514"><span class="hs-identifier hs-type">e</span></a><span> </span><span class="hs-special">(</span><a href="Matrix.Internal.html#Normalize"><span class="hs-identifier hs-type">I.Normalize</span></a><span> </span><a href="#local-6989586621679046515"><span class="hs-identifier hs-type">n</span></a><span class="hs-special">)</span><span> </span><span class="hs-special">(</span><a href="Matrix.Internal.html#Normalize"><span class="hs-identifier hs-type">I.Normalize</span></a><span> </span><a href="#local-6989586621679046516"><span class="hs-identifier hs-type">m</span></a><span class="hs-special">)</span><span class="hs-special">,</span><span>
440+</span><a name="line-440"></a><span> </span><a href="Matrix.Internal.html#FromLists"><span class="hs-identifier hs-type">I.FromLists</span></a><span> </span><a href="#local-6989586621679046514"><span class="hs-identifier hs-type">e</span></a><span> </span><span class="hs-special">(</span><a href="Matrix.Internal.html#Normalize"><span class="hs-identifier hs-type">I.Normalize</span></a><span> </span><a href="#local-6989586621679046516"><span class="hs-identifier hs-type">m</span></a><span class="hs-special">)</span><span> </span><span class="hs-special">(</span><a href="Matrix.Internal.html#Normalize"><span class="hs-identifier hs-type">I.Normalize</span></a><span> </span><a href="#local-6989586621679046516"><span class="hs-identifier hs-type">m</span></a><span class="hs-special">)</span><span class="hs-special">,</span><span>
441+</span><a name="line-441"></a><span> </span><span class="hs-identifier hs-type">I.Normalize</span><span> </span><span class="hs-special">(</span><span class="hs-identifier hs-type">Either</span><span> </span><a href="#local-6989586621679046516"><span class="hs-identifier hs-type">m</span></a><span> </span><a href="#local-6989586621679046515"><span class="hs-identifier hs-type">n</span></a><span class="hs-special">)</span><span> </span><span class="hs-glyph">~</span><span> </span><span class="hs-identifier hs-type">Either</span><span> </span><span class="hs-special">(</span><a href="Matrix.Internal.html#Normalize"><span class="hs-identifier hs-type">I.Normalize</span></a><span> </span><a href="#local-6989586621679046516"><span class="hs-identifier hs-type">m</span></a><span class="hs-special">)</span><span> </span><span class="hs-special">(</span><a href="Matrix.Internal.html#Normalize"><span class="hs-identifier hs-type">I.Normalize</span></a><span> </span><a href="#local-6989586621679046515"><span class="hs-identifier hs-type">n</span></a><span class="hs-special">)</span><span>
442+</span><a name="line-442"></a><span> </span><span class="hs-special">)</span><span> </span><span class="hs-glyph">=&gt;</span><span>
443+</span><a name="line-443"></a><span> </span><a href="Matrix.Type.html#Matrix"><span class="hs-identifier hs-type">Matrix</span></a><span> </span><a href="#local-6989586621679046514"><span class="hs-identifier hs-type">e</span></a><span> </span><a href="#local-6989586621679046516"><span class="hs-identifier hs-type">m</span></a><span> </span><span class="hs-special">(</span><span class="hs-identifier hs-type">Either</span><span> </span><a href="#local-6989586621679046516"><span class="hs-identifier hs-type">m</span></a><span> </span><a href="#local-6989586621679046515"><span class="hs-identifier hs-type">n</span></a><span class="hs-special">)</span><span>
444+</span><a name="line-444"></a><a name="i1"><a href="Matrix.Type.html#i1"><span class="hs-identifier">i1</span></a></a><span> </span><span class="hs-glyph">=</span><span> </span><a href="Matrix.Type.html#tr"><span class="hs-identifier hs-var">tr</span></a><span> </span><a href="Matrix.Type.html#p1"><span class="hs-identifier hs-var">p1</span></a><span>
445+</span><a name="line-445"></a><span>
446+</span><a name="line-446"></a><span class="hs-comment">-- | Biproduct second component injection</span><span>
447+</span><a name="line-447"></a><span class="hs-identifier">i2</span><span> </span><span class="hs-glyph">::</span><span>
448+</span><a name="line-448"></a><span> </span><span class="hs-special">(</span><span> </span><span class="hs-identifier hs-type">Num</span><span> </span><a href="#local-6989586621679046511"><span class="hs-identifier hs-type">e</span></a><span class="hs-special">,</span><span>
449+</span><a name="line-449"></a><span> </span><span class="hs-identifier hs-type">KnownNat</span><span> </span><span class="hs-special">(</span><a href="Matrix.Internal.html#Count"><span class="hs-identifier hs-type">I.Count</span></a><span> </span><span class="hs-special">(</span><a href="Matrix.Internal.html#Normalize"><span class="hs-identifier hs-type">I.Normalize</span></a><span> </span><a href="#local-6989586621679046512"><span class="hs-identifier hs-type">n</span></a><span class="hs-special">)</span><span class="hs-special">)</span><span class="hs-special">,</span><span>
450+</span><a name="line-450"></a><span> </span><span class="hs-identifier hs-type">KnownNat</span><span> </span><span class="hs-special">(</span><a href="Matrix.Internal.html#Count"><span class="hs-identifier hs-type">I.Count</span></a><span> </span><span class="hs-special">(</span><a href="Matrix.Internal.html#Normalize"><span class="hs-identifier hs-type">I.Normalize</span></a><span> </span><a href="#local-6989586621679046513"><span class="hs-identifier hs-type">m</span></a><span class="hs-special">)</span><span class="hs-special">)</span><span class="hs-special">,</span><span>
451+</span><a name="line-451"></a><span> </span><a href="Matrix.Internal.html#FromLists"><span class="hs-identifier hs-type">I.FromLists</span></a><span> </span><a href="#local-6989586621679046511"><span class="hs-identifier hs-type">e</span></a><span> </span><span class="hs-special">(</span><a href="Matrix.Internal.html#Normalize"><span class="hs-identifier hs-type">I.Normalize</span></a><span> </span><a href="#local-6989586621679046513"><span class="hs-identifier hs-type">m</span></a><span class="hs-special">)</span><span> </span><span class="hs-special">(</span><a href="Matrix.Internal.html#Normalize"><span class="hs-identifier hs-type">I.Normalize</span></a><span> </span><a href="#local-6989586621679046512"><span class="hs-identifier hs-type">n</span></a><span class="hs-special">)</span><span class="hs-special">,</span><span>
452+</span><a name="line-452"></a><span> </span><a href="Matrix.Internal.html#FromLists"><span class="hs-identifier hs-type">I.FromLists</span></a><span> </span><a href="#local-6989586621679046511"><span class="hs-identifier hs-type">e</span></a><span> </span><span class="hs-special">(</span><a href="Matrix.Internal.html#Normalize"><span class="hs-identifier hs-type">I.Normalize</span></a><span> </span><a href="#local-6989586621679046512"><span class="hs-identifier hs-type">n</span></a><span class="hs-special">)</span><span> </span><span class="hs-special">(</span><a href="Matrix.Internal.html#Normalize"><span class="hs-identifier hs-type">I.Normalize</span></a><span> </span><a href="#local-6989586621679046512"><span class="hs-identifier hs-type">n</span></a><span class="hs-special">)</span><span class="hs-special">,</span><span>
453+</span><a name="line-453"></a><span> </span><span class="hs-identifier hs-type">I.Normalize</span><span> </span><span class="hs-special">(</span><span class="hs-identifier hs-type">Either</span><span> </span><a href="#local-6989586621679046513"><span class="hs-identifier hs-type">m</span></a><span> </span><a href="#local-6989586621679046512"><span class="hs-identifier hs-type">n</span></a><span class="hs-special">)</span><span> </span><span class="hs-glyph">~</span><span> </span><span class="hs-identifier hs-type">Either</span><span> </span><span class="hs-special">(</span><a href="Matrix.Internal.html#Normalize"><span class="hs-identifier hs-type">I.Normalize</span></a><span> </span><a href="#local-6989586621679046513"><span class="hs-identifier hs-type">m</span></a><span class="hs-special">)</span><span> </span><span class="hs-special">(</span><a href="Matrix.Internal.html#Normalize"><span class="hs-identifier hs-type">I.Normalize</span></a><span> </span><a href="#local-6989586621679046512"><span class="hs-identifier hs-type">n</span></a><span class="hs-special">)</span><span>
454+</span><a name="line-454"></a><span> </span><span class="hs-special">)</span><span> </span><span class="hs-glyph">=&gt;</span><span>
455+</span><a name="line-455"></a><span> </span><a href="Matrix.Type.html#Matrix"><span class="hs-identifier hs-type">Matrix</span></a><span> </span><a href="#local-6989586621679046511"><span class="hs-identifier hs-type">e</span></a><span> </span><a href="#local-6989586621679046512"><span class="hs-identifier hs-type">n</span></a><span> </span><span class="hs-special">(</span><span class="hs-identifier hs-type">Either</span><span> </span><a href="#local-6989586621679046513"><span class="hs-identifier hs-type">m</span></a><span> </span><a href="#local-6989586621679046512"><span class="hs-identifier hs-type">n</span></a><span class="hs-special">)</span><span>
456+</span><a name="line-456"></a><a name="i2"><a href="Matrix.Type.html#i2"><span class="hs-identifier">i2</span></a></a><span> </span><span class="hs-glyph">=</span><span> </span><a href="Matrix.Type.html#tr"><span class="hs-identifier hs-var">tr</span></a><span> </span><a href="Matrix.Type.html#p2"><span class="hs-identifier hs-var">p2</span></a><span>
457+</span><a name="line-457"></a><span>
458+</span><a name="line-458"></a><span class="hs-comment">-- Dimensions</span><span>
459+</span><a name="line-459"></a><span>
460+</span><a name="line-460"></a><span class="hs-comment">-- | Obtain the number of rows.</span><span>
461+</span><a name="line-461"></a><span class="hs-comment">--</span><span>
462+</span><a name="line-462"></a><span class="hs-comment">-- NOTE: The 'KnownNat' constaint is needed in order to obtain the</span><span>
463+</span><a name="line-463"></a><span class="hs-comment">-- dimensions in constant time.</span><span>
464+</span><a name="line-464"></a><span class="hs-comment">--</span><span>
465+</span><a name="line-465"></a><span class="hs-comment">-- TODO: A 'rows' function that does not need the 'KnownNat' constraint in</span><span>
466+</span><a name="line-466"></a><span class="hs-comment">-- exchange for performance.</span><span>
467+</span><a name="line-467"></a><span class="hs-identifier">rows</span><span> </span><span class="hs-glyph">::</span><span> </span><span class="hs-special">(</span><span class="hs-identifier hs-type">KnownNat</span><span> </span><span class="hs-special">(</span><a href="Matrix.Internal.html#Count"><span class="hs-identifier hs-type">I.Count</span></a><span> </span><span class="hs-special">(</span><a href="Matrix.Internal.html#Normalize"><span class="hs-identifier hs-type">I.Normalize</span></a><span> </span><a href="#local-6989586621679046508"><span class="hs-identifier hs-type">rows</span></a><span class="hs-special">)</span><span class="hs-special">)</span><span class="hs-special">)</span><span> </span><span class="hs-glyph">=&gt;</span><span> </span><a href="Matrix.Type.html#Matrix"><span class="hs-identifier hs-type">Matrix</span></a><span> </span><a href="#local-6989586621679046509"><span class="hs-identifier hs-type">e</span></a><span> </span><a href="#local-6989586621679046510"><span class="hs-identifier hs-type">cols</span></a><span> </span><a href="#local-6989586621679046508"><span class="hs-identifier hs-type">rows</span></a><span> </span><span class="hs-glyph">-&gt;</span><span> </span><span class="hs-identifier hs-type">Int</span><span>
468+</span><a name="line-468"></a><a name="rows"><a href="Matrix.Type.html#rows"><span class="hs-identifier">rows</span></a></a><span> </span><span class="hs-special">(</span><a href="Matrix.Type.html#M"><span class="hs-identifier hs-var">M</span></a><span> </span><a name="local-6989586621679046613"><a href="#local-6989586621679046613"><span class="hs-identifier">m</span></a></a><span class="hs-special">)</span><span> </span><span class="hs-glyph">=</span><span> </span><a href="Matrix.Internal.html#rows"><span class="hs-identifier hs-var">I.rows</span></a><span> </span><a href="#local-6989586621679046613"><span class="hs-identifier hs-var">m</span></a><span>
469+</span><a name="line-469"></a><span>
470+</span><a name="line-470"></a><span class="hs-comment">-- | Obtain the number of columns.</span><span>
471+</span><a name="line-471"></a><span class="hs-comment">-- </span><span>
472+</span><a name="line-472"></a><span class="hs-comment">-- NOTE: The 'KnownNat' constaint is needed in order to obtain the</span><span>
473+</span><a name="line-473"></a><span class="hs-comment">-- dimensions in constant time.</span><span>
474+</span><a name="line-474"></a><span class="hs-comment">--</span><span>
475+</span><a name="line-475"></a><span class="hs-comment">-- TODO: A 'columns' function that does not need the 'KnownNat' constraint in</span><span>
476+</span><a name="line-476"></a><span class="hs-comment">-- exchange for performance.</span><span>
477+</span><a name="line-477"></a><span class="hs-identifier">columns</span><span> </span><span class="hs-glyph">::</span><span> </span><span class="hs-special">(</span><span class="hs-identifier hs-type">KnownNat</span><span> </span><span class="hs-special">(</span><a href="Matrix.Internal.html#Count"><span class="hs-identifier hs-type">I.Count</span></a><span> </span><span class="hs-special">(</span><a href="Matrix.Internal.html#Normalize"><span class="hs-identifier hs-type">I.Normalize</span></a><span> </span><a href="#local-6989586621679046505"><span class="hs-identifier hs-type">cols</span></a><span class="hs-special">)</span><span class="hs-special">)</span><span class="hs-special">)</span><span> </span><span class="hs-glyph">=&gt;</span><span> </span><a href="Matrix.Type.html#Matrix"><span class="hs-identifier hs-type">Matrix</span></a><span> </span><a href="#local-6989586621679046506"><span class="hs-identifier hs-type">e</span></a><span> </span><a href="#local-6989586621679046505"><span class="hs-identifier hs-type">cols</span></a><span> </span><a href="#local-6989586621679046507"><span class="hs-identifier hs-type">rows</span></a><span> </span><span class="hs-glyph">-&gt;</span><span> </span><span class="hs-identifier hs-type">Int</span><span>
478+</span><a name="line-478"></a><a name="columns"><a href="Matrix.Type.html#columns"><span class="hs-identifier">columns</span></a></a><span> </span><span class="hs-special">(</span><a href="Matrix.Type.html#M"><span class="hs-identifier hs-var">M</span></a><span> </span><a name="local-6989586621679046614"><a href="#local-6989586621679046614"><span class="hs-identifier">m</span></a></a><span class="hs-special">)</span><span> </span><span class="hs-glyph">=</span><span> </span><a href="Matrix.Internal.html#columns"><span class="hs-identifier hs-var">I.columns</span></a><span> </span><a href="#local-6989586621679046614"><span class="hs-identifier hs-var">m</span></a><span>
479+</span><a name="line-479"></a><span>
480+</span><a name="line-480"></a><span class="hs-comment">-- Coproduct Bifunctor</span><span>
481+</span><a name="line-481"></a><span>
482+</span><a name="line-482"></a><span class="hs-keyword">infixl</span><span> </span><span class="hs-number">5</span><span> </span><a href="Matrix.Type.html#-%7C-"><span class="hs-operator hs-var">-|-</span></a><span>
483+</span><a name="line-483"></a><span>
484+</span><a name="line-484"></a><span class="hs-comment">-- | Matrix coproduct functor also known as matrix direct sum.</span><span>
485+</span><a name="line-485"></a><span class="hs-special">(</span><span class="hs-operator">-|-</span><span class="hs-special">)</span><span> </span><span class="hs-glyph">::</span><span>
486+</span><a name="line-486"></a><span> </span><span class="hs-special">(</span><span> </span><span class="hs-identifier hs-type">Num</span><span> </span><a href="#local-6989586621679046500"><span class="hs-identifier hs-type">e</span></a><span class="hs-special">,</span><span>
487+</span><a name="line-487"></a><span> </span><span class="hs-identifier hs-type">KnownNat</span><span> </span><span class="hs-special">(</span><a href="Matrix.Internal.html#Count"><span class="hs-identifier hs-type">I.Count</span></a><span> </span><span class="hs-special">(</span><a href="Matrix.Internal.html#Normalize"><span class="hs-identifier hs-type">I.Normalize</span></a><span> </span><a href="#local-6989586621679046501"><span class="hs-identifier hs-type">j</span></a><span class="hs-special">)</span><span class="hs-special">)</span><span class="hs-special">,</span><span>
488+</span><a name="line-488"></a><span> </span><span class="hs-identifier hs-type">KnownNat</span><span> </span><span class="hs-special">(</span><a href="Matrix.Internal.html#Count"><span class="hs-identifier hs-type">I.Count</span></a><span> </span><span class="hs-special">(</span><a href="Matrix.Internal.html#Normalize"><span class="hs-identifier hs-type">I.Normalize</span></a><span> </span><a href="#local-6989586621679046502"><span class="hs-identifier hs-type">k</span></a><span class="hs-special">)</span><span class="hs-special">)</span><span class="hs-special">,</span><span>
489+</span><a name="line-489"></a><span> </span><a href="Matrix.Internal.html#FromLists"><span class="hs-identifier hs-type">I.FromLists</span></a><span> </span><a href="#local-6989586621679046500"><span class="hs-identifier hs-type">e</span></a><span> </span><span class="hs-special">(</span><a href="Matrix.Internal.html#Normalize"><span class="hs-identifier hs-type">I.Normalize</span></a><span> </span><a href="#local-6989586621679046502"><span class="hs-identifier hs-type">k</span></a><span class="hs-special">)</span><span> </span><span class="hs-special">(</span><a href="Matrix.Internal.html#Normalize"><span class="hs-identifier hs-type">I.Normalize</span></a><span> </span><a href="#local-6989586621679046502"><span class="hs-identifier hs-type">k</span></a><span class="hs-special">)</span><span class="hs-special">,</span><span>
490+</span><a name="line-490"></a><span> </span><a href="Matrix.Internal.html#FromLists"><span class="hs-identifier hs-type">I.FromLists</span></a><span> </span><a href="#local-6989586621679046500"><span class="hs-identifier hs-type">e</span></a><span> </span><span class="hs-special">(</span><a href="Matrix.Internal.html#Normalize"><span class="hs-identifier hs-type">I.Normalize</span></a><span> </span><a href="#local-6989586621679046501"><span class="hs-identifier hs-type">j</span></a><span class="hs-special">)</span><span> </span><span class="hs-special">(</span><a href="Matrix.Internal.html#Normalize"><span class="hs-identifier hs-type">I.Normalize</span></a><span> </span><a href="#local-6989586621679046502"><span class="hs-identifier hs-type">k</span></a><span class="hs-special">)</span><span class="hs-special">,</span><span>
491+</span><a name="line-491"></a><span> </span><a href="Matrix.Internal.html#FromLists"><span class="hs-identifier hs-type">I.FromLists</span></a><span> </span><a href="#local-6989586621679046500"><span class="hs-identifier hs-type">e</span></a><span> </span><span class="hs-special">(</span><a href="Matrix.Internal.html#Normalize"><span class="hs-identifier hs-type">I.Normalize</span></a><span> </span><a href="#local-6989586621679046502"><span class="hs-identifier hs-type">k</span></a><span class="hs-special">)</span><span> </span><span class="hs-special">(</span><a href="Matrix.Internal.html#Normalize"><span class="hs-identifier hs-type">I.Normalize</span></a><span> </span><a href="#local-6989586621679046501"><span class="hs-identifier hs-type">j</span></a><span class="hs-special">)</span><span class="hs-special">,</span><span>
492+</span><a name="line-492"></a><span> </span><a href="Matrix.Internal.html#FromLists"><span class="hs-identifier hs-type">I.FromLists</span></a><span> </span><a href="#local-6989586621679046500"><span class="hs-identifier hs-type">e</span></a><span> </span><span class="hs-special">(</span><a href="Matrix.Internal.html#Normalize"><span class="hs-identifier hs-type">I.Normalize</span></a><span> </span><a href="#local-6989586621679046501"><span class="hs-identifier hs-type">j</span></a><span class="hs-special">)</span><span> </span><span class="hs-special">(</span><a href="Matrix.Internal.html#Normalize"><span class="hs-identifier hs-type">I.Normalize</span></a><span> </span><a href="#local-6989586621679046501"><span class="hs-identifier hs-type">j</span></a><span class="hs-special">)</span><span class="hs-special">,</span><span>
493+</span><a name="line-493"></a><span> </span><span class="hs-identifier hs-type">I.Normalize</span><span> </span><span class="hs-special">(</span><span class="hs-identifier hs-type">Either</span><span> </span><a href="#local-6989586621679046503"><span class="hs-identifier hs-type">n</span></a><span> </span><a href="#local-6989586621679046504"><span class="hs-identifier hs-type">m</span></a><span class="hs-special">)</span><span> </span><span class="hs-glyph">~</span><span> </span><span class="hs-identifier hs-type">Either</span><span> </span><span class="hs-special">(</span><a href="Matrix.Internal.html#Normalize"><span class="hs-identifier hs-type">I.Normalize</span></a><span> </span><a href="#local-6989586621679046503"><span class="hs-identifier hs-type">n</span></a><span class="hs-special">)</span><span> </span><span class="hs-special">(</span><a href="Matrix.Internal.html#Normalize"><span class="hs-identifier hs-type">I.Normalize</span></a><span> </span><a href="#local-6989586621679046504"><span class="hs-identifier hs-type">m</span></a><span class="hs-special">)</span><span class="hs-special">,</span><span>
494+</span><a name="line-494"></a><span> </span><span class="hs-identifier hs-type">I.Normalize</span><span> </span><span class="hs-special">(</span><span class="hs-identifier hs-type">Either</span><span> </span><a href="#local-6989586621679046502"><span class="hs-identifier hs-type">k</span></a><span> </span><a href="#local-6989586621679046501"><span class="hs-identifier hs-type">j</span></a><span class="hs-special">)</span><span> </span><span class="hs-glyph">~</span><span> </span><span class="hs-identifier hs-type">Either</span><span> </span><span class="hs-special">(</span><a href="Matrix.Internal.html#Normalize"><span class="hs-identifier hs-type">I.Normalize</span></a><span> </span><a href="#local-6989586621679046502"><span class="hs-identifier hs-type">k</span></a><span class="hs-special">)</span><span> </span><span class="hs-special">(</span><a href="Matrix.Internal.html#Normalize"><span class="hs-identifier hs-type">I.Normalize</span></a><span> </span><a href="#local-6989586621679046501"><span class="hs-identifier hs-type">j</span></a><span class="hs-special">)</span><span>
495+</span><a name="line-495"></a><span> </span><span class="hs-special">)</span><span> </span><span class="hs-glyph">=&gt;</span><span>
496+</span><a name="line-496"></a><span> </span><a href="Matrix.Type.html#Matrix"><span class="hs-identifier hs-type">Matrix</span></a><span> </span><a href="#local-6989586621679046500"><span class="hs-identifier hs-type">e</span></a><span> </span><a href="#local-6989586621679046503"><span class="hs-identifier hs-type">n</span></a><span> </span><a href="#local-6989586621679046502"><span class="hs-identifier hs-type">k</span></a><span> </span><span class="hs-glyph">-&gt;</span><span>
497+</span><a name="line-497"></a><span> </span><a href="Matrix.Type.html#Matrix"><span class="hs-identifier hs-type">Matrix</span></a><span> </span><a href="#local-6989586621679046500"><span class="hs-identifier hs-type">e</span></a><span> </span><a href="#local-6989586621679046504"><span class="hs-identifier hs-type">m</span></a><span> </span><a href="#local-6989586621679046501"><span class="hs-identifier hs-type">j</span></a><span> </span><span class="hs-glyph">-&gt;</span><span>
498+</span><a name="line-498"></a><span> </span><a href="Matrix.Type.html#Matrix"><span class="hs-identifier hs-type">Matrix</span></a><span> </span><a href="#local-6989586621679046500"><span class="hs-identifier hs-type">e</span></a><span> </span><span class="hs-special">(</span><span class="hs-identifier hs-type">Either</span><span> </span><a href="#local-6989586621679046503"><span class="hs-identifier hs-type">n</span></a><span> </span><a href="#local-6989586621679046504"><span class="hs-identifier hs-type">m</span></a><span class="hs-special">)</span><span> </span><span class="hs-special">(</span><span class="hs-identifier hs-type">Either</span><span> </span><a href="#local-6989586621679046502"><span class="hs-identifier hs-type">k</span></a><span> </span><a href="#local-6989586621679046501"><span class="hs-identifier hs-type">j</span></a><span class="hs-special">)</span><span>
499+</span><a name="line-499"></a><span class="hs-special">(</span><a name="-%7C-"><a href="Matrix.Type.html#-%7C-"><span class="hs-operator">-|-</span></a></a><span class="hs-special">)</span><span> </span><span class="hs-special">(</span><a href="Matrix.Type.html#M"><span class="hs-identifier hs-var">M</span></a><span> </span><a name="local-6989586621679046615"><a href="#local-6989586621679046615"><span class="hs-identifier">a</span></a></a><span class="hs-special">)</span><span> </span><span class="hs-special">(</span><a href="Matrix.Type.html#M"><span class="hs-identifier hs-var">M</span></a><span> </span><a name="local-6989586621679046616"><a href="#local-6989586621679046616"><span class="hs-identifier">b</span></a></a><span class="hs-special">)</span><span> </span><span class="hs-glyph">=</span><span> </span><a href="Matrix.Type.html#M"><span class="hs-identifier hs-var">M</span></a><span> </span><span class="hs-special">(</span><span class="hs-special">(</span><a href="Matrix.Internal.html#-%7C-"><span class="hs-operator hs-var">I.-|-</span></a><span class="hs-special">)</span><span> </span><a href="#local-6989586621679046615"><span class="hs-identifier hs-var">a</span></a><span> </span><a href="#local-6989586621679046616"><span class="hs-identifier hs-var">b</span></a><span class="hs-special">)</span><span>
500+</span><a name="line-500"></a><span>
501+</span><a name="line-501"></a><span class="hs-comment">-- Khatri Rao Product and projections</span><span>
502+</span><a name="line-502"></a><span>
503+</span><a name="line-503"></a><span class="hs-comment">-- | Khatri Rao product first component projection matrix.</span><span>
504+</span><a name="line-504"></a><span class="hs-identifier">kp1</span><span> </span><span class="hs-glyph">::</span><span>
505+</span><a name="line-505"></a><span> </span><span class="hs-keyword">forall</span><span> </span><a name="local-6989586621679046497"><a href="#local-6989586621679046497"><span class="hs-identifier">e</span></a></a><span> </span><a name="local-6989586621679046498"><a href="#local-6989586621679046498"><span class="hs-identifier">m</span></a></a><span> </span><a name="local-6989586621679046499"><a href="#local-6989586621679046499"><span class="hs-identifier">k</span></a></a><span> </span><span class="hs-operator">.</span><span>
506+</span><a name="line-506"></a><span> </span><span class="hs-special">(</span><span> </span><span class="hs-identifier hs-type">Num</span><span> </span><a href="#local-6989586621679046497"><span class="hs-identifier hs-type">e</span></a><span class="hs-special">,</span><span>
507+</span><a name="line-507"></a><span> </span><span class="hs-identifier hs-type">KnownNat</span><span> </span><span class="hs-special">(</span><a href="Matrix.Internal.html#Count"><span class="hs-identifier hs-type">I.Count</span></a><span> </span><span class="hs-special">(</span><a href="Matrix.Internal.html#Normalize"><span class="hs-identifier hs-type">I.Normalize</span></a><span> </span><a href="#local-6989586621679046498"><span class="hs-identifier hs-type">m</span></a><span class="hs-special">)</span><span class="hs-special">)</span><span class="hs-special">,</span><span>
508+</span><a name="line-508"></a><span> </span><span class="hs-identifier hs-type">KnownNat</span><span> </span><span class="hs-special">(</span><a href="Matrix.Internal.html#Count"><span class="hs-identifier hs-type">I.Count</span></a><span> </span><span class="hs-special">(</span><a href="Matrix.Internal.html#Normalize"><span class="hs-identifier hs-type">I.Normalize</span></a><span> </span><a href="#local-6989586621679046499"><span class="hs-identifier hs-type">k</span></a><span class="hs-special">)</span><span class="hs-special">)</span><span class="hs-special">,</span><span>
509+</span><a name="line-509"></a><span> </span><span class="hs-identifier hs-type">KnownNat</span><span> </span><span class="hs-special">(</span><a href="Matrix.Internal.html#Count"><span class="hs-identifier hs-type">I.Count</span></a><span> </span><span class="hs-special">(</span><a href="Matrix.Internal.html#Normalize"><span class="hs-identifier hs-type">I.Normalize</span></a><span> </span><span class="hs-special">(</span><a href="#local-6989586621679046498"><span class="hs-identifier hs-type">m</span></a><span class="hs-special">,</span><span> </span><a href="#local-6989586621679046499"><span class="hs-identifier hs-type">k</span></a><span class="hs-special">)</span><span class="hs-special">)</span><span class="hs-special">)</span><span class="hs-special">,</span><span>
510+</span><a name="line-510"></a><span> </span><a href="Matrix.Internal.html#FromLists"><span class="hs-identifier hs-type">I.FromLists</span></a><span> </span><a href="#local-6989586621679046497"><span class="hs-identifier hs-type">e</span></a><span> </span><span class="hs-special">(</span><a href="Matrix.Internal.html#Normalize"><span class="hs-identifier hs-type">I.Normalize</span></a><span> </span><span class="hs-special">(</span><a href="#local-6989586621679046498"><span class="hs-identifier hs-type">m</span></a><span class="hs-special">,</span><span> </span><a href="#local-6989586621679046499"><span class="hs-identifier hs-type">k</span></a><span class="hs-special">)</span><span class="hs-special">)</span><span> </span><span class="hs-special">(</span><a href="Matrix.Internal.html#Normalize"><span class="hs-identifier hs-type">I.Normalize</span></a><span> </span><a href="#local-6989586621679046498"><span class="hs-identifier hs-type">m</span></a><span class="hs-special">)</span><span class="hs-special">,</span><span>
511+</span><a name="line-511"></a><span> </span><span class="hs-identifier hs-type">I.Normalize</span><span> </span><span class="hs-special">(</span><a href="#local-6989586621679046498"><span class="hs-identifier hs-type">m</span></a><span class="hs-special">,</span><span> </span><a href="#local-6989586621679046499"><span class="hs-identifier hs-type">k</span></a><span class="hs-special">)</span><span> </span><span class="hs-glyph">~</span><span> </span><a href="Matrix.Internal.html#Normalize"><span class="hs-identifier hs-type">I.Normalize</span></a><span> </span><span class="hs-special">(</span><a href="Matrix.Internal.html#Normalize"><span class="hs-identifier hs-type">I.Normalize</span></a><span> </span><a href="#local-6989586621679046498"><span class="hs-identifier hs-type">m</span></a><span class="hs-special">,</span><span> </span><a href="Matrix.Internal.html#Normalize"><span class="hs-identifier hs-type">I.Normalize</span></a><span> </span><a href="#local-6989586621679046499"><span class="hs-identifier hs-type">k</span></a><span class="hs-special">)</span><span>
512+</span><a name="line-512"></a><span> </span><span class="hs-special">)</span><span> </span><span class="hs-glyph">=&gt;</span><span> </span><a href="Matrix.Type.html#Matrix"><span class="hs-identifier hs-type">Matrix</span></a><span> </span><a href="#local-6989586621679046497"><span class="hs-identifier hs-type">e</span></a><span> </span><span class="hs-special">(</span><a href="#local-6989586621679046498"><span class="hs-identifier hs-type">m</span></a><span class="hs-special">,</span><span> </span><a href="#local-6989586621679046499"><span class="hs-identifier hs-type">k</span></a><span class="hs-special">)</span><span> </span><a href="#local-6989586621679046498"><span class="hs-identifier hs-type">m</span></a><span>
513+</span><a name="line-513"></a><a name="kp1"><a href="Matrix.Type.html#kp1"><span class="hs-identifier">kp1</span></a></a><span> </span><span class="hs-glyph">=</span><span> </span><a href="Matrix.Type.html#M"><span class="hs-identifier hs-var">M</span></a><span> </span><span class="hs-special">(</span><a href="Matrix.Internal.html#kp1"><span class="hs-identifier hs-var">I.kp1</span></a><span> </span><span class="hs-glyph">@</span><a href="#local-6989586621679046497"><span class="hs-identifier hs-type">e</span></a><span> </span><span class="hs-glyph">@</span><span class="hs-special">(</span><a href="Matrix.Internal.html#Normalize"><span class="hs-identifier hs-type">I.Normalize</span></a><span> </span><a href="#local-6989586621679046498"><span class="hs-identifier hs-type">m</span></a><span class="hs-special">)</span><span> </span><span class="hs-glyph">@</span><span class="hs-special">(</span><a href="Matrix.Internal.html#Normalize"><span class="hs-identifier hs-type">I.Normalize</span></a><span> </span><a href="#local-6989586621679046499"><span class="hs-identifier hs-type">k</span></a><span class="hs-special">)</span><span class="hs-special">)</span><span>
514+</span><a name="line-514"></a><span>
515+</span><a name="line-515"></a><span class="hs-comment">-- | Khatri Rao product second component projection matrix.</span><span>
516+</span><a name="line-516"></a><span class="hs-identifier">kp2</span><span> </span><span class="hs-glyph">::</span><span>
517+</span><a name="line-517"></a><span> </span><span class="hs-keyword">forall</span><span> </span><a name="local-6989586621679046494"><a href="#local-6989586621679046494"><span class="hs-identifier">e</span></a></a><span> </span><a name="local-6989586621679046495"><a href="#local-6989586621679046495"><span class="hs-identifier">m</span></a></a><span> </span><a name="local-6989586621679046496"><a href="#local-6989586621679046496"><span class="hs-identifier">k</span></a></a><span class="hs-operator">.</span><span>
518+</span><a name="line-518"></a><span> </span><span class="hs-special">(</span><span> </span><span class="hs-identifier hs-type">Num</span><span> </span><a href="#local-6989586621679046494"><span class="hs-identifier hs-type">e</span></a><span class="hs-special">,</span><span>
519+</span><a name="line-519"></a><span> </span><span class="hs-identifier hs-type">KnownNat</span><span> </span><span class="hs-special">(</span><a href="Matrix.Internal.html#Count"><span class="hs-identifier hs-type">I.Count</span></a><span> </span><span class="hs-special">(</span><a href="Matrix.Internal.html#Normalize"><span class="hs-identifier hs-type">I.Normalize</span></a><span> </span><a href="#local-6989586621679046496"><span class="hs-identifier hs-type">k</span></a><span class="hs-special">)</span><span class="hs-special">)</span><span class="hs-special">,</span><span>
520+</span><a name="line-520"></a><span> </span><span class="hs-identifier hs-type">KnownNat</span><span> </span><span class="hs-special">(</span><a href="Matrix.Internal.html#Count"><span class="hs-identifier hs-type">I.Count</span></a><span> </span><span class="hs-special">(</span><a href="Matrix.Internal.html#Normalize"><span class="hs-identifier hs-type">I.Normalize</span></a><span> </span><a href="#local-6989586621679046495"><span class="hs-identifier hs-type">m</span></a><span class="hs-special">)</span><span class="hs-special">)</span><span class="hs-special">,</span><span>
521+</span><a name="line-521"></a><span> </span><span class="hs-identifier hs-type">KnownNat</span><span> </span><span class="hs-special">(</span><a href="Matrix.Internal.html#Count"><span class="hs-identifier hs-type">I.Count</span></a><span> </span><span class="hs-special">(</span><a href="Matrix.Internal.html#Normalize"><span class="hs-identifier hs-type">I.Normalize</span></a><span> </span><span class="hs-special">(</span><a href="#local-6989586621679046495"><span class="hs-identifier hs-type">m</span></a><span class="hs-special">,</span><span> </span><a href="#local-6989586621679046496"><span class="hs-identifier hs-type">k</span></a><span class="hs-special">)</span><span class="hs-special">)</span><span class="hs-special">)</span><span class="hs-special">,</span><span>
522+</span><a name="line-522"></a><span> </span><a href="Matrix.Internal.html#FromLists"><span class="hs-identifier hs-type">I.FromLists</span></a><span> </span><a href="#local-6989586621679046494"><span class="hs-identifier hs-type">e</span></a><span> </span><span class="hs-special">(</span><a href="Matrix.Internal.html#Normalize"><span class="hs-identifier hs-type">I.Normalize</span></a><span> </span><span class="hs-special">(</span><a href="#local-6989586621679046495"><span class="hs-identifier hs-type">m</span></a><span class="hs-special">,</span><span> </span><a href="#local-6989586621679046496"><span class="hs-identifier hs-type">k</span></a><span class="hs-special">)</span><span class="hs-special">)</span><span> </span><span class="hs-special">(</span><a href="Matrix.Internal.html#Normalize"><span class="hs-identifier hs-type">I.Normalize</span></a><span> </span><a href="#local-6989586621679046496"><span class="hs-identifier hs-type">k</span></a><span class="hs-special">)</span><span class="hs-special">,</span><span>
523+</span><a name="line-523"></a><span> </span><span class="hs-identifier hs-type">I.Normalize</span><span> </span><span class="hs-special">(</span><a href="#local-6989586621679046495"><span class="hs-identifier hs-type">m</span></a><span class="hs-special">,</span><span> </span><a href="#local-6989586621679046496"><span class="hs-identifier hs-type">k</span></a><span class="hs-special">)</span><span> </span><span class="hs-glyph">~</span><span> </span><a href="Matrix.Internal.html#Normalize"><span class="hs-identifier hs-type">I.Normalize</span></a><span> </span><span class="hs-special">(</span><a href="Matrix.Internal.html#Normalize"><span class="hs-identifier hs-type">I.Normalize</span></a><span> </span><a href="#local-6989586621679046495"><span class="hs-identifier hs-type">m</span></a><span class="hs-special">,</span><span> </span><a href="Matrix.Internal.html#Normalize"><span class="hs-identifier hs-type">I.Normalize</span></a><span> </span><a href="#local-6989586621679046496"><span class="hs-identifier hs-type">k</span></a><span class="hs-special">)</span><span>
524+</span><a name="line-524"></a><span> </span><span class="hs-special">)</span><span> </span><span class="hs-glyph">=&gt;</span><span> </span><a href="Matrix.Type.html#Matrix"><span class="hs-identifier hs-type">Matrix</span></a><span> </span><a href="#local-6989586621679046494"><span class="hs-identifier hs-type">e</span></a><span> </span><span class="hs-special">(</span><a href="#local-6989586621679046495"><span class="hs-identifier hs-type">m</span></a><span class="hs-special">,</span><span> </span><a href="#local-6989586621679046496"><span class="hs-identifier hs-type">k</span></a><span class="hs-special">)</span><span> </span><a href="#local-6989586621679046496"><span class="hs-identifier hs-type">k</span></a><span>
525+</span><a name="line-525"></a><a name="kp2"><a href="Matrix.Type.html#kp2"><span class="hs-identifier">kp2</span></a></a><span> </span><span class="hs-glyph">=</span><span> </span><a href="Matrix.Type.html#M"><span class="hs-identifier hs-var">M</span></a><span> </span><span class="hs-special">(</span><a href="Matrix.Internal.html#kp2"><span class="hs-identifier hs-var">I.kp2</span></a><span> </span><span class="hs-glyph">@</span><a href="#local-6989586621679046494"><span class="hs-identifier hs-type">e</span></a><span> </span><span class="hs-glyph">@</span><span class="hs-special">(</span><a href="Matrix.Internal.html#Normalize"><span class="hs-identifier hs-type">I.Normalize</span></a><span> </span><a href="#local-6989586621679046495"><span class="hs-identifier hs-type">m</span></a><span class="hs-special">)</span><span> </span><span class="hs-glyph">@</span><span class="hs-special">(</span><a href="Matrix.Internal.html#Normalize"><span class="hs-identifier hs-type">I.Normalize</span></a><span> </span><a href="#local-6989586621679046496"><span class="hs-identifier hs-type">k</span></a><span class="hs-special">)</span><span class="hs-special">)</span><span>
526+</span><a name="line-526"></a><span>
527+</span><a name="line-527"></a><span class="hs-comment">-- | Khatri Rao Matrix product also known as matrix pairing.</span><span>
528+</span><a name="line-528"></a><span class="hs-comment">--</span><span>
529+</span><a name="line-529"></a><span class="hs-comment">-- NOTE: That this is not a true categorical product, see for instance:</span><span>
530+</span><a name="line-530"></a><span class="hs-comment">-- </span><span>
531+</span><a name="line-531"></a><span class="hs-comment">-- @</span><span>
532+</span><a name="line-532"></a><span class="hs-comment">-- | kp1 `comp` khatri a b == a </span><span>
533+</span><a name="line-533"></a><span class="hs-comment">-- khatri a b ==&gt; |</span><span>
534+</span><a name="line-534"></a><span class="hs-comment">-- | kp2 `comp` khatri a b == b</span><span>
535+</span><a name="line-535"></a><span class="hs-comment">-- @</span><span>
536+</span><a name="line-536"></a><span class="hs-comment">--</span><span>
537+</span><a name="line-537"></a><span class="hs-comment">-- __Emphasis__ on the implication symbol.</span><span>
538+</span><a name="line-538"></a><span class="hs-identifier">khatri</span><span> </span><span class="hs-glyph">::</span><span>
539+</span><a name="line-539"></a><span> </span><span class="hs-keyword">forall</span><span> </span><a name="local-6989586621679046490"><a href="#local-6989586621679046490"><span class="hs-identifier">e</span></a></a><span> </span><a name="local-6989586621679046491"><a href="#local-6989586621679046491"><span class="hs-identifier">cols</span></a></a><span> </span><a name="local-6989586621679046492"><a href="#local-6989586621679046492"><span class="hs-identifier">a</span></a></a><span> </span><a name="local-6989586621679046493"><a href="#local-6989586621679046493"><span class="hs-identifier">b</span></a></a><span class="hs-operator">.</span><span>
540+</span><a name="line-540"></a><span> </span><span class="hs-special">(</span><span> </span><span class="hs-identifier hs-type">Num</span><span> </span><a href="#local-6989586621679046490"><span class="hs-identifier hs-type">e</span></a><span class="hs-special">,</span><span>
541+</span><a name="line-541"></a><span> </span><span class="hs-identifier hs-type">KnownNat</span><span> </span><span class="hs-special">(</span><a href="Matrix.Internal.html#Count"><span class="hs-identifier hs-type">I.Count</span></a><span> </span><span class="hs-special">(</span><a href="Matrix.Internal.html#Normalize"><span class="hs-identifier hs-type">I.Normalize</span></a><span> </span><a href="#local-6989586621679046492"><span class="hs-identifier hs-type">a</span></a><span class="hs-special">)</span><span class="hs-special">)</span><span class="hs-special">,</span><span>
542+</span><a name="line-542"></a><span> </span><span class="hs-identifier hs-type">KnownNat</span><span> </span><span class="hs-special">(</span><a href="Matrix.Internal.html#Count"><span class="hs-identifier hs-type">I.Count</span></a><span> </span><span class="hs-special">(</span><a href="Matrix.Internal.html#Normalize"><span class="hs-identifier hs-type">I.Normalize</span></a><span> </span><a href="#local-6989586621679046493"><span class="hs-identifier hs-type">b</span></a><span class="hs-special">)</span><span class="hs-special">)</span><span class="hs-special">,</span><span>
543+</span><a name="line-543"></a><span> </span><span class="hs-identifier hs-type">KnownNat</span><span> </span><span class="hs-special">(</span><a href="Matrix.Internal.html#Count"><span class="hs-identifier hs-type">I.Count</span></a><span> </span><span class="hs-special">(</span><a href="Matrix.Internal.html#Normalize"><span class="hs-identifier hs-type">I.Normalize</span></a><span> </span><span class="hs-special">(</span><a href="#local-6989586621679046492"><span class="hs-identifier hs-type">a</span></a><span class="hs-special">,</span><span> </span><a href="#local-6989586621679046493"><span class="hs-identifier hs-type">b</span></a><span class="hs-special">)</span><span class="hs-special">)</span><span class="hs-special">)</span><span class="hs-special">,</span><span>
544+</span><a name="line-544"></a><span> </span><a href="Matrix.Internal.html#FromLists"><span class="hs-identifier hs-type">I.FromLists</span></a><span> </span><a href="#local-6989586621679046490"><span class="hs-identifier hs-type">e</span></a><span> </span><span class="hs-special">(</span><a href="Matrix.Internal.html#Normalize"><span class="hs-identifier hs-type">I.Normalize</span></a><span> </span><span class="hs-special">(</span><a href="#local-6989586621679046492"><span class="hs-identifier hs-type">a</span></a><span class="hs-special">,</span><span> </span><a href="#local-6989586621679046493"><span class="hs-identifier hs-type">b</span></a><span class="hs-special">)</span><span class="hs-special">)</span><span> </span><span class="hs-special">(</span><a href="Matrix.Internal.html#Normalize"><span class="hs-identifier hs-type">I.Normalize</span></a><span> </span><a href="#local-6989586621679046492"><span class="hs-identifier hs-type">a</span></a><span class="hs-special">)</span><span class="hs-special">,</span><span>
545+</span><a name="line-545"></a><span> </span><a href="Matrix.Internal.html#FromLists"><span class="hs-identifier hs-type">I.FromLists</span></a><span> </span><a href="#local-6989586621679046490"><span class="hs-identifier hs-type">e</span></a><span> </span><span class="hs-special">(</span><a href="Matrix.Internal.html#Normalize"><span class="hs-identifier hs-type">I.Normalize</span></a><span> </span><span class="hs-special">(</span><a href="#local-6989586621679046492"><span class="hs-identifier hs-type">a</span></a><span class="hs-special">,</span><span> </span><a href="#local-6989586621679046493"><span class="hs-identifier hs-type">b</span></a><span class="hs-special">)</span><span class="hs-special">)</span><span> </span><span class="hs-special">(</span><a href="Matrix.Internal.html#Normalize"><span class="hs-identifier hs-type">I.Normalize</span></a><span> </span><a href="#local-6989586621679046493"><span class="hs-identifier hs-type">b</span></a><span class="hs-special">)</span><span class="hs-special">,</span><span>
546+</span><a name="line-546"></a><span> </span><span class="hs-identifier hs-type">I.Normalize</span><span> </span><span class="hs-special">(</span><a href="#local-6989586621679046492"><span class="hs-identifier hs-type">a</span></a><span class="hs-special">,</span><span> </span><a href="#local-6989586621679046493"><span class="hs-identifier hs-type">b</span></a><span class="hs-special">)</span><span> </span><span class="hs-glyph">~</span><span> </span><a href="Matrix.Internal.html#Normalize"><span class="hs-identifier hs-type">I.Normalize</span></a><span> </span><span class="hs-special">(</span><a href="Matrix.Internal.html#Normalize"><span class="hs-identifier hs-type">I.Normalize</span></a><span> </span><a href="#local-6989586621679046492"><span class="hs-identifier hs-type">a</span></a><span class="hs-special">,</span><span> </span><a href="Matrix.Internal.html#Normalize"><span class="hs-identifier hs-type">I.Normalize</span></a><span> </span><a href="#local-6989586621679046493"><span class="hs-identifier hs-type">b</span></a><span class="hs-special">)</span><span>
547+</span><a name="line-547"></a><span> </span><span class="hs-special">)</span><span> </span><span class="hs-glyph">=&gt;</span><span> </span><a href="Matrix.Type.html#Matrix"><span class="hs-identifier hs-type">Matrix</span></a><span> </span><a href="#local-6989586621679046490"><span class="hs-identifier hs-type">e</span></a><span> </span><a href="#local-6989586621679046491"><span class="hs-identifier hs-type">cols</span></a><span> </span><a href="#local-6989586621679046492"><span class="hs-identifier hs-type">a</span></a><span> </span><span class="hs-glyph">-&gt;</span><span> </span><a href="Matrix.Type.html#Matrix"><span class="hs-identifier hs-type">Matrix</span></a><span> </span><a href="#local-6989586621679046490"><span class="hs-identifier hs-type">e</span></a><span> </span><a href="#local-6989586621679046491"><span class="hs-identifier hs-type">cols</span></a><span> </span><a href="#local-6989586621679046493"><span class="hs-identifier hs-type">b</span></a><span> </span><span class="hs-glyph">-&gt;</span><span> </span><a href="Matrix.Type.html#Matrix"><span class="hs-identifier hs-type">Matrix</span></a><span> </span><a href="#local-6989586621679046490"><span class="hs-identifier hs-type">e</span></a><span> </span><a href="#local-6989586621679046491"><span class="hs-identifier hs-type">cols</span></a><span> </span><span class="hs-special">(</span><a href="#local-6989586621679046492"><span class="hs-identifier hs-type">a</span></a><span class="hs-special">,</span><span> </span><a href="#local-6989586621679046493"><span class="hs-identifier hs-type">b</span></a><span class="hs-special">)</span><span>
548+</span><a name="line-548"></a><a name="khatri"><a href="Matrix.Type.html#khatri"><span class="hs-identifier">khatri</span></a></a><span> </span><a name="local-6989586621679046617"><a href="#local-6989586621679046617"><span class="hs-identifier">a</span></a></a><span> </span><a name="local-6989586621679046618"><a href="#local-6989586621679046618"><span class="hs-identifier">b</span></a></a><span> </span><span class="hs-glyph">=</span><span>
549+</span><a name="line-549"></a><span> </span><span class="hs-keyword">let</span><span> </span><a name="local-6989586621679046619"><a href="#local-6989586621679046619"><span class="hs-identifier">kp1'</span></a></a><span> </span><span class="hs-glyph">=</span><span> </span><a href="Matrix.Type.html#kp1"><span class="hs-identifier hs-var">kp1</span></a><span> </span><span class="hs-glyph">@</span><a href="#local-6989586621679046490"><span class="hs-identifier hs-type">e</span></a><span> </span><span class="hs-glyph">@</span><a href="#local-6989586621679046492"><span class="hs-identifier hs-type">a</span></a><span> </span><span class="hs-glyph">@</span><a href="#local-6989586621679046493"><span class="hs-identifier hs-type">b</span></a><span>
550+</span><a name="line-550"></a><span> </span><a name="local-6989586621679046620"><a href="#local-6989586621679046620"><span class="hs-identifier">kp2'</span></a></a><span> </span><span class="hs-glyph">=</span><span> </span><a href="Matrix.Type.html#kp2"><span class="hs-identifier hs-var">kp2</span></a><span> </span><span class="hs-glyph">@</span><a href="#local-6989586621679046490"><span class="hs-identifier hs-type">e</span></a><span> </span><span class="hs-glyph">@</span><a href="#local-6989586621679046492"><span class="hs-identifier hs-type">a</span></a><span> </span><span class="hs-glyph">@</span><a href="#local-6989586621679046493"><span class="hs-identifier hs-type">b</span></a><span>
551+</span><a name="line-551"></a><span> </span><span class="hs-keyword">in</span><span> </span><a href="Matrix.Type.html#comp"><span class="hs-identifier hs-var">comp</span></a><span> </span><span class="hs-special">(</span><a href="Matrix.Type.html#tr"><span class="hs-identifier hs-var">tr</span></a><span> </span><a href="#local-6989586621679046619"><span class="hs-identifier hs-var">kp1'</span></a><span class="hs-special">)</span><span> </span><a href="#local-6989586621679046617"><span class="hs-identifier hs-var">a</span></a><span> </span><span class="hs-operator hs-var">*</span><span> </span><a href="Matrix.Type.html#comp"><span class="hs-identifier hs-var">comp</span></a><span> </span><span class="hs-special">(</span><a href="Matrix.Type.html#tr"><span class="hs-identifier hs-var">tr</span></a><span> </span><a href="#local-6989586621679046620"><span class="hs-identifier hs-var">kp2'</span></a><span class="hs-special">)</span><span> </span><a href="#local-6989586621679046618"><span class="hs-identifier hs-var">b</span></a><span>
552+</span><a name="line-552"></a><span>
553+</span><a name="line-553"></a><span class="hs-comment">-- Product Bifunctor (Kronecker)</span><span>
554+</span><a name="line-554"></a><span>
555+</span><a name="line-555"></a><span class="hs-keyword">infixl</span><span> </span><span class="hs-number">4</span><span> </span><a href="Matrix.Type.html#%3E%3C"><span class="hs-operator hs-var">&gt;&lt;</span></a><span>
556+</span><a name="line-556"></a><span>
557+</span><a name="line-557"></a><span class="hs-comment">-- | Matrix product functor also known as kronecker product</span><span>
558+</span><a name="line-558"></a><span class="hs-special">(</span><span class="hs-operator">&gt;&lt;</span><span class="hs-special">)</span><span> </span><span class="hs-glyph">::</span><span>
559+</span><a name="line-559"></a><span> </span><span class="hs-keyword">forall</span><span> </span><a name="local-6989586621679046485"><a href="#local-6989586621679046485"><span class="hs-identifier">e</span></a></a><span> </span><a name="local-6989586621679046486"><a href="#local-6989586621679046486"><span class="hs-identifier">m</span></a></a><span> </span><a name="local-6989586621679046487"><a href="#local-6989586621679046487"><span class="hs-identifier">p</span></a></a><span> </span><a name="local-6989586621679046488"><a href="#local-6989586621679046488"><span class="hs-identifier">n</span></a></a><span> </span><a name="local-6989586621679046489"><a href="#local-6989586621679046489"><span class="hs-identifier">q</span></a></a><span class="hs-operator">.</span><span>
560+</span><a name="line-560"></a><span> </span><span class="hs-special">(</span><span> </span><span class="hs-identifier hs-type">Num</span><span> </span><a href="#local-6989586621679046485"><span class="hs-identifier hs-type">e</span></a><span class="hs-special">,</span><span>
561+</span><a name="line-561"></a><span> </span><span class="hs-identifier hs-type">KnownNat</span><span> </span><span class="hs-special">(</span><a href="Matrix.Internal.html#Count"><span class="hs-identifier hs-type">I.Count</span></a><span> </span><span class="hs-special">(</span><a href="Matrix.Internal.html#Normalize"><span class="hs-identifier hs-type">I.Normalize</span></a><span> </span><a href="#local-6989586621679046486"><span class="hs-identifier hs-type">m</span></a><span class="hs-special">)</span><span class="hs-special">)</span><span class="hs-special">,</span><span>
562+</span><a name="line-562"></a><span> </span><span class="hs-identifier hs-type">KnownNat</span><span> </span><span class="hs-special">(</span><a href="Matrix.Internal.html#Count"><span class="hs-identifier hs-type">I.Count</span></a><span> </span><span class="hs-special">(</span><a href="Matrix.Internal.html#Normalize"><span class="hs-identifier hs-type">I.Normalize</span></a><span> </span><a href="#local-6989586621679046488"><span class="hs-identifier hs-type">n</span></a><span class="hs-special">)</span><span class="hs-special">)</span><span class="hs-special">,</span><span>
563+</span><a name="line-563"></a><span> </span><span class="hs-identifier hs-type">KnownNat</span><span> </span><span class="hs-special">(</span><a href="Matrix.Internal.html#Count"><span class="hs-identifier hs-type">I.Count</span></a><span> </span><span class="hs-special">(</span><a href="Matrix.Internal.html#Normalize"><span class="hs-identifier hs-type">I.Normalize</span></a><span> </span><a href="#local-6989586621679046487"><span class="hs-identifier hs-type">p</span></a><span class="hs-special">)</span><span class="hs-special">)</span><span class="hs-special">,</span><span>
564+</span><a name="line-564"></a><span> </span><span class="hs-identifier hs-type">KnownNat</span><span> </span><span class="hs-special">(</span><a href="Matrix.Internal.html#Count"><span class="hs-identifier hs-type">I.Count</span></a><span> </span><span class="hs-special">(</span><a href="Matrix.Internal.html#Normalize"><span class="hs-identifier hs-type">I.Normalize</span></a><span> </span><a href="#local-6989586621679046489"><span class="hs-identifier hs-type">q</span></a><span class="hs-special">)</span><span class="hs-special">)</span><span class="hs-special">,</span><span>
565+</span><a name="line-565"></a><span> </span><span class="hs-identifier hs-type">KnownNat</span><span> </span><span class="hs-special">(</span><a href="Matrix.Internal.html#Count"><span class="hs-identifier hs-type">I.Count</span></a><span> </span><span class="hs-special">(</span><a href="Matrix.Internal.html#Normalize"><span class="hs-identifier hs-type">I.Normalize</span></a><span> </span><span class="hs-special">(</span><a href="#local-6989586621679046486"><span class="hs-identifier hs-type">m</span></a><span class="hs-special">,</span><span> </span><a href="#local-6989586621679046488"><span class="hs-identifier hs-type">n</span></a><span class="hs-special">)</span><span class="hs-special">)</span><span class="hs-special">)</span><span class="hs-special">,</span><span>
566+</span><a name="line-566"></a><span> </span><span class="hs-identifier hs-type">KnownNat</span><span> </span><span class="hs-special">(</span><a href="Matrix.Internal.html#Count"><span class="hs-identifier hs-type">I.Count</span></a><span> </span><span class="hs-special">(</span><a href="Matrix.Internal.html#Normalize"><span class="hs-identifier hs-type">I.Normalize</span></a><span> </span><span class="hs-special">(</span><a href="#local-6989586621679046487"><span class="hs-identifier hs-type">p</span></a><span class="hs-special">,</span><span> </span><a href="#local-6989586621679046489"><span class="hs-identifier hs-type">q</span></a><span class="hs-special">)</span><span class="hs-special">)</span><span class="hs-special">)</span><span class="hs-special">,</span><span>
567+</span><a name="line-567"></a><span> </span><a href="Matrix.Internal.html#FromLists"><span class="hs-identifier hs-type">I.FromLists</span></a><span> </span><a href="#local-6989586621679046485"><span class="hs-identifier hs-type">e</span></a><span> </span><span class="hs-special">(</span><a href="Matrix.Internal.html#Normalize"><span class="hs-identifier hs-type">I.Normalize</span></a><span> </span><span class="hs-special">(</span><a href="#local-6989586621679046486"><span class="hs-identifier hs-type">m</span></a><span class="hs-special">,</span><span> </span><a href="#local-6989586621679046488"><span class="hs-identifier hs-type">n</span></a><span class="hs-special">)</span><span class="hs-special">)</span><span> </span><span class="hs-special">(</span><a href="Matrix.Internal.html#Normalize"><span class="hs-identifier hs-type">I.Normalize</span></a><span> </span><a href="#local-6989586621679046486"><span class="hs-identifier hs-type">m</span></a><span class="hs-special">)</span><span class="hs-special">,</span><span>
568+</span><a name="line-568"></a><span> </span><a href="Matrix.Internal.html#FromLists"><span class="hs-identifier hs-type">I.FromLists</span></a><span> </span><a href="#local-6989586621679046485"><span class="hs-identifier hs-type">e</span></a><span> </span><span class="hs-special">(</span><a href="Matrix.Internal.html#Normalize"><span class="hs-identifier hs-type">I.Normalize</span></a><span> </span><span class="hs-special">(</span><a href="#local-6989586621679046486"><span class="hs-identifier hs-type">m</span></a><span class="hs-special">,</span><span> </span><a href="#local-6989586621679046488"><span class="hs-identifier hs-type">n</span></a><span class="hs-special">)</span><span class="hs-special">)</span><span> </span><span class="hs-special">(</span><a href="Matrix.Internal.html#Normalize"><span class="hs-identifier hs-type">I.Normalize</span></a><span> </span><a href="#local-6989586621679046488"><span class="hs-identifier hs-type">n</span></a><span class="hs-special">)</span><span class="hs-special">,</span><span>
569+</span><a name="line-569"></a><span> </span><a href="Matrix.Internal.html#FromLists"><span class="hs-identifier hs-type">I.FromLists</span></a><span> </span><a href="#local-6989586621679046485"><span class="hs-identifier hs-type">e</span></a><span> </span><span class="hs-special">(</span><a href="Matrix.Internal.html#Normalize"><span class="hs-identifier hs-type">I.Normalize</span></a><span> </span><span class="hs-special">(</span><a href="#local-6989586621679046487"><span class="hs-identifier hs-type">p</span></a><span class="hs-special">,</span><span> </span><a href="#local-6989586621679046489"><span class="hs-identifier hs-type">q</span></a><span class="hs-special">)</span><span class="hs-special">)</span><span> </span><span class="hs-special">(</span><a href="Matrix.Internal.html#Normalize"><span class="hs-identifier hs-type">I.Normalize</span></a><span> </span><a href="#local-6989586621679046487"><span class="hs-identifier hs-type">p</span></a><span class="hs-special">)</span><span class="hs-special">,</span><span>
570+</span><a name="line-570"></a><span> </span><a href="Matrix.Internal.html#FromLists"><span class="hs-identifier hs-type">I.FromLists</span></a><span> </span><a href="#local-6989586621679046485"><span class="hs-identifier hs-type">e</span></a><span> </span><span class="hs-special">(</span><a href="Matrix.Internal.html#Normalize"><span class="hs-identifier hs-type">I.Normalize</span></a><span> </span><span class="hs-special">(</span><a href="#local-6989586621679046487"><span class="hs-identifier hs-type">p</span></a><span class="hs-special">,</span><span> </span><a href="#local-6989586621679046489"><span class="hs-identifier hs-type">q</span></a><span class="hs-special">)</span><span class="hs-special">)</span><span> </span><span class="hs-special">(</span><a href="Matrix.Internal.html#Normalize"><span class="hs-identifier hs-type">I.Normalize</span></a><span> </span><a href="#local-6989586621679046489"><span class="hs-identifier hs-type">q</span></a><span class="hs-special">)</span><span class="hs-special">,</span><span>
571+</span><a name="line-571"></a><span> </span><span class="hs-identifier hs-type">I.Normalize</span><span> </span><span class="hs-special">(</span><a href="#local-6989586621679046486"><span class="hs-identifier hs-type">m</span></a><span class="hs-special">,</span><span> </span><a href="#local-6989586621679046488"><span class="hs-identifier hs-type">n</span></a><span class="hs-special">)</span><span> </span><span class="hs-glyph">~</span><span> </span><a href="Matrix.Internal.html#Normalize"><span class="hs-identifier hs-type">I.Normalize</span></a><span> </span><span class="hs-special">(</span><a href="Matrix.Internal.html#Normalize"><span class="hs-identifier hs-type">I.Normalize</span></a><span> </span><a href="#local-6989586621679046486"><span class="hs-identifier hs-type">m</span></a><span class="hs-special">,</span><span> </span><a href="Matrix.Internal.html#Normalize"><span class="hs-identifier hs-type">I.Normalize</span></a><span> </span><a href="#local-6989586621679046488"><span class="hs-identifier hs-type">n</span></a><span class="hs-special">)</span><span class="hs-special">,</span><span>
572+</span><a name="line-572"></a><span> </span><span class="hs-identifier hs-type">I.Normalize</span><span> </span><span class="hs-special">(</span><a href="#local-6989586621679046487"><span class="hs-identifier hs-type">p</span></a><span class="hs-special">,</span><span> </span><a href="#local-6989586621679046489"><span class="hs-identifier hs-type">q</span></a><span class="hs-special">)</span><span> </span><span class="hs-glyph">~</span><span> </span><a href="Matrix.Internal.html#Normalize"><span class="hs-identifier hs-type">I.Normalize</span></a><span> </span><span class="hs-special">(</span><a href="Matrix.Internal.html#Normalize"><span class="hs-identifier hs-type">I.Normalize</span></a><span> </span><a href="#local-6989586621679046487"><span class="hs-identifier hs-type">p</span></a><span class="hs-special">,</span><span> </span><a href="Matrix.Internal.html#Normalize"><span class="hs-identifier hs-type">I.Normalize</span></a><span> </span><a href="#local-6989586621679046489"><span class="hs-identifier hs-type">q</span></a><span class="hs-special">)</span><span>
573+</span><a name="line-573"></a><span> </span><span class="hs-special">)</span><span> </span><span class="hs-glyph">=&gt;</span><span> </span><a href="Matrix.Type.html#Matrix"><span class="hs-identifier hs-type">Matrix</span></a><span> </span><a href="#local-6989586621679046485"><span class="hs-identifier hs-type">e</span></a><span> </span><a href="#local-6989586621679046486"><span class="hs-identifier hs-type">m</span></a><span> </span><a href="#local-6989586621679046487"><span class="hs-identifier hs-type">p</span></a><span> </span><span class="hs-glyph">-&gt;</span><span> </span><a href="Matrix.Type.html#Matrix"><span class="hs-identifier hs-type">Matrix</span></a><span> </span><a href="#local-6989586621679046485"><span class="hs-identifier hs-type">e</span></a><span> </span><a href="#local-6989586621679046488"><span class="hs-identifier hs-type">n</span></a><span> </span><a href="#local-6989586621679046489"><span class="hs-identifier hs-type">q</span></a><span> </span><span class="hs-glyph">-&gt;</span><span> </span><a href="Matrix.Type.html#Matrix"><span class="hs-identifier hs-type">Matrix</span></a><span> </span><a href="#local-6989586621679046485"><span class="hs-identifier hs-type">e</span></a><span> </span><span class="hs-special">(</span><a href="#local-6989586621679046486"><span class="hs-identifier hs-type">m</span></a><span class="hs-special">,</span><span> </span><a href="#local-6989586621679046488"><span class="hs-identifier hs-type">n</span></a><span class="hs-special">)</span><span> </span><span class="hs-special">(</span><a href="#local-6989586621679046487"><span class="hs-identifier hs-type">p</span></a><span class="hs-special">,</span><span> </span><a href="#local-6989586621679046489"><span class="hs-identifier hs-type">q</span></a><span class="hs-special">)</span><span>
574+</span><a name="line-574"></a><span class="hs-special">(</span><a name="%3E%3C"><a href="Matrix.Type.html#%3E%3C"><span class="hs-operator">&gt;&lt;</span></a></a><span class="hs-special">)</span><span> </span><a name="local-6989586621679046621"><a href="#local-6989586621679046621"><span class="hs-identifier">a</span></a></a><span> </span><a name="local-6989586621679046622"><a href="#local-6989586621679046622"><span class="hs-identifier">b</span></a></a><span> </span><span class="hs-glyph">=</span><span>
575+</span><a name="line-575"></a><span> </span><span class="hs-keyword">let</span><span> </span><a name="local-6989586621679046623"><a href="#local-6989586621679046623"><span class="hs-identifier">kp1'</span></a></a><span> </span><span class="hs-glyph">=</span><span> </span><a href="Matrix.Type.html#kp1"><span class="hs-identifier hs-var">kp1</span></a><span> </span><span class="hs-glyph">@</span><a href="#local-6989586621679046485"><span class="hs-identifier hs-type">e</span></a><span> </span><span class="hs-glyph">@</span><a href="#local-6989586621679046486"><span class="hs-identifier hs-type">m</span></a><span> </span><span class="hs-glyph">@</span><a href="#local-6989586621679046488"><span class="hs-identifier hs-type">n</span></a><span>
576+</span><a name="line-576"></a><span> </span><a name="local-6989586621679046624"><a href="#local-6989586621679046624"><span class="hs-identifier">kp2'</span></a></a><span> </span><span class="hs-glyph">=</span><span> </span><a href="Matrix.Type.html#kp2"><span class="hs-identifier hs-var">kp2</span></a><span> </span><span class="hs-glyph">@</span><a href="#local-6989586621679046485"><span class="hs-identifier hs-type">e</span></a><span> </span><span class="hs-glyph">@</span><a href="#local-6989586621679046486"><span class="hs-identifier hs-type">m</span></a><span> </span><span class="hs-glyph">@</span><a href="#local-6989586621679046488"><span class="hs-identifier hs-type">n</span></a><span>
577+</span><a name="line-577"></a><span> </span><span class="hs-keyword">in</span><span> </span><a href="Matrix.Type.html#khatri"><span class="hs-identifier hs-var">khatri</span></a><span> </span><span class="hs-special">(</span><a href="Matrix.Type.html#comp"><span class="hs-identifier hs-var">comp</span></a><span> </span><a href="#local-6989586621679046621"><span class="hs-identifier hs-var">a</span></a><span> </span><a href="#local-6989586621679046623"><span class="hs-identifier hs-var">kp1'</span></a><span class="hs-special">)</span><span> </span><span class="hs-special">(</span><a href="Matrix.Type.html#comp"><span class="hs-identifier hs-var">comp</span></a><span> </span><a href="#local-6989586621679046622"><span class="hs-identifier hs-var">b</span></a><span> </span><a href="#local-6989586621679046624"><span class="hs-identifier hs-var">kp2'</span></a><span class="hs-special">)</span><span>
578+</span><a name="line-578"></a><span>
579+</span><a name="line-579"></a><span class="hs-comment">-- Matrix abide Junc Split</span><span>
580+</span><a name="line-580"></a><span>
581+</span><a name="line-581"></a><span class="hs-comment">-- | Matrix &quot;abiding&quot; followin the 'Junc'-'Split' abide law.</span><span>
582+</span><a name="line-582"></a><span class="hs-comment">-- </span><span>
583+</span><a name="line-583"></a><span class="hs-comment">-- Law:</span><span>
584+</span><a name="line-584"></a><span class="hs-comment">--</span><span>
585+</span><a name="line-585"></a><span class="hs-comment">-- @</span><span>
586+</span><a name="line-586"></a><span class="hs-comment">-- 'Junc' ('Split' a c) ('Split' b d) == 'Split' ('Junc' a b) ('Junc' c d)</span><span>
587+</span><a name="line-587"></a><span class="hs-comment">-- @</span><span>
588+</span><a name="line-588"></a><span class="hs-identifier">abideJS</span><span> </span><span class="hs-glyph">::</span><span> </span><a href="Matrix.Type.html#Matrix"><span class="hs-identifier hs-type">Matrix</span></a><span> </span><a href="#local-6989586621679046482"><span class="hs-identifier hs-type">e</span></a><span> </span><a href="#local-6989586621679046483"><span class="hs-identifier hs-type">cols</span></a><span> </span><a href="#local-6989586621679046484"><span class="hs-identifier hs-type">rows</span></a><span> </span><span class="hs-glyph">-&gt;</span><span> </span><a href="Matrix.Type.html#Matrix"><span class="hs-identifier hs-type">Matrix</span></a><span> </span><a href="#local-6989586621679046482"><span class="hs-identifier hs-type">e</span></a><span> </span><a href="#local-6989586621679046483"><span class="hs-identifier hs-type">cols</span></a><span> </span><a href="#local-6989586621679046484"><span class="hs-identifier hs-type">rows</span></a><span>
589+</span><a name="line-589"></a><a name="abideJS"><a href="Matrix.Type.html#abideJS"><span class="hs-identifier">abideJS</span></a></a><span> </span><span class="hs-special">(</span><a href="Matrix.Type.html#M"><span class="hs-identifier hs-var">M</span></a><span> </span><a name="local-6989586621679046625"><a href="#local-6989586621679046625"><span class="hs-identifier">m</span></a></a><span class="hs-special">)</span><span> </span><span class="hs-glyph">=</span><span> </span><a href="Matrix.Type.html#M"><span class="hs-identifier hs-var">M</span></a><span> </span><span class="hs-special">(</span><a href="Matrix.Internal.html#abideJS"><span class="hs-identifier hs-var">I.abideJS</span></a><span> </span><a href="#local-6989586621679046625"><span class="hs-identifier hs-var">m</span></a><span class="hs-special">)</span><span>
590+</span><a name="line-590"></a><span>
591+</span><a name="line-591"></a><span class="hs-comment">-- Matrix abide Split Junc</span><span>
592+</span><a name="line-592"></a><span>
593+</span><a name="line-593"></a><span class="hs-comment">-- | Matrix &quot;abiding&quot; followin the 'Split'-'Junc' abide law.</span><span>
594+</span><a name="line-594"></a><span class="hs-comment">-- </span><span>
595+</span><a name="line-595"></a><span class="hs-comment">-- Law:</span><span>
596+</span><a name="line-596"></a><span class="hs-comment">--</span><span>
597+</span><a name="line-597"></a><span class="hs-comment">-- @</span><span>
598+</span><a name="line-598"></a><span class="hs-comment">-- 'Split' ('Junc' a b) ('Junc' c d) == 'Junc' ('Split' a c) ('Split' b d)</span><span>
599+</span><a name="line-599"></a><span class="hs-comment">-- @</span><span>
600+</span><a name="line-600"></a><span class="hs-identifier">abideSJ</span><span> </span><span class="hs-glyph">::</span><span> </span><a href="Matrix.Type.html#Matrix"><span class="hs-identifier hs-type">Matrix</span></a><span> </span><a href="#local-6989586621679046479"><span class="hs-identifier hs-type">e</span></a><span> </span><a href="#local-6989586621679046480"><span class="hs-identifier hs-type">cols</span></a><span> </span><a href="#local-6989586621679046481"><span class="hs-identifier hs-type">rows</span></a><span> </span><span class="hs-glyph">-&gt;</span><span> </span><a href="Matrix.Type.html#Matrix"><span class="hs-identifier hs-type">Matrix</span></a><span> </span><a href="#local-6989586621679046479"><span class="hs-identifier hs-type">e</span></a><span> </span><a href="#local-6989586621679046480"><span class="hs-identifier hs-type">cols</span></a><span> </span><a href="#local-6989586621679046481"><span class="hs-identifier hs-type">rows</span></a><span>
601+</span><a name="line-601"></a><a name="abideSJ"><a href="Matrix.Type.html#abideSJ"><span class="hs-identifier">abideSJ</span></a></a><span> </span><span class="hs-special">(</span><a href="Matrix.Type.html#M"><span class="hs-identifier hs-var">M</span></a><span> </span><a name="local-6989586621679046626"><a href="#local-6989586621679046626"><span class="hs-identifier">m</span></a></a><span class="hs-special">)</span><span> </span><span class="hs-glyph">=</span><span> </span><a href="Matrix.Type.html#M"><span class="hs-identifier hs-var">M</span></a><span> </span><span class="hs-special">(</span><a href="Matrix.Internal.html#abideSJ"><span class="hs-identifier hs-var">I.abideSJ</span></a><span> </span><a href="#local-6989586621679046626"><span class="hs-identifier hs-var">m</span></a><span class="hs-special">)</span><span>
602+</span><a name="line-602"></a><span>
603+</span><a name="line-603"></a><span class="hs-comment">-- Matrix transposition</span><span>
604+</span><a name="line-604"></a><span>
605+</span><a name="line-605"></a><span class="hs-comment">-- | Matrix transposition.</span><span>
606+</span><a name="line-606"></a><span class="hs-identifier">tr</span><span> </span><span class="hs-glyph">::</span><span> </span><a href="Matrix.Type.html#Matrix"><span class="hs-identifier hs-type">Matrix</span></a><span> </span><a href="#local-6989586621679046476"><span class="hs-identifier hs-type">e</span></a><span> </span><a href="#local-6989586621679046477"><span class="hs-identifier hs-type">cols</span></a><span> </span><a href="#local-6989586621679046478"><span class="hs-identifier hs-type">rows</span></a><span> </span><span class="hs-glyph">-&gt;</span><span> </span><a href="Matrix.Type.html#Matrix"><span class="hs-identifier hs-type">Matrix</span></a><span> </span><a href="#local-6989586621679046476"><span class="hs-identifier hs-type">e</span></a><span> </span><a href="#local-6989586621679046478"><span class="hs-identifier hs-type">rows</span></a><span> </span><a href="#local-6989586621679046477"><span class="hs-identifier hs-type">cols</span></a><span>
607+</span><a name="line-607"></a><a name="tr"><a href="Matrix.Type.html#tr"><span class="hs-identifier">tr</span></a></a><span> </span><span class="hs-special">(</span><a href="Matrix.Type.html#M"><span class="hs-identifier hs-var">M</span></a><span> </span><a name="local-6989586621679046627"><a href="#local-6989586621679046627"><span class="hs-identifier">m</span></a></a><span class="hs-special">)</span><span> </span><span class="hs-glyph">=</span><span> </span><a href="Matrix.Type.html#M"><span class="hs-identifier hs-var">M</span></a><span> </span><span class="hs-special">(</span><a href="Matrix.Internal.html#tr"><span class="hs-identifier hs-var">I.tr</span></a><span> </span><a href="#local-6989586621679046627"><span class="hs-identifier hs-var">m</span></a><span class="hs-special">)</span><span>
608+</span><a name="line-608"></a><span>
609+</span><a name="line-609"></a><span class="hs-comment">-- Selective 'select' operator</span><span>
610+</span><a name="line-610"></a><span>
611+</span><a name="line-611"></a><span class="hs-comment">-- | Selective functors 'select' operator equivalent inspired by the</span><span>
612+</span><a name="line-612"></a><span class="hs-comment">-- ArrowMonad solution presented in the paper.</span><span>
613+</span><a name="line-613"></a><span class="hs-identifier">selectM</span><span> </span><span class="hs-glyph">::</span><span>
614+</span><a name="line-614"></a><span> </span><span class="hs-special">(</span><span> </span><span class="hs-identifier hs-type">Num</span><span> </span><a href="#local-6989586621679046472"><span class="hs-identifier hs-type">e</span></a><span class="hs-special">,</span><span>
615+</span><a name="line-615"></a><span> </span><a href="Matrix.Internal.html#FromLists"><span class="hs-identifier hs-type">I.FromLists</span></a><span> </span><a href="#local-6989586621679046472"><span class="hs-identifier hs-type">e</span></a><span> </span><span class="hs-special">(</span><a href="Matrix.Internal.html#Normalize"><span class="hs-identifier hs-type">I.Normalize</span></a><span> </span><a href="#local-6989586621679046473"><span class="hs-identifier hs-type">b</span></a><span class="hs-special">)</span><span> </span><span class="hs-special">(</span><a href="Matrix.Internal.html#Normalize"><span class="hs-identifier hs-type">I.Normalize</span></a><span> </span><a href="#local-6989586621679046473"><span class="hs-identifier hs-type">b</span></a><span class="hs-special">)</span><span class="hs-special">,</span><span>
616+</span><a name="line-616"></a><span> </span><span class="hs-identifier hs-type">KnownNat</span><span> </span><span class="hs-special">(</span><a href="Matrix.Internal.html#Count"><span class="hs-identifier hs-type">I.Count</span></a><span> </span><span class="hs-special">(</span><a href="Matrix.Internal.html#Normalize"><span class="hs-identifier hs-type">I.Normalize</span></a><span> </span><a href="#local-6989586621679046473"><span class="hs-identifier hs-type">b</span></a><span class="hs-special">)</span><span class="hs-special">)</span><span class="hs-special">,</span><span>
617+</span><a name="line-617"></a><span> </span><span class="hs-identifier hs-type">I.Normalize</span><span> </span><span class="hs-special">(</span><span class="hs-identifier hs-type">Either</span><span> </span><a href="#local-6989586621679046474"><span class="hs-identifier hs-type">a</span></a><span> </span><a href="#local-6989586621679046473"><span class="hs-identifier hs-type">b</span></a><span class="hs-special">)</span><span> </span><span class="hs-glyph">~</span><span> </span><span class="hs-identifier hs-type">Either</span><span> </span><span class="hs-special">(</span><a href="Matrix.Internal.html#Normalize"><span class="hs-identifier hs-type">I.Normalize</span></a><span> </span><a href="#local-6989586621679046474"><span class="hs-identifier hs-type">a</span></a><span class="hs-special">)</span><span> </span><span class="hs-special">(</span><a href="Matrix.Internal.html#Normalize"><span class="hs-identifier hs-type">I.Normalize</span></a><span> </span><a href="#local-6989586621679046473"><span class="hs-identifier hs-type">b</span></a><span class="hs-special">)</span><span>
618+</span><a name="line-618"></a><span> </span><span class="hs-special">)</span><span> </span><span class="hs-glyph">=&gt;</span><span> </span><a href="Matrix.Type.html#Matrix"><span class="hs-identifier hs-type">Matrix</span></a><span> </span><a href="#local-6989586621679046472"><span class="hs-identifier hs-type">e</span></a><span> </span><a href="#local-6989586621679046475"><span class="hs-identifier hs-type">cols</span></a><span> </span><span class="hs-special">(</span><span class="hs-identifier hs-type">Either</span><span> </span><a href="#local-6989586621679046474"><span class="hs-identifier hs-type">a</span></a><span> </span><a href="#local-6989586621679046473"><span class="hs-identifier hs-type">b</span></a><span class="hs-special">)</span><span> </span><span class="hs-glyph">-&gt;</span><span> </span><a href="Matrix.Type.html#Matrix"><span class="hs-identifier hs-type">Matrix</span></a><span> </span><a href="#local-6989586621679046472"><span class="hs-identifier hs-type">e</span></a><span> </span><a href="#local-6989586621679046474"><span class="hs-identifier hs-type">a</span></a><span> </span><a href="#local-6989586621679046473"><span class="hs-identifier hs-type">b</span></a><span> </span><span class="hs-glyph">-&gt;</span><span> </span><a href="Matrix.Type.html#Matrix"><span class="hs-identifier hs-type">Matrix</span></a><span> </span><a href="#local-6989586621679046472"><span class="hs-identifier hs-type">e</span></a><span> </span><a href="#local-6989586621679046475"><span class="hs-identifier hs-type">cols</span></a><span> </span><a href="#local-6989586621679046473"><span class="hs-identifier hs-type">b</span></a><span>
619+</span><a name="line-619"></a><a name="selectM"><a href="Matrix.Type.html#selectM"><span class="hs-identifier">selectM</span></a></a><span> </span><span class="hs-special">(</span><a href="Matrix.Type.html#M"><span class="hs-identifier hs-var">M</span></a><span> </span><a name="local-6989586621679046628"><a href="#local-6989586621679046628"><span class="hs-identifier">m</span></a></a><span class="hs-special">)</span><span> </span><span class="hs-special">(</span><a href="Matrix.Type.html#M"><span class="hs-identifier hs-var">M</span></a><span> </span><a name="local-6989586621679046629"><a href="#local-6989586621679046629"><span class="hs-identifier">y</span></a></a><span class="hs-special">)</span><span> </span><span class="hs-glyph">=</span><span> </span><a href="Matrix.Type.html#M"><span class="hs-identifier hs-var">M</span></a><span> </span><span class="hs-special">(</span><a href="Matrix.Internal.html#select"><span class="hs-identifier hs-var">I.select</span></a><span> </span><a href="#local-6989586621679046628"><span class="hs-identifier hs-var">m</span></a><span> </span><a href="#local-6989586621679046629"><span class="hs-identifier hs-var">y</span></a><span class="hs-special">)</span><span>
620+</span><a name="line-620"></a><span>
621+</span><a name="line-621"></a><span class="hs-comment">-- McCarthy's Conditional</span><span>
622+</span><a name="line-622"></a><span>
623+</span><a name="line-623"></a><span class="hs-comment">-- | McCarthy's Conditional expresses probabilistic choice.</span><span>
624+</span><a name="line-624"></a><span class="hs-identifier">cond</span><span> </span><span class="hs-glyph">::</span><span>
625+</span><a name="line-625"></a><span> </span><span class="hs-special">(</span><span> </span><span class="hs-identifier hs-type">I.Normalize</span><span> </span><span class="hs-special">(</span><a href="Matrix.Internal.html#Normalize"><span class="hs-identifier hs-type">I.Normalize</span></a><span> </span><a href="#local-6989586621679046469"><span class="hs-identifier hs-type">a</span></a><span class="hs-special">)</span><span> </span><span class="hs-glyph">~</span><span> </span><a href="Matrix.Internal.html#Normalize"><span class="hs-identifier hs-type">I.Normalize</span></a><span> </span><a href="#local-6989586621679046469"><span class="hs-identifier hs-type">a</span></a><span class="hs-special">,</span><span>
626+</span><a name="line-626"></a><span> </span><span class="hs-identifier hs-type">KnownNat</span><span> </span><span class="hs-special">(</span><a href="Matrix.Internal.html#Count"><span class="hs-identifier hs-type">I.Count</span></a><span> </span><span class="hs-special">(</span><a href="Matrix.Internal.html#Normalize"><span class="hs-identifier hs-type">I.Normalize</span></a><span> </span><a href="#local-6989586621679046469"><span class="hs-identifier hs-type">a</span></a><span class="hs-special">)</span><span class="hs-special">)</span><span class="hs-special">,</span><span>
627+</span><a name="line-627"></a><span> </span><a href="Matrix.Internal.html#FromLists"><span class="hs-identifier hs-type">I.FromLists</span></a><span> </span><a href="#local-6989586621679046470"><span class="hs-identifier hs-type">e</span></a><span> </span><span class="hs-special">(</span><span class="hs-special">)</span><span> </span><span class="hs-special">(</span><a href="Matrix.Internal.html#Normalize"><span class="hs-identifier hs-type">I.Normalize</span></a><span> </span><a href="#local-6989586621679046469"><span class="hs-identifier hs-type">a</span></a><span class="hs-special">)</span><span class="hs-special">,</span><span>
628+</span><a name="line-628"></a><span> </span><a href="Matrix.Internal.html#FromLists"><span class="hs-identifier hs-type">I.FromLists</span></a><span> </span><a href="#local-6989586621679046470"><span class="hs-identifier hs-type">e</span></a><span> </span><span class="hs-special">(</span><a href="Matrix.Internal.html#Normalize"><span class="hs-identifier hs-type">I.Normalize</span></a><span> </span><a href="#local-6989586621679046469"><span class="hs-identifier hs-type">a</span></a><span class="hs-special">)</span><span> </span><span class="hs-special">(</span><span class="hs-special">)</span><span class="hs-special">,</span><span>
629+</span><a name="line-629"></a><span> </span><a href="Matrix.Internal.html#FromLists"><span class="hs-identifier hs-type">I.FromLists</span></a><span> </span><a href="#local-6989586621679046470"><span class="hs-identifier hs-type">e</span></a><span> </span><span class="hs-special">(</span><a href="Matrix.Internal.html#Normalize"><span class="hs-identifier hs-type">I.Normalize</span></a><span> </span><a href="#local-6989586621679046469"><span class="hs-identifier hs-type">a</span></a><span class="hs-special">)</span><span> </span><span class="hs-special">(</span><a href="Matrix.Internal.html#Normalize"><span class="hs-identifier hs-type">I.Normalize</span></a><span> </span><a href="#local-6989586621679046469"><span class="hs-identifier hs-type">a</span></a><span class="hs-special">)</span><span class="hs-special">,</span><span>
630+</span><a name="line-630"></a><span> </span><span class="hs-identifier hs-type">Bounded</span><span> </span><a href="#local-6989586621679046469"><span class="hs-identifier hs-type">a</span></a><span class="hs-special">,</span><span>
631+</span><a name="line-631"></a><span> </span><span class="hs-identifier hs-type">Enum</span><span> </span><a href="#local-6989586621679046469"><span class="hs-identifier hs-type">a</span></a><span class="hs-special">,</span><span>
632+</span><a name="line-632"></a><span> </span><span class="hs-identifier hs-type">Num</span><span> </span><a href="#local-6989586621679046470"><span class="hs-identifier hs-type">e</span></a><span class="hs-special">,</span><span>
633+</span><a name="line-633"></a><span> </span><span class="hs-identifier hs-type">Ord</span><span> </span><a href="#local-6989586621679046470"><span class="hs-identifier hs-type">e</span></a><span>
634+</span><a name="line-634"></a><span> </span><span class="hs-special">)</span><span>
635+</span><a name="line-635"></a><span> </span><span class="hs-glyph">=&gt;</span><span>
636+</span><a name="line-636"></a><span> </span><span class="hs-special">(</span><a href="#local-6989586621679046469"><span class="hs-identifier hs-type">a</span></a><span> </span><span class="hs-glyph">-&gt;</span><span> </span><span class="hs-identifier hs-type">Bool</span><span class="hs-special">)</span><span> </span><span class="hs-glyph">-&gt;</span><span> </span><a href="Matrix.Type.html#Matrix"><span class="hs-identifier hs-type">Matrix</span></a><span> </span><a href="#local-6989586621679046470"><span class="hs-identifier hs-type">e</span></a><span> </span><a href="#local-6989586621679046469"><span class="hs-identifier hs-type">a</span></a><span> </span><a href="#local-6989586621679046471"><span class="hs-identifier hs-type">b</span></a><span> </span><span class="hs-glyph">-&gt;</span><span> </span><a href="Matrix.Type.html#Matrix"><span class="hs-identifier hs-type">Matrix</span></a><span> </span><a href="#local-6989586621679046470"><span class="hs-identifier hs-type">e</span></a><span> </span><a href="#local-6989586621679046469"><span class="hs-identifier hs-type">a</span></a><span> </span><a href="#local-6989586621679046471"><span class="hs-identifier hs-type">b</span></a><span> </span><span class="hs-glyph">-&gt;</span><span> </span><a href="Matrix.Type.html#Matrix"><span class="hs-identifier hs-type">Matrix</span></a><span> </span><a href="#local-6989586621679046470"><span class="hs-identifier hs-type">e</span></a><span> </span><a href="#local-6989586621679046469"><span class="hs-identifier hs-type">a</span></a><span> </span><a href="#local-6989586621679046471"><span class="hs-identifier hs-type">b</span></a><span>
637+</span><a name="line-637"></a><a name="cond"><a href="Matrix.Type.html#cond"><span class="hs-identifier">cond</span></a></a><span> </span><a name="local-6989586621679046630"><a href="#local-6989586621679046630"><span class="hs-identifier">p</span></a></a><span> </span><span class="hs-special">(</span><a href="Matrix.Type.html#M"><span class="hs-identifier hs-var">M</span></a><span> </span><a name="local-6989586621679046631"><a href="#local-6989586621679046631"><span class="hs-identifier">a</span></a></a><span class="hs-special">)</span><span> </span><span class="hs-special">(</span><a href="Matrix.Type.html#M"><span class="hs-identifier hs-var">M</span></a><span> </span><a name="local-6989586621679046632"><a href="#local-6989586621679046632"><span class="hs-identifier">b</span></a></a><span class="hs-special">)</span><span> </span><span class="hs-glyph">=</span><span> </span><a href="Matrix.Type.html#M"><span class="hs-identifier hs-var">M</span></a><span> </span><span class="hs-special">(</span><a href="Matrix.Internal.html#cond"><span class="hs-identifier hs-var">I.cond</span></a><span> </span><a href="#local-6989586621679046630"><span class="hs-identifier hs-var">p</span></a><span> </span><a href="#local-6989586621679046631"><span class="hs-identifier hs-var">a</span></a><span> </span><a href="#local-6989586621679046632"><span class="hs-identifier hs-var">b</span></a><span class="hs-special">)</span><span>
638+</span><a name="line-638"></a><span>
639+</span><a name="line-639"></a><span class="hs-comment">-- Pretty print</span><span>
640+</span><a name="line-640"></a><span>
641+</span><a name="line-641"></a><span class="hs-comment">-- | Matrix pretty printer</span><span>
642+</span><a name="line-642"></a><span class="hs-identifier">pretty</span><span> </span><span class="hs-glyph">::</span><span> </span><span class="hs-special">(</span><span class="hs-identifier hs-type">KnownNat</span><span> </span><span class="hs-special">(</span><a href="Matrix.Internal.html#Count"><span class="hs-identifier hs-type">I.Count</span></a><span> </span><span class="hs-special">(</span><a href="Matrix.Internal.html#Normalize"><span class="hs-identifier hs-type">I.Normalize</span></a><span> </span><a href="#local-6989586621679046466"><span class="hs-identifier hs-type">cols</span></a><span class="hs-special">)</span><span class="hs-special">)</span><span class="hs-special">,</span><span> </span><span class="hs-identifier hs-type">Show</span><span> </span><a href="#local-6989586621679046467"><span class="hs-identifier hs-type">e</span></a><span class="hs-special">)</span><span> </span><span class="hs-glyph">=&gt;</span><span> </span><a href="Matrix.Type.html#Matrix"><span class="hs-identifier hs-type">Matrix</span></a><span> </span><a href="#local-6989586621679046467"><span class="hs-identifier hs-type">e</span></a><span> </span><a href="#local-6989586621679046466"><span class="hs-identifier hs-type">cols</span></a><span> </span><a href="#local-6989586621679046468"><span class="hs-identifier hs-type">rows</span></a><span> </span><span class="hs-glyph">-&gt;</span><span> </span><span class="hs-identifier hs-type">String</span><span>
643+</span><a name="line-643"></a><a name="pretty"><a href="Matrix.Type.html#pretty"><span class="hs-identifier">pretty</span></a></a><span> </span><span class="hs-special">(</span><a href="Matrix.Type.html#M"><span class="hs-identifier hs-var">M</span></a><span> </span><a name="local-6989586621679046633"><a href="#local-6989586621679046633"><span class="hs-identifier">m</span></a></a><span class="hs-special">)</span><span> </span><span class="hs-glyph">=</span><span> </span><a href="Matrix.Internal.html#pretty"><span class="hs-identifier hs-var">I.pretty</span></a><span> </span><a href="#local-6989586621679046633"><span class="hs-identifier hs-var">m</span></a><span>
644+</span><a name="line-644"></a><span>
645+</span><a name="line-645"></a><span class="hs-comment">-- | Matrix pretty printer</span><span>
646+</span><a name="line-646"></a><span class="hs-identifier">prettyPrint</span><span> </span><span class="hs-glyph">::</span><span> </span><span class="hs-special">(</span><span class="hs-identifier hs-type">KnownNat</span><span> </span><span class="hs-special">(</span><a href="Matrix.Internal.html#Count"><span class="hs-identifier hs-type">I.Count</span></a><span> </span><span class="hs-special">(</span><a href="Matrix.Internal.html#Normalize"><span class="hs-identifier hs-type">I.Normalize</span></a><span> </span><a href="#local-6989586621679046463"><span class="hs-identifier hs-type">cols</span></a><span class="hs-special">)</span><span class="hs-special">)</span><span class="hs-special">,</span><span> </span><span class="hs-identifier hs-type">Show</span><span> </span><a href="#local-6989586621679046464"><span class="hs-identifier hs-type">e</span></a><span class="hs-special">)</span><span> </span><span class="hs-glyph">=&gt;</span><span> </span><a href="Matrix.Type.html#Matrix"><span class="hs-identifier hs-type">Matrix</span></a><span> </span><a href="#local-6989586621679046464"><span class="hs-identifier hs-type">e</span></a><span> </span><a href="#local-6989586621679046463"><span class="hs-identifier hs-type">cols</span></a><span> </span><a href="#local-6989586621679046465"><span class="hs-identifier hs-type">rows</span></a><span> </span><span class="hs-glyph">-&gt;</span><span> </span><span class="hs-identifier hs-type">IO</span><span> </span><span class="hs-special">(</span><span class="hs-special">)</span><span>
647+</span><a name="line-647"></a><a name="prettyPrint"><a href="Matrix.Type.html#prettyPrint"><span class="hs-identifier">prettyPrint</span></a></a><span> </span><span class="hs-special">(</span><a href="Matrix.Type.html#M"><span class="hs-identifier hs-var">M</span></a><span> </span><a name="local-6989586621679046634"><a href="#local-6989586621679046634"><span class="hs-identifier">m</span></a></a><span class="hs-special">)</span><span> </span><span class="hs-glyph">=</span><span> </span><a href="Matrix.Internal.html#prettyPrint"><span class="hs-identifier hs-var">I.prettyPrint</span></a><span> </span><a href="#local-6989586621679046634"><span class="hs-identifier hs-var">m</span></a><span>
648+</span><a name="line-648"></a></pre></body></html>
build/x86_64-linux/ghc-8.6.5/laop-0.1.0.0/doc/html/laop-0.1.0.0-docs/src/Paths_laop.htmlnew file+51
@@ -0,0 +1,51 @@
1+<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"><html xmlns="http://www.w3.org/1999/xhtml"><head><link rel="stylesheet" type="text/css" href="style.css" /><script type="text/javascript" src="highlight.js"></script></head><body><pre><span class="hs-pragma">{-# LANGUAGE CPP #-}</span><span>
2+</span><a name="line-2"></a><span class="hs-pragma">{-# LANGUAGE NoRebindableSyntax #-}</span><span>
3+</span><a name="line-3"></a><span class="hs-pragma">{-# OPTIONS_GHC -fno-warn-missing-import-lists #-}</span><span>
4+</span><a name="line-4"></a><span class="hs-keyword">module</span><span> </span><span class="hs-identifier">Paths_laop</span><span> </span><span class="hs-special">(</span><span>
5+</span><a name="line-5"></a><span> </span><a href="Paths_laop.html#version"><span class="hs-identifier hs-var">version</span></a><span class="hs-special">,</span><span>
6+</span><a name="line-6"></a><span> </span><a href="Paths_laop.html#getBinDir"><span class="hs-identifier hs-var">getBinDir</span></a><span class="hs-special">,</span><span> </span><a href="Paths_laop.html#getLibDir"><span class="hs-identifier hs-var">getLibDir</span></a><span class="hs-special">,</span><span> </span><a href="Paths_laop.html#getDynLibDir"><span class="hs-identifier hs-var">getDynLibDir</span></a><span class="hs-special">,</span><span> </span><a href="Paths_laop.html#getDataDir"><span class="hs-identifier hs-var">getDataDir</span></a><span class="hs-special">,</span><span> </span><a href="Paths_laop.html#getLibexecDir"><span class="hs-identifier hs-var">getLibexecDir</span></a><span class="hs-special">,</span><span>
7+</span><a name="line-7"></a><span> </span><a href="Paths_laop.html#getDataFileName"><span class="hs-identifier hs-var">getDataFileName</span></a><span class="hs-special">,</span><span> </span><a href="Paths_laop.html#getSysconfDir"><span class="hs-identifier hs-var">getSysconfDir</span></a><span>
8+</span><a name="line-8"></a><span> </span><span class="hs-special">)</span><span> </span><span class="hs-keyword">where</span><span>
9+</span><a name="line-9"></a><span>
10+</span><a name="line-10"></a><span class="hs-keyword">import</span><span> </span><span class="hs-keyword">qualified</span><span> </span><span class="hs-identifier">Control.Exception</span><span> </span><span class="hs-keyword">as</span><span> </span><span class="hs-identifier">Exception</span><span>
11+</span><a name="line-11"></a><span class="hs-keyword">import</span><span> </span><span class="hs-identifier">Data.Version</span><span> </span><span class="hs-special">(</span><span class="hs-identifier hs-type">Version</span><span class="hs-special">(</span><span class="hs-glyph">..</span><span class="hs-special">)</span><span class="hs-special">)</span><span>
12+</span><a name="line-12"></a><span class="hs-keyword">import</span><span> </span><span class="hs-identifier">System.Environment</span><span> </span><span class="hs-special">(</span><span class="hs-identifier hs-var">getEnv</span><span class="hs-special">)</span><span>
13+</span><a name="line-13"></a><span class="hs-keyword">import</span><span> </span><span class="hs-identifier">Prelude</span><span>
14+</span><a name="line-14"></a><span>
15+</span><a name="line-15"></a><span class="hs-cpp">#if defined(VERSION_base)
16+</span><span>
17+</span><a name="line-17"></a><span class="hs-cpp">#if MIN_VERSION_base(4,0,0)
18+</span><span class="hs-identifier">catchIO</span><span> </span><span class="hs-glyph">::</span><span> </span><span class="hs-identifier hs-type">IO</span><span> </span><a href="#local-6989586621679020005"><span class="hs-identifier hs-type">a</span></a><span> </span><span class="hs-glyph">-&gt;</span><span> </span><span class="hs-special">(</span><span class="hs-identifier hs-type">Exception.IOException</span><span> </span><span class="hs-glyph">-&gt;</span><span> </span><span class="hs-identifier hs-type">IO</span><span> </span><a href="#local-6989586621679020005"><span class="hs-identifier hs-type">a</span></a><span class="hs-special">)</span><span> </span><span class="hs-glyph">-&gt;</span><span> </span><span class="hs-identifier hs-type">IO</span><span> </span><a href="#local-6989586621679020005"><span class="hs-identifier hs-type">a</span></a><span>
19+</span><a name="line-19"></a><span class="hs-cpp">#else
20+</span><span class="hs-identifier">catchIO</span><span> </span><span class="hs-glyph">::</span><span> </span><span class="hs-identifier">IO</span><span> </span><span class="hs-identifier">a</span><span> </span><span class="hs-glyph">-&gt;</span><span> </span><span class="hs-special">(</span><span class="hs-identifier">Exception.Exception</span><span> </span><span class="hs-glyph">-&gt;</span><span> </span><span class="hs-identifier">IO</span><span> </span><span class="hs-identifier">a</span><span class="hs-special">)</span><span> </span><span class="hs-glyph">-&gt;</span><span> </span><span class="hs-identifier">IO</span><span> </span><span class="hs-identifier">a</span><span>
21+</span><a name="line-21"></a><span class="hs-cpp">#endif
22+</span><span>
23+</span><a name="line-23"></a><span class="hs-cpp">#else
24+</span><span class="hs-identifier">catchIO</span><span> </span><span class="hs-glyph">::</span><span> </span><span class="hs-identifier">IO</span><span> </span><span class="hs-identifier">a</span><span> </span><span class="hs-glyph">-&gt;</span><span> </span><span class="hs-special">(</span><span class="hs-identifier">Exception.IOException</span><span> </span><span class="hs-glyph">-&gt;</span><span> </span><span class="hs-identifier">IO</span><span> </span><span class="hs-identifier">a</span><span class="hs-special">)</span><span> </span><span class="hs-glyph">-&gt;</span><span> </span><span class="hs-identifier">IO</span><span> </span><span class="hs-identifier">a</span><span>
25+</span><a name="line-25"></a><span class="hs-cpp">#endif
26+</span><a name="catchIO"><a href="Paths_laop.html#catchIO"><span class="hs-identifier">catchIO</span></a></a><span> </span><span class="hs-glyph">=</span><span> </span><span class="hs-identifier hs-var">Exception.catch</span><span>
27+</span><a name="line-27"></a><span>
28+</span><a name="line-28"></a><span class="hs-identifier">version</span><span> </span><span class="hs-glyph">::</span><span> </span><span class="hs-identifier hs-type">Version</span><span>
29+</span><a name="line-29"></a><a name="version"><a href="Paths_laop.html#version"><span class="hs-identifier">version</span></a></a><span> </span><span class="hs-glyph">=</span><span> </span><span class="hs-identifier hs-var">Version</span><span> </span><span class="hs-special">[</span><span class="hs-number">0</span><span class="hs-special">,</span><span class="hs-number">1</span><span class="hs-special">,</span><span class="hs-number">0</span><span class="hs-special">,</span><span class="hs-number">0</span><span class="hs-special">]</span><span> </span><span class="hs-special">[</span><span class="hs-special">]</span><span>
30+</span><a name="line-30"></a><span class="hs-identifier">bindir</span><span class="hs-special">,</span><span> </span><span class="hs-identifier">libdir</span><span class="hs-special">,</span><span> </span><span class="hs-identifier">dynlibdir</span><span class="hs-special">,</span><span> </span><span class="hs-identifier">datadir</span><span class="hs-special">,</span><span> </span><span class="hs-identifier">libexecdir</span><span class="hs-special">,</span><span> </span><span class="hs-identifier">sysconfdir</span><span> </span><span class="hs-glyph">::</span><span> </span><span class="hs-identifier hs-type">FilePath</span><span>
31+</span><a name="line-31"></a><span>
32+</span><a name="line-32"></a><a name="bindir"><a href="Paths_laop.html#bindir"><span class="hs-identifier">bindir</span></a></a><span> </span><span class="hs-glyph">=</span><span> </span><span class="hs-string">&quot;/home/bolt/.cabal/bin&quot;</span><span>
33+</span><a name="line-33"></a><a name="libdir"><a href="Paths_laop.html#libdir"><span class="hs-identifier">libdir</span></a></a><span> </span><span class="hs-glyph">=</span><span> </span><span class="hs-string">&quot;/home/bolt/.cabal/lib/x86_64-linux-ghc-8.6.5/laop-0.1.0.0-inplace&quot;</span><span>
34+</span><a name="line-34"></a><a name="dynlibdir"><a href="Paths_laop.html#dynlibdir"><span class="hs-identifier">dynlibdir</span></a></a><span> </span><span class="hs-glyph">=</span><span> </span><span class="hs-string">&quot;/home/bolt/.cabal/lib/x86_64-linux-ghc-8.6.5&quot;</span><span>
35+</span><a name="line-35"></a><a name="datadir"><a href="Paths_laop.html#datadir"><span class="hs-identifier">datadir</span></a></a><span> </span><span class="hs-glyph">=</span><span> </span><span class="hs-string">&quot;/home/bolt/.cabal/share/x86_64-linux-ghc-8.6.5/laop-0.1.0.0&quot;</span><span>
36+</span><a name="line-36"></a><a name="libexecdir"><a href="Paths_laop.html#libexecdir"><span class="hs-identifier">libexecdir</span></a></a><span> </span><span class="hs-glyph">=</span><span> </span><span class="hs-string">&quot;/home/bolt/.cabal/libexec/x86_64-linux-ghc-8.6.5/laop-0.1.0.0&quot;</span><span>
37+</span><a name="line-37"></a><a name="sysconfdir"><a href="Paths_laop.html#sysconfdir"><span class="hs-identifier">sysconfdir</span></a></a><span> </span><span class="hs-glyph">=</span><span> </span><span class="hs-string">&quot;/home/bolt/.cabal/etc&quot;</span><span>
38+</span><a name="line-38"></a><span>
39+</span><a name="line-39"></a><span class="hs-identifier">getBinDir</span><span class="hs-special">,</span><span> </span><span class="hs-identifier">getLibDir</span><span class="hs-special">,</span><span> </span><span class="hs-identifier">getDynLibDir</span><span class="hs-special">,</span><span> </span><span class="hs-identifier">getDataDir</span><span class="hs-special">,</span><span> </span><span class="hs-identifier">getLibexecDir</span><span class="hs-special">,</span><span> </span><span class="hs-identifier">getSysconfDir</span><span> </span><span class="hs-glyph">::</span><span> </span><span class="hs-identifier hs-type">IO</span><span> </span><span class="hs-identifier hs-type">FilePath</span><span>
40+</span><a name="line-40"></a><a name="getBinDir"><a href="Paths_laop.html#getBinDir"><span class="hs-identifier">getBinDir</span></a></a><span> </span><span class="hs-glyph">=</span><span> </span><a href="Paths_laop.html#catchIO"><span class="hs-identifier hs-var">catchIO</span></a><span> </span><span class="hs-special">(</span><span class="hs-identifier hs-var">getEnv</span><span> </span><span class="hs-string">&quot;laop_bindir&quot;</span><span class="hs-special">)</span><span> </span><span class="hs-special">(</span><span class="hs-glyph">\</span><span class="hs-identifier">_</span><span> </span><span class="hs-glyph">-&gt;</span><span> </span><span class="hs-identifier hs-var">return</span><span> </span><a href="Paths_laop.html#bindir"><span class="hs-identifier hs-var">bindir</span></a><span class="hs-special">)</span><span>
41+</span><a name="line-41"></a><a name="getLibDir"><a href="Paths_laop.html#getLibDir"><span class="hs-identifier">getLibDir</span></a></a><span> </span><span class="hs-glyph">=</span><span> </span><a href="Paths_laop.html#catchIO"><span class="hs-identifier hs-var">catchIO</span></a><span> </span><span class="hs-special">(</span><span class="hs-identifier hs-var">getEnv</span><span> </span><span class="hs-string">&quot;laop_libdir&quot;</span><span class="hs-special">)</span><span> </span><span class="hs-special">(</span><span class="hs-glyph">\</span><span class="hs-identifier">_</span><span> </span><span class="hs-glyph">-&gt;</span><span> </span><span class="hs-identifier hs-var">return</span><span> </span><a href="Paths_laop.html#libdir"><span class="hs-identifier hs-var">libdir</span></a><span class="hs-special">)</span><span>
42+</span><a name="line-42"></a><a name="getDynLibDir"><a href="Paths_laop.html#getDynLibDir"><span class="hs-identifier">getDynLibDir</span></a></a><span> </span><span class="hs-glyph">=</span><span> </span><a href="Paths_laop.html#catchIO"><span class="hs-identifier hs-var">catchIO</span></a><span> </span><span class="hs-special">(</span><span class="hs-identifier hs-var">getEnv</span><span> </span><span class="hs-string">&quot;laop_dynlibdir&quot;</span><span class="hs-special">)</span><span> </span><span class="hs-special">(</span><span class="hs-glyph">\</span><span class="hs-identifier">_</span><span> </span><span class="hs-glyph">-&gt;</span><span> </span><span class="hs-identifier hs-var">return</span><span> </span><a href="Paths_laop.html#dynlibdir"><span class="hs-identifier hs-var">dynlibdir</span></a><span class="hs-special">)</span><span>
43+</span><a name="line-43"></a><a name="getDataDir"><a href="Paths_laop.html#getDataDir"><span class="hs-identifier">getDataDir</span></a></a><span> </span><span class="hs-glyph">=</span><span> </span><a href="Paths_laop.html#catchIO"><span class="hs-identifier hs-var">catchIO</span></a><span> </span><span class="hs-special">(</span><span class="hs-identifier hs-var">getEnv</span><span> </span><span class="hs-string">&quot;laop_datadir&quot;</span><span class="hs-special">)</span><span> </span><span class="hs-special">(</span><span class="hs-glyph">\</span><span class="hs-identifier">_</span><span> </span><span class="hs-glyph">-&gt;</span><span> </span><span class="hs-identifier hs-var">return</span><span> </span><a href="Paths_laop.html#datadir"><span class="hs-identifier hs-var">datadir</span></a><span class="hs-special">)</span><span>
44+</span><a name="line-44"></a><a name="getLibexecDir"><a href="Paths_laop.html#getLibexecDir"><span class="hs-identifier">getLibexecDir</span></a></a><span> </span><span class="hs-glyph">=</span><span> </span><a href="Paths_laop.html#catchIO"><span class="hs-identifier hs-var">catchIO</span></a><span> </span><span class="hs-special">(</span><span class="hs-identifier hs-var">getEnv</span><span> </span><span class="hs-string">&quot;laop_libexecdir&quot;</span><span class="hs-special">)</span><span> </span><span class="hs-special">(</span><span class="hs-glyph">\</span><span class="hs-identifier">_</span><span> </span><span class="hs-glyph">-&gt;</span><span> </span><span class="hs-identifier hs-var">return</span><span> </span><a href="Paths_laop.html#libexecdir"><span class="hs-identifier hs-var">libexecdir</span></a><span class="hs-special">)</span><span>
45+</span><a name="line-45"></a><a name="getSysconfDir"><a href="Paths_laop.html#getSysconfDir"><span class="hs-identifier">getSysconfDir</span></a></a><span> </span><span class="hs-glyph">=</span><span> </span><a href="Paths_laop.html#catchIO"><span class="hs-identifier hs-var">catchIO</span></a><span> </span><span class="hs-special">(</span><span class="hs-identifier hs-var">getEnv</span><span> </span><span class="hs-string">&quot;laop_sysconfdir&quot;</span><span class="hs-special">)</span><span> </span><span class="hs-special">(</span><span class="hs-glyph">\</span><span class="hs-identifier">_</span><span> </span><span class="hs-glyph">-&gt;</span><span> </span><span class="hs-identifier hs-var">return</span><span> </span><a href="Paths_laop.html#sysconfdir"><span class="hs-identifier hs-var">sysconfdir</span></a><span class="hs-special">)</span><span>
46+</span><a name="line-46"></a><span>
47+</span><a name="line-47"></a><span class="hs-identifier">getDataFileName</span><span> </span><span class="hs-glyph">::</span><span> </span><span class="hs-identifier hs-type">FilePath</span><span> </span><span class="hs-glyph">-&gt;</span><span> </span><span class="hs-identifier hs-type">IO</span><span> </span><span class="hs-identifier hs-type">FilePath</span><span>
48+</span><a name="line-48"></a><a name="getDataFileName"><a href="Paths_laop.html#getDataFileName"><span class="hs-identifier">getDataFileName</span></a></a><span> </span><a name="local-6989586621679020854"><a href="#local-6989586621679020854"><span class="hs-identifier">name</span></a></a><span> </span><span class="hs-glyph">=</span><span> </span><span class="hs-keyword">do</span><span>
49+</span><a name="line-49"></a><span> </span><a name="local-6989586621679020855"><a href="#local-6989586621679020855"><span class="hs-identifier">dir</span></a></a><span> </span><span class="hs-glyph">&lt;-</span><span> </span><a href="Paths_laop.html#getDataDir"><span class="hs-identifier hs-var">getDataDir</span></a><span>
50+</span><a name="line-50"></a><span> </span><span class="hs-identifier hs-var">return</span><span> </span><span class="hs-special">(</span><a href="#local-6989586621679020855"><span class="hs-identifier hs-var">dir</span></a><span> </span><span class="hs-operator hs-var">++</span><span> </span><span class="hs-string">&quot;/&quot;</span><span> </span><span class="hs-operator hs-var">++</span><span> </span><a href="#local-6989586621679020854"><span class="hs-identifier hs-var">name</span></a><span class="hs-special">)</span><span>
51+</span><a name="line-51"></a></pre></body></html>
build/x86_64-linux/ghc-8.6.5/laop-0.1.0.0/doc/html/laop-0.1.0.0-docs/src/Utils.Internal.htmlnew file+177
@@ -0,0 +1,177 @@
1+<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"><html xmlns="http://www.w3.org/1999/xhtml"><head><link rel="stylesheet" type="text/css" href="style.css" /><script type="text/javascript" src="highlight.js"></script></head><body><pre><span class="hs-pragma">{-# LANGUAGE TypeApplications #-}</span><span>
2+</span><a name="line-2"></a><span class="hs-pragma">{-# LANGUAGE DataKinds #-}</span><span>
3+</span><a name="line-3"></a><span class="hs-pragma">{-# LANGUAGE FlexibleInstances #-}</span><span>
4+</span><a name="line-4"></a><span class="hs-pragma">{-# LANGUAGE GeneralizedNewtypeDeriving #-}</span><span>
5+</span><a name="line-5"></a><span class="hs-pragma">{-# LANGUAGE KindSignatures #-}</span><span>
6+</span><a name="line-6"></a><span class="hs-pragma">{-# LANGUAGE ScopedTypeVariables #-}</span><span>
7+</span><a name="line-7"></a><span>
8+</span><a name="line-8"></a><span class="hs-keyword">module</span><span> </span><span class="hs-identifier">Utils.Internal</span><span>
9+</span><a name="line-9"></a><span> </span><span class="hs-special">(</span><span> </span><span class="hs-comment">-- | This is an internal module and it is not meant to be imported.</span><span>
10+</span><a name="line-10"></a><span> </span><span class="hs-comment">--</span><span>
11+</span><a name="line-11"></a><span> </span><span class="hs-comment">-- Utility module that provides the 'Natural' data type.</span><span>
12+</span><a name="line-12"></a><span> </span><span class="hs-comment">-- The semantic associated with this data type is that</span><span>
13+</span><a name="line-13"></a><span> </span><span class="hs-comment">-- it's meant to be a restricted 'Int' value. For example</span><span>
14+</span><a name="line-14"></a><span> </span><span class="hs-comment">-- the type @Natural 6@ can only be instanciated with @Nat n@</span><span>
15+</span><a name="line-15"></a><span> </span><span class="hs-comment">-- where @0 &lt;= n &lt;= 6@. Why, You might ask, because with normal</span><span>
16+</span><a name="line-16"></a><span> </span><span class="hs-comment">-- 'Int's it is not possible to have a decent @Enum (Int, Int)@</span><span>
17+</span><a name="line-17"></a><span> </span><span class="hs-comment">-- instance. See the following probabilistic programming model as and</span><span>
18+</span><a name="line-18"></a><span> </span><span class="hs-comment">-- example:</span><span>
19+</span><a name="line-19"></a><span> </span><span class="hs-comment">--</span><span>
20+</span><a name="line-20"></a><span> </span><span class="hs-comment">-- We want to calculate the probability of the sum of two dice throws.</span><span>
21+</span><a name="line-21"></a><span> </span><span class="hs-comment">-- To do this we start by defining the sample space:</span><span>
22+</span><a name="line-22"></a><span> </span><span class="hs-comment">--</span><span>
23+</span><a name="line-23"></a><span> </span><span class="hs-comment">-- @</span><span>
24+</span><a name="line-24"></a><span> </span><span class="hs-comment">-- type SampleSpace = Int -- We think 'Int' are enough</span><span>
25+</span><a name="line-25"></a><span> </span><span class="hs-comment">--</span><span>
26+</span><a name="line-26"></a><span> </span><span class="hs-comment">-- die :: Dist Int 6</span><span>
27+</span><a name="line-27"></a><span> </span><span class="hs-comment">-- die = unifrom [1..6]</span><span>
28+</span><a name="line-28"></a><span> </span><span class="hs-comment">--</span><span>
29+</span><a name="line-29"></a><span> </span><span class="hs-comment">-- -- Promote 'Int' addition to a matrix</span><span>
30+</span><a name="line-30"></a><span> </span><span class="hs-comment">-- addM = fromF (uncurry (+)) -- Impossible</span><span>
31+</span><a name="line-31"></a><span> </span><span class="hs-comment">-- @</span><span>
32+</span><a name="line-32"></a><span> </span><span class="hs-comment">--</span><span>
33+</span><a name="line-33"></a><span> </span><span class="hs-comment">-- The last line is impossible because @(Int, Int)@ does not have</span><span>
34+</span><a name="line-34"></a><span> </span><span class="hs-comment">-- a good 'Enum' instance: @[(0, 1), (0, 2), .. (0, maxBound), (1, 0),</span><span>
35+</span><a name="line-35"></a><span> </span><span class="hs-comment">-- ..]@. And we'd like the addition matrix to be of 36 columns by 12</span><span>
36+</span><a name="line-36"></a><span> </span><span class="hs-comment">-- rows but limited to integers up to @6@!</span><span>
37+</span><a name="line-37"></a><span> </span><span class="hs-comment">--</span><span>
38+</span><a name="line-38"></a><span> </span><span class="hs-comment">-- One way to solve this issue is by defining and auxilary data type to</span><span>
39+</span><a name="line-39"></a><span> </span><span class="hs-comment">-- represent the sample space:</span><span>
40+</span><a name="line-40"></a><span> </span><span class="hs-comment">--</span><span>
41+</span><a name="line-41"></a><span> </span><span class="hs-comment">-- @</span><span>
42+</span><a name="line-42"></a><span> </span><span class="hs-comment">-- data SampleSpace = S1 | S2 | S3 | S4 | S5 | S6</span><span>
43+</span><a name="line-43"></a><span> </span><span class="hs-comment">-- deriving (Show, Eq, Enum, Bounded) -- Enum and Bounded are</span><span>
44+</span><a name="line-44"></a><span> </span><span class="hs-comment">-- important</span><span>
45+</span><a name="line-45"></a><span> </span><span class="hs-comment">-- @</span><span>
46+</span><a name="line-46"></a><span> </span><span class="hs-comment">--</span><span>
47+</span><a name="line-47"></a><span> </span><span class="hs-comment">-- And write the sample space addition function:</span><span>
48+</span><a name="line-48"></a><span> </span><span class="hs-comment">--</span><span>
49+</span><a name="line-49"></a><span> </span><span class="hs-comment">-- @</span><span>
50+</span><a name="line-50"></a><span> </span><span class="hs-comment">-- ssAdd :: SampleSpace -&gt; SampleSpace -&gt; Int</span><span>
51+</span><a name="line-51"></a><span> </span><span class="hs-comment">-- ssAdd a b = (fromEnum a + 1) + (fromEnum b + 1)</span><span>
52+</span><a name="line-52"></a><span> </span><span class="hs-comment">-- @</span><span>
53+</span><a name="line-53"></a><span> </span><span class="hs-comment">--</span><span>
54+</span><a name="line-54"></a><span> </span><span class="hs-comment">-- And then promote that function to matrix and everything is alright:</span><span>
55+</span><a name="line-55"></a><span> </span><span class="hs-comment">--</span><span>
56+</span><a name="line-56"></a><span> </span><span class="hs-comment">-- @</span><span>
57+</span><a name="line-57"></a><span> </span><span class="hs-comment">-- ssAddM = fromF' (uncurry ssAdd)</span><span>
58+</span><a name="line-58"></a><span> </span><span class="hs-comment">--</span><span>
59+</span><a name="line-59"></a><span> </span><span class="hs-comment">-- dieSumProb = ssAddM `comp` (khatri die die)</span><span>
60+</span><a name="line-60"></a><span> </span><span class="hs-comment">-- @</span><span>
61+</span><a name="line-61"></a><span> </span><span class="hs-comment">--</span><span>
62+</span><a name="line-62"></a><span> </span><span class="hs-comment">-- This is a nice solution for small sample spaces. But for larger ones</span><span>
63+</span><a name="line-63"></a><span> </span><span class="hs-comment">-- it is not feasible to write a data type with hundreds of constructors</span><span>
64+</span><a name="line-64"></a><span> </span><span class="hs-comment">-- and then write manipulation functions that need to deal with them.</span><span>
65+</span><a name="line-65"></a><span> </span><span class="hs-comment">-- To mitigate this limitation the 'Natural' type comes a long way and</span><span>
66+</span><a name="line-66"></a><span> </span><span class="hs-comment">-- allows one to model the sample in an easier way. See for instance:</span><span>
67+</span><a name="line-67"></a><span> </span><span class="hs-comment">--</span><span>
68+</span><a name="line-68"></a><span> </span><span class="hs-comment">-- @</span><span>
69+</span><a name="line-69"></a><span> </span><span class="hs-comment">-- ssAdd :: Natural 6 -&gt; Natural 6 -&gt; Natural 12</span><span>
70+</span><a name="line-70"></a><span> </span><span class="hs-comment">-- ssAdd = coerceNat (+)</span><span>
71+</span><a name="line-71"></a><span> </span><span class="hs-comment">--</span><span>
72+</span><a name="line-72"></a><span> </span><span class="hs-comment">-- ssAddM = fromF' (uncurry sumSS)</span><span>
73+</span><a name="line-73"></a><span> </span><span class="hs-comment">--</span><span>
74+</span><a name="line-74"></a><span> </span><span class="hs-comment">-- die :: Dist (Natural 6) 6</span><span>
75+</span><a name="line-75"></a><span> </span><span class="hs-comment">-- die = uniform [nat @6 1 .. nat 6]</span><span>
76+</span><a name="line-76"></a><span> </span><span class="hs-comment">--</span><span>
77+</span><a name="line-77"></a><span> </span><span class="hs-comment">-- dieSumProb = ssAddM `comp` (khatri die die)</span><span>
78+</span><a name="line-78"></a><span> </span><span class="hs-comment">-- @</span><span>
79+</span><a name="line-79"></a><span> </span><span class="hs-comment">--</span><span>
80+</span><a name="line-80"></a><span> </span><span class="hs-comment">-- * 'Natural' data type</span><span>
81+</span><a name="line-81"></a><span> </span><a href="Utils.Internal.html#Natural"><span class="hs-identifier hs-type">Natural</span></a><span class="hs-special">,</span><span>
82+</span><a name="line-82"></a><span> </span><a href="Utils.Internal.html#nat"><span class="hs-identifier hs-var">nat</span></a><span class="hs-special">,</span><span>
83+</span><a name="line-83"></a><span>
84+</span><a name="line-84"></a><span> </span><span class="hs-comment">-- * Coerce auxiliar functions to help promote 'Int' typed functions to</span><span>
85+</span><a name="line-85"></a><span> </span><span class="hs-comment">-- 'Natural' typed functions.</span><span>
86+</span><a name="line-86"></a><span> </span><a href="Utils.Internal.html#coerceNat"><span class="hs-identifier hs-var">coerceNat</span></a><span class="hs-special">,</span><span>
87+</span><a name="line-87"></a><span> </span><a href="Utils.Internal.html#coerceNat2"><span class="hs-identifier hs-var">coerceNat2</span></a><span class="hs-special">,</span><span>
88+</span><a name="line-88"></a><span> </span><a href="Utils.Internal.html#coerceNat3"><span class="hs-identifier hs-var">coerceNat3</span></a><span class="hs-special">,</span><span>
89+</span><a name="line-89"></a><span> </span><span class="hs-special">)</span><span>
90+</span><a name="line-90"></a><span class="hs-keyword">where</span><span>
91+</span><a name="line-91"></a><span>
92+</span><a name="line-92"></a><span class="hs-keyword">import</span><span> </span><span class="hs-identifier">Data.Coerce</span><span>
93+</span><a name="line-93"></a><span class="hs-keyword">import</span><span> </span><span class="hs-identifier">Data.Proxy</span><span>
94+</span><a name="line-94"></a><span class="hs-keyword">import</span><span> </span><span class="hs-identifier">GHC.TypeLits</span><span>
95+</span><a name="line-95"></a><span class="hs-keyword">import</span><span> </span><span class="hs-identifier">Control.DeepSeq</span><span>
96+</span><a name="line-96"></a><span>
97+</span><a name="line-97"></a><span class="hs-comment">-- | Wrapper around 'Int's that have a restrictive semantic associated.</span><span>
98+</span><a name="line-98"></a><span class="hs-comment">-- A value of type @'Natural' n m@ can only be instanciated with some 'Int'</span><span>
99+</span><a name="line-99"></a><span class="hs-comment">-- @i@ that's @n &lt;= i &lt;= m@.</span><span>
100+</span><a name="line-100"></a><span class="hs-keyword">newtype</span><span> </span><a name="Natural"><a href="Utils.Internal.html#Natural"><span class="hs-identifier">Natural</span></a></a><span> </span><span class="hs-special">(</span><a name="local-6989586621679023463"><a href="#local-6989586621679023463"><span class="hs-identifier">start</span></a></a><span> </span><span class="hs-glyph">::</span><span> </span><span class="hs-identifier hs-type">Nat</span><span class="hs-special">)</span><span> </span><span class="hs-special">(</span><a name="local-6989586621679023464"><a href="#local-6989586621679023464"><span class="hs-identifier">end</span></a></a><span> </span><span class="hs-glyph">::</span><span> </span><span class="hs-identifier hs-type">Nat</span><span class="hs-special">)</span><span> </span><span class="hs-glyph">=</span><span> </span><a name="Nat"><a href="Utils.Internal.html#Nat"><span class="hs-identifier">Nat</span></a></a><span> </span><span class="hs-identifier hs-type">Int</span><span>
101+</span><a name="line-101"></a><span> </span><span class="hs-keyword">deriving</span><span> </span><span class="hs-special">(</span><span class="hs-identifier hs-type">Show</span><span class="hs-special">,</span><span> </span><span class="hs-identifier hs-type">Read</span><span class="hs-special">,</span><span> </span><span class="hs-identifier hs-type">Eq</span><span class="hs-special">,</span><span> </span><span class="hs-identifier hs-type">Ord</span><span class="hs-special">,</span><span> </span><span class="hs-identifier hs-type">NFData</span><span class="hs-special">)</span><span>
102+</span><a name="line-102"></a><span>
103+</span><a name="line-103"></a><span class="hs-comment">-- | Throws a runtime error if any of the operations overflows or</span><span>
104+</span><a name="line-104"></a><span class="hs-comment">-- underflows.</span><span>
105+</span><a name="line-105"></a><span class="hs-keyword">instance</span><span> </span><span class="hs-special">(</span><span class="hs-identifier hs-type">KnownNat</span><span> </span><a href="#local-6989586621679031022"><span class="hs-identifier hs-type">n</span></a><span class="hs-special">,</span><span> </span><span class="hs-identifier hs-type">KnownNat</span><span> </span><a href="#local-6989586621679031023"><span class="hs-identifier hs-type">m</span></a><span class="hs-special">)</span><span> </span><span class="hs-glyph">=&gt;</span><span> </span><span class="hs-identifier hs-type">Num</span><span> </span><span class="hs-special">(</span><a href="Utils.Internal.html#Natural"><span class="hs-identifier hs-type">Natural</span></a><span> </span><a href="#local-6989586621679031022"><span class="hs-identifier hs-type">n</span></a><span> </span><a href="#local-6989586621679031023"><span class="hs-identifier hs-type">m</span></a><span class="hs-special">)</span><span> </span><span class="hs-keyword">where</span><span>
106+</span><a name="line-106"></a><span> </span><span class="hs-special">(</span><a href="Utils.Internal.html#Nat"><span class="hs-identifier hs-var">Nat</span></a><span> </span><a name="local-6989586621679031024"><a href="#local-6989586621679031024"><span class="hs-identifier">a</span></a></a><span class="hs-special">)</span><span> </span><a name="local-8214565720323790403"><span class="hs-operator">+</span></a><span> </span><span class="hs-special">(</span><a href="Utils.Internal.html#Nat"><span class="hs-identifier hs-var">Nat</span></a><span> </span><a name="local-6989586621679031025"><a href="#local-6989586621679031025"><span class="hs-identifier">b</span></a></a><span class="hs-special">)</span><span> </span><span class="hs-glyph">=</span><span> </span><a href="Utils.Internal.html#nat"><span class="hs-identifier hs-var">nat</span></a><span> </span><span class="hs-glyph">@</span><a href="#local-6989586621679031022"><span class="hs-identifier hs-type">n</span></a><span> </span><span class="hs-glyph">@</span><a href="#local-6989586621679031023"><span class="hs-identifier hs-type">m</span></a><span> </span><span class="hs-special">(</span><a href="#local-6989586621679031024"><span class="hs-identifier hs-var">a</span></a><span> </span><span class="hs-operator hs-var">+</span><span> </span><a href="#local-6989586621679031025"><span class="hs-identifier hs-var">b</span></a><span class="hs-special">)</span><span>
107+</span><a name="line-107"></a><span> </span><span class="hs-special">(</span><a href="Utils.Internal.html#Nat"><span class="hs-identifier hs-var">Nat</span></a><span> </span><a name="local-6989586621679031026"><a href="#local-6989586621679031026"><span class="hs-identifier">a</span></a></a><span class="hs-special">)</span><span> </span><span class="hs-glyph">-</span><span> </span><span class="hs-special">(</span><a href="Utils.Internal.html#Nat"><span class="hs-identifier hs-var">Nat</span></a><span> </span><a name="local-6989586621679031027"><a href="#local-6989586621679031027"><span class="hs-identifier">b</span></a></a><span class="hs-special">)</span><span> </span><span class="hs-glyph">=</span><span> </span><a href="Utils.Internal.html#nat"><span class="hs-identifier hs-var">nat</span></a><span> </span><span class="hs-glyph">@</span><a href="#local-6989586621679031022"><span class="hs-identifier hs-type">n</span></a><span> </span><span class="hs-glyph">@</span><a href="#local-6989586621679031023"><span class="hs-identifier hs-type">m</span></a><span> </span><span class="hs-special">(</span><a href="#local-6989586621679031026"><span class="hs-identifier hs-var">a</span></a><span> </span><span class="hs-glyph">-</span><span> </span><a href="#local-6989586621679031027"><span class="hs-identifier hs-var">b</span></a><span class="hs-special">)</span><span>
108+</span><a name="line-108"></a><span> </span><span class="hs-special">(</span><a href="Utils.Internal.html#Nat"><span class="hs-identifier hs-var">Nat</span></a><span> </span><a name="local-6989586621679031028"><a href="#local-6989586621679031028"><span class="hs-identifier">a</span></a></a><span class="hs-special">)</span><span> </span><a name="local-8214565720323790402"><span class="hs-operator">*</span></a><span> </span><span class="hs-special">(</span><a href="Utils.Internal.html#Nat"><span class="hs-identifier hs-var">Nat</span></a><span> </span><a name="local-6989586621679031029"><a href="#local-6989586621679031029"><span class="hs-identifier">b</span></a></a><span class="hs-special">)</span><span> </span><span class="hs-glyph">=</span><span> </span><a href="Utils.Internal.html#nat"><span class="hs-identifier hs-var">nat</span></a><span> </span><span class="hs-glyph">@</span><a href="#local-6989586621679031022"><span class="hs-identifier hs-type">n</span></a><span> </span><span class="hs-glyph">@</span><a href="#local-6989586621679031023"><span class="hs-identifier hs-type">m</span></a><span> </span><span class="hs-special">(</span><a href="#local-6989586621679031028"><span class="hs-identifier hs-var">a</span></a><span> </span><span class="hs-operator hs-var">*</span><span> </span><a href="#local-6989586621679031029"><span class="hs-identifier hs-var">b</span></a><span class="hs-special">)</span><span>
109+</span><a name="line-109"></a><span> </span><a name="local-8214565720323790401"><span class="hs-identifier">abs</span></a><span> </span><span class="hs-special">(</span><a href="Utils.Internal.html#Nat"><span class="hs-identifier hs-var">Nat</span></a><span> </span><a name="local-6989586621679031030"><a href="#local-6989586621679031030"><span class="hs-identifier">a</span></a></a><span class="hs-special">)</span><span> </span><span class="hs-glyph">=</span><span> </span><a href="Utils.Internal.html#nat"><span class="hs-identifier hs-var">nat</span></a><span> </span><span class="hs-glyph">@</span><a href="#local-6989586621679031022"><span class="hs-identifier hs-type">n</span></a><span> </span><span class="hs-glyph">@</span><a href="#local-6989586621679031023"><span class="hs-identifier hs-type">m</span></a><span> </span><span class="hs-special">(</span><span class="hs-identifier hs-var">abs</span><span> </span><a href="#local-6989586621679031030"><span class="hs-identifier hs-var">a</span></a><span class="hs-special">)</span><span>
110+</span><a name="line-110"></a><span> </span><a name="local-8214565720323790400"><span class="hs-identifier">signum</span></a><span> </span><span class="hs-special">(</span><a href="Utils.Internal.html#Nat"><span class="hs-identifier hs-var">Nat</span></a><span> </span><a name="local-6989586621679031031"><a href="#local-6989586621679031031"><span class="hs-identifier">a</span></a></a><span class="hs-special">)</span><span> </span><span class="hs-glyph">=</span><span> </span><a href="Utils.Internal.html#nat"><span class="hs-identifier hs-var">nat</span></a><span> </span><span class="hs-glyph">@</span><a href="#local-6989586621679031022"><span class="hs-identifier hs-type">n</span></a><span> </span><span class="hs-glyph">@</span><a href="#local-6989586621679031023"><span class="hs-identifier hs-type">m</span></a><span> </span><span class="hs-special">(</span><span class="hs-identifier hs-var">signum</span><span> </span><a href="#local-6989586621679031031"><span class="hs-identifier hs-var">a</span></a><span class="hs-special">)</span><span>
111+</span><a name="line-111"></a><span> </span><a name="local-3458764513820541088"><span class="hs-identifier">fromInteger</span></a><span> </span><a name="local-6989586621679031032"><a href="#local-6989586621679031032"><span class="hs-identifier">i</span></a></a><span> </span><span class="hs-glyph">=</span><span> </span><a href="Utils.Internal.html#nat"><span class="hs-identifier hs-var">nat</span></a><span> </span><span class="hs-glyph">@</span><a href="#local-6989586621679031022"><span class="hs-identifier hs-type">n</span></a><span> </span><span class="hs-glyph">@</span><a href="#local-6989586621679031023"><span class="hs-identifier hs-type">m</span></a><span> </span><span class="hs-special">(</span><span class="hs-identifier hs-var">fromInteger</span><span> </span><a href="#local-6989586621679031032"><span class="hs-identifier hs-var">i</span></a><span class="hs-special">)</span><span>
112+</span><a name="line-112"></a><span>
113+</span><a name="line-113"></a><span class="hs-comment">-- | Natural constructor function. Throws a runtime error if the 'Int'</span><span>
114+</span><a name="line-114"></a><span class="hs-comment">-- value is greater than the corresponding @m@ or lower than @n@ in the @'Natural' n m@ type.</span><span>
115+</span><a name="line-115"></a><span class="hs-identifier">nat</span><span> </span><span class="hs-glyph">::</span><span> </span><span class="hs-keyword">forall</span><span> </span><a name="local-6989586621679031052"><a href="#local-6989586621679031052"><span class="hs-identifier">n</span></a></a><span> </span><a name="local-6989586621679031053"><a href="#local-6989586621679031053"><span class="hs-identifier">m</span></a></a><span> </span><span class="hs-operator">.</span><span> </span><span class="hs-special">(</span><span class="hs-identifier hs-type">KnownNat</span><span> </span><a href="#local-6989586621679031052"><span class="hs-identifier hs-type">n</span></a><span class="hs-special">,</span><span> </span><span class="hs-identifier hs-type">KnownNat</span><span> </span><a href="#local-6989586621679031053"><span class="hs-identifier hs-type">m</span></a><span class="hs-special">)</span><span> </span><span class="hs-glyph">=&gt;</span><span> </span><span class="hs-identifier hs-type">Int</span><span> </span><span class="hs-glyph">-&gt;</span><span> </span><a href="Utils.Internal.html#Natural"><span class="hs-identifier hs-type">Natural</span></a><span> </span><a href="#local-6989586621679031052"><span class="hs-identifier hs-type">n</span></a><span> </span><a href="#local-6989586621679031053"><span class="hs-identifier hs-type">m</span></a><span>
116+</span><a name="line-116"></a><a name="nat"><a href="Utils.Internal.html#nat"><span class="hs-identifier">nat</span></a></a><span> </span><a name="local-6989586621679031054"><a href="#local-6989586621679031054"><span class="hs-identifier">i</span></a></a><span> </span><span class="hs-glyph">=</span><span>
117+</span><a name="line-117"></a><span> </span><span class="hs-keyword">let</span><span> </span><a name="local-6989586621679031055"><a href="#local-6989586621679031055"><span class="hs-identifier">start</span></a></a><span> </span><span class="hs-glyph">=</span><span> </span><span class="hs-identifier hs-var">fromInteger</span><span> </span><span class="hs-special">(</span><span class="hs-identifier hs-var">natVal</span><span> </span><span class="hs-special">(</span><span class="hs-identifier hs-var">Proxy</span><span> </span><span class="hs-glyph">::</span><span> </span><span class="hs-identifier hs-type">Proxy</span><span> </span><a href="#local-6989586621679031052"><span class="hs-identifier hs-type">n</span></a><span class="hs-special">)</span><span class="hs-special">)</span><span>
118+</span><a name="line-118"></a><span> </span><a name="local-6989586621679031056"><a href="#local-6989586621679031056"><span class="hs-identifier">end</span></a></a><span> </span><span class="hs-glyph">=</span><span> </span><span class="hs-identifier hs-var">fromInteger</span><span> </span><span class="hs-special">(</span><span class="hs-identifier hs-var">natVal</span><span> </span><span class="hs-special">(</span><span class="hs-identifier hs-var">Proxy</span><span> </span><span class="hs-glyph">::</span><span> </span><span class="hs-identifier hs-type">Proxy</span><span> </span><a href="#local-6989586621679031053"><span class="hs-identifier hs-type">m</span></a><span class="hs-special">)</span><span class="hs-special">)</span><span>
119+</span><a name="line-119"></a><span> </span><span class="hs-keyword">in</span><span> </span><span class="hs-keyword">if</span><span> </span><a href="#local-6989586621679031055"><span class="hs-identifier hs-var">start</span></a><span> </span><span class="hs-operator hs-var">&lt;=</span><span> </span><a href="#local-6989586621679031054"><span class="hs-identifier hs-var">i</span></a><span> </span><span class="hs-operator hs-var">&amp;&amp;</span><span> </span><a href="#local-6989586621679031054"><span class="hs-identifier hs-var">i</span></a><span> </span><span class="hs-operator hs-var">&lt;=</span><span> </span><a href="#local-6989586621679031056"><span class="hs-identifier hs-var">end</span></a><span>
120+</span><a name="line-120"></a><span> </span><span class="hs-keyword">then</span><span> </span><a href="Utils.Internal.html#Nat"><span class="hs-identifier hs-var">Nat</span></a><span> </span><a href="#local-6989586621679031054"><span class="hs-identifier hs-var">i</span></a><span>
121+</span><a name="line-121"></a><span> </span><span class="hs-keyword">else</span><span> </span><span class="hs-identifier hs-var">error</span><span> </span><span class="hs-string">&quot;Off limits&quot;</span><span>
122+</span><a name="line-122"></a><span>
123+</span><a name="line-123"></a><span class="hs-comment">-- | Auxiliary function that promotes binary 'Int' functions to 'Natural'</span><span>
124+</span><a name="line-124"></a><span class="hs-comment">-- binary functions.</span><span>
125+</span><a name="line-125"></a><span class="hs-identifier">coerceNat</span><span> </span><span class="hs-glyph">::</span><span> </span><span class="hs-special">(</span><span class="hs-identifier hs-type">Int</span><span> </span><span class="hs-glyph">-&gt;</span><span> </span><span class="hs-identifier hs-type">Int</span><span> </span><span class="hs-glyph">-&gt;</span><span> </span><span class="hs-identifier hs-type">Int</span><span class="hs-special">)</span><span> </span><span class="hs-glyph">-&gt;</span><span> </span><span class="hs-special">(</span><a href="Utils.Internal.html#Natural"><span class="hs-identifier hs-type">Natural</span></a><span> </span><a href="#local-6989586621679031046"><span class="hs-identifier hs-type">a</span></a><span> </span><a href="#local-6989586621679031047"><span class="hs-identifier hs-type">a'</span></a><span> </span><span class="hs-glyph">-&gt;</span><span> </span><a href="Utils.Internal.html#Natural"><span class="hs-identifier hs-type">Natural</span></a><span> </span><a href="#local-6989586621679031048"><span class="hs-identifier hs-type">b</span></a><span> </span><a href="#local-6989586621679031049"><span class="hs-identifier hs-type">b'</span></a><span> </span><span class="hs-glyph">-&gt;</span><span> </span><a href="Utils.Internal.html#Natural"><span class="hs-identifier hs-type">Natural</span></a><span> </span><a href="#local-6989586621679031050"><span class="hs-identifier hs-type">c</span></a><span> </span><a href="#local-6989586621679031051"><span class="hs-identifier hs-type">c'</span></a><span class="hs-special">)</span><span>
126+</span><a name="line-126"></a><a name="coerceNat"><a href="Utils.Internal.html#coerceNat"><span class="hs-identifier">coerceNat</span></a></a><span> </span><span class="hs-glyph">=</span><span> </span><span class="hs-identifier hs-var">coerce</span><span>
127+</span><a name="line-127"></a><span>
128+</span><a name="line-128"></a><span class="hs-comment">-- | Auxiliary function that promotes ternary (binary) 'Int' functions to 'Natural'</span><span>
129+</span><a name="line-129"></a><span class="hs-comment">-- functions.</span><span>
130+</span><a name="line-130"></a><span class="hs-identifier">coerceNat2</span><span> </span><span class="hs-glyph">::</span><span> </span><span class="hs-special">(</span><span class="hs-special">(</span><span class="hs-identifier hs-type">Int</span><span class="hs-special">,</span><span> </span><span class="hs-identifier hs-type">Int</span><span class="hs-special">)</span><span> </span><span class="hs-glyph">-&gt;</span><span> </span><span class="hs-identifier hs-type">Int</span><span> </span><span class="hs-glyph">-&gt;</span><span> </span><span class="hs-identifier hs-type">Int</span><span class="hs-special">)</span><span> </span><span class="hs-glyph">-&gt;</span><span> </span><span class="hs-special">(</span><span class="hs-special">(</span><a href="Utils.Internal.html#Natural"><span class="hs-identifier hs-type">Natural</span></a><span> </span><a href="#local-6989586621679031038"><span class="hs-identifier hs-type">a</span></a><span> </span><a href="#local-6989586621679031039"><span class="hs-identifier hs-type">a'</span></a><span class="hs-special">,</span><span> </span><a href="Utils.Internal.html#Natural"><span class="hs-identifier hs-type">Natural</span></a><span> </span><a href="#local-6989586621679031040"><span class="hs-identifier hs-type">b</span></a><span> </span><a href="#local-6989586621679031041"><span class="hs-identifier hs-type">b'</span></a><span class="hs-special">)</span><span> </span><span class="hs-glyph">-&gt;</span><span> </span><a href="Utils.Internal.html#Natural"><span class="hs-identifier hs-type">Natural</span></a><span> </span><a href="#local-6989586621679031042"><span class="hs-identifier hs-type">c</span></a><span> </span><a href="#local-6989586621679031043"><span class="hs-identifier hs-type">c'</span></a><span> </span><span class="hs-glyph">-&gt;</span><span> </span><a href="Utils.Internal.html#Natural"><span class="hs-identifier hs-type">Natural</span></a><span> </span><a href="#local-6989586621679031044"><span class="hs-identifier hs-type">d</span></a><span> </span><a href="#local-6989586621679031045"><span class="hs-identifier hs-type">d'</span></a><span class="hs-special">)</span><span>
131+</span><a name="line-131"></a><a name="coerceNat2"><a href="Utils.Internal.html#coerceNat2"><span class="hs-identifier">coerceNat2</span></a></a><span> </span><span class="hs-glyph">=</span><span> </span><span class="hs-identifier hs-var">coerce</span><span>
132+</span><a name="line-132"></a><span>
133+</span><a name="line-133"></a><span class="hs-comment">-- | Auxiliary function that promotes ternary (binary) 'Int' functions to 'Natural'</span><span>
134+</span><a name="line-134"></a><span class="hs-comment">-- functions.</span><span>
135+</span><a name="line-135"></a><span class="hs-identifier">coerceNat3</span><span> </span><span class="hs-glyph">::</span><span> </span><span class="hs-special">(</span><span class="hs-identifier hs-type">Int</span><span> </span><span class="hs-glyph">-&gt;</span><span> </span><span class="hs-identifier hs-type">Int</span><span> </span><span class="hs-glyph">-&gt;</span><span> </span><a href="#local-6989586621679031033"><span class="hs-identifier hs-type">a</span></a><span class="hs-special">)</span><span> </span><span class="hs-glyph">-&gt;</span><span> </span><span class="hs-special">(</span><a href="Utils.Internal.html#Natural"><span class="hs-identifier hs-type">Natural</span></a><span> </span><a href="#local-6989586621679031034"><span class="hs-identifier hs-type">b</span></a><span> </span><a href="#local-6989586621679031035"><span class="hs-identifier hs-type">b'</span></a><span> </span><span class="hs-glyph">-&gt;</span><span> </span><a href="Utils.Internal.html#Natural"><span class="hs-identifier hs-type">Natural</span></a><span> </span><a href="#local-6989586621679031036"><span class="hs-identifier hs-type">c</span></a><span> </span><a href="#local-6989586621679031037"><span class="hs-identifier hs-type">c'</span></a><span> </span><span class="hs-glyph">-&gt;</span><span> </span><a href="#local-6989586621679031033"><span class="hs-identifier hs-type">a</span></a><span class="hs-special">)</span><span>
136+</span><a name="line-136"></a><a name="coerceNat3"><a href="Utils.Internal.html#coerceNat3"><span class="hs-identifier">coerceNat3</span></a></a><span> </span><span class="hs-glyph">=</span><span> </span><span class="hs-identifier hs-var">coerce</span><span>
137+</span><a name="line-137"></a><span>
138+</span><a name="line-138"></a><span class="hs-keyword">instance</span><span> </span><span class="hs-special">(</span><span class="hs-identifier hs-type">KnownNat</span><span> </span><a href="#local-6989586621679031020"><span class="hs-identifier hs-type">n</span></a><span class="hs-special">,</span><span> </span><span class="hs-identifier hs-type">KnownNat</span><span> </span><a href="#local-6989586621679031021"><span class="hs-identifier hs-type">m</span></a><span class="hs-special">)</span><span> </span><span class="hs-glyph">=&gt;</span><span> </span><span class="hs-identifier hs-type">Bounded</span><span> </span><span class="hs-special">(</span><a href="Utils.Internal.html#Natural"><span class="hs-identifier hs-type">Natural</span></a><span> </span><a href="#local-6989586621679031020"><span class="hs-identifier hs-type">n</span></a><span> </span><a href="#local-6989586621679031021"><span class="hs-identifier hs-type">m</span></a><span class="hs-special">)</span><span> </span><span class="hs-keyword">where</span><span>
139+</span><a name="line-139"></a><span> </span><a name="local-8214565720323790309"><span class="hs-identifier">minBound</span></a><span> </span><span class="hs-glyph">=</span><span> </span><a href="Utils.Internal.html#Nat"><span class="hs-identifier hs-var">Nat</span></a><span> </span><span class="hs-operator hs-var">$</span><span> </span><span class="hs-identifier hs-var">fromInteger</span><span> </span><span class="hs-special">(</span><span class="hs-identifier hs-var">natVal</span><span> </span><span class="hs-special">(</span><span class="hs-identifier hs-var">Proxy</span><span> </span><span class="hs-glyph">::</span><span> </span><span class="hs-identifier hs-type">Proxy</span><span> </span><a href="#local-6989586621679031020"><span class="hs-identifier hs-type">n</span></a><span class="hs-special">)</span><span class="hs-special">)</span><span>
140+</span><a name="line-140"></a><span> </span><a name="local-8214565720323790308"><span class="hs-identifier">maxBound</span></a><span> </span><span class="hs-glyph">=</span><span> </span><a href="Utils.Internal.html#Nat"><span class="hs-identifier hs-var">Nat</span></a><span> </span><span class="hs-operator hs-var">$</span><span> </span><span class="hs-identifier hs-var">fromInteger</span><span> </span><span class="hs-special">(</span><span class="hs-identifier hs-var">natVal</span><span> </span><span class="hs-special">(</span><span class="hs-identifier hs-var">Proxy</span><span> </span><span class="hs-glyph">::</span><span> </span><span class="hs-identifier hs-type">Proxy</span><span> </span><a href="#local-6989586621679031021"><span class="hs-identifier hs-type">m</span></a><span class="hs-special">)</span><span class="hs-special">)</span><span>
141+</span><a name="line-141"></a><span>
142+</span><a name="line-142"></a><span class="hs-keyword">instance</span><span> </span><span class="hs-special">(</span><span class="hs-identifier hs-type">KnownNat</span><span> </span><a href="#local-6989586621679030849"><span class="hs-identifier hs-type">n</span></a><span class="hs-special">,</span><span> </span><span class="hs-identifier hs-type">KnownNat</span><span> </span><a href="#local-6989586621679030850"><span class="hs-identifier hs-type">m</span></a><span class="hs-special">)</span><span> </span><span class="hs-glyph">=&gt;</span><span> </span><span class="hs-identifier hs-type">Enum</span><span> </span><span class="hs-special">(</span><a href="Utils.Internal.html#Natural"><span class="hs-identifier hs-type">Natural</span></a><span> </span><a href="#local-6989586621679030849"><span class="hs-identifier hs-type">n</span></a><span> </span><a href="#local-6989586621679030850"><span class="hs-identifier hs-type">m</span></a><span class="hs-special">)</span><span> </span><span class="hs-keyword">where</span><span>
143+</span><a name="line-143"></a><span> </span><a name="local-8214565720323790311"><span class="hs-identifier">toEnum</span></a><span> </span><a name="local-6989586621679031001"><a href="#local-6989586621679031001"><span class="hs-identifier">i</span></a></a><span> </span><span class="hs-glyph">=</span><span>
144+</span><a name="line-144"></a><span> </span><span class="hs-keyword">let</span><span> </span><a name="local-6989586621679031002"><a href="#local-6989586621679031002"><span class="hs-identifier">start</span></a></a><span> </span><span class="hs-glyph">=</span><span> </span><span class="hs-identifier hs-var">fromInteger</span><span> </span><span class="hs-special">(</span><span class="hs-identifier hs-var">natVal</span><span> </span><span class="hs-special">(</span><span class="hs-identifier hs-var">Proxy</span><span> </span><span class="hs-glyph">::</span><span> </span><span class="hs-identifier hs-type">Proxy</span><span> </span><a href="#local-6989586621679030849"><span class="hs-identifier hs-type">n</span></a><span class="hs-special">)</span><span class="hs-special">)</span><span>
145+</span><a name="line-145"></a><span> </span><span class="hs-keyword">in</span><span> </span><a href="Utils.Internal.html#nat"><span class="hs-identifier hs-var">nat</span></a><span> </span><span class="hs-special">(</span><a href="#local-6989586621679031002"><span class="hs-identifier hs-var">start</span></a><span> </span><span class="hs-operator hs-var">+</span><span> </span><a href="#local-6989586621679031001"><span class="hs-identifier hs-var">i</span></a><span class="hs-special">)</span><span>
146+</span><a name="line-146"></a><span> </span><span class="hs-comment">-- | Throws a runtime error if the value is off limits</span><span>
147+</span><a name="line-147"></a><span> </span><a name="local-8214565720323790310"><span class="hs-identifier">fromEnum</span></a><span> </span><span class="hs-special">(</span><a href="Utils.Internal.html#Nat"><span class="hs-identifier hs-var">Nat</span></a><span> </span><a name="local-6989586621679031003"><a href="#local-6989586621679031003"><span class="hs-identifier">nat</span></a></a><span class="hs-special">)</span><span> </span><span class="hs-glyph">=</span><span>
148+</span><a name="line-148"></a><span> </span><span class="hs-keyword">let</span><span> </span><a name="local-6989586621679031004"><a href="#local-6989586621679031004"><span class="hs-identifier">start</span></a></a><span> </span><span class="hs-glyph">=</span><span> </span><span class="hs-identifier hs-var">fromInteger</span><span> </span><span class="hs-special">(</span><span class="hs-identifier hs-var">natVal</span><span> </span><span class="hs-special">(</span><span class="hs-identifier hs-var">Proxy</span><span> </span><span class="hs-glyph">::</span><span> </span><span class="hs-identifier hs-type">Proxy</span><span> </span><a href="#local-6989586621679030849"><span class="hs-identifier hs-type">n</span></a><span class="hs-special">)</span><span class="hs-special">)</span><span>
149+</span><a name="line-149"></a><span> </span><a name="local-6989586621679031005"><a href="#local-6989586621679031005"><span class="hs-identifier">end</span></a></a><span> </span><span class="hs-glyph">=</span><span> </span><span class="hs-identifier hs-var">fromInteger</span><span> </span><span class="hs-special">(</span><span class="hs-identifier hs-var">natVal</span><span> </span><span class="hs-special">(</span><span class="hs-identifier hs-var">Proxy</span><span> </span><span class="hs-glyph">::</span><span> </span><span class="hs-identifier hs-type">Proxy</span><span> </span><a href="#local-6989586621679030850"><span class="hs-identifier hs-type">m</span></a><span class="hs-special">)</span><span class="hs-special">)</span><span>
150+</span><a name="line-150"></a><span> </span><span class="hs-keyword">in</span><span> </span><span class="hs-keyword">if</span><span> </span><a href="#local-6989586621679031004"><span class="hs-identifier hs-var">start</span></a><span> </span><span class="hs-operator hs-var">&lt;=</span><span> </span><a href="#local-6989586621679031003"><span class="hs-identifier hs-var">nat</span></a><span> </span><span class="hs-operator hs-var">&amp;&amp;</span><span> </span><a href="#local-6989586621679031003"><span class="hs-identifier hs-var">nat</span></a><span> </span><span class="hs-operator hs-var">&lt;=</span><span> </span><a href="#local-6989586621679031005"><span class="hs-identifier hs-var">end</span></a><span>
151+</span><a name="line-151"></a><span> </span><span class="hs-keyword">then</span><span> </span><a href="#local-6989586621679031003"><span class="hs-identifier hs-var">nat</span></a><span> </span><span class="hs-glyph">-</span><span> </span><a href="#local-6989586621679031004"><span class="hs-identifier hs-var">start</span></a><span>
152+</span><a name="line-152"></a><span> </span><span class="hs-keyword">else</span><span> </span><span class="hs-identifier hs-var">error</span><span> </span><span class="hs-string">&quot;Off limits&quot;</span><span>
153+</span><a name="line-153"></a><span>
154+</span><a name="line-154"></a><span class="hs-comment">-- | Optimized 'Enum' instance for tuples that comply with the given</span><span>
155+</span><a name="line-155"></a><span class="hs-comment">-- constraints.</span><span>
156+</span><a name="line-156"></a><span class="hs-keyword">instance</span><span>
157+</span><a name="line-157"></a><span> </span><span class="hs-special">(</span><span> </span><span class="hs-identifier hs-type">Enum</span><span> </span><a href="#local-6989586621679029190"><span class="hs-identifier hs-type">a</span></a><span class="hs-special">,</span><span>
158+</span><a name="line-158"></a><span> </span><span class="hs-identifier hs-type">Enum</span><span> </span><a href="#local-6989586621679029191"><span class="hs-identifier hs-type">b</span></a><span class="hs-special">,</span><span>
159+</span><a name="line-159"></a><span> </span><span class="hs-identifier hs-type">Bounded</span><span> </span><a href="#local-6989586621679029191"><span class="hs-identifier hs-type">b</span></a><span>
160+</span><a name="line-160"></a><span> </span><span class="hs-special">)</span><span> </span><span class="hs-glyph">=&gt;</span><span>
161+</span><a name="line-161"></a><span> </span><span class="hs-identifier hs-type">Enum</span><span> </span><span class="hs-special">(</span><a href="#local-6989586621679029190"><span class="hs-identifier hs-type">a</span></a><span class="hs-special">,</span><span> </span><a href="#local-6989586621679029191"><span class="hs-identifier hs-type">b</span></a><span class="hs-special">)</span><span>
162+</span><a name="line-162"></a><span> </span><span class="hs-keyword">where</span><span>
163+</span><a name="line-163"></a><span>
164+</span><a name="line-164"></a><span> </span><a name="local-8214565720323790311"><span class="hs-identifier">toEnum</span></a><span> </span><a name="local-6989586621679029192"><a href="#local-6989586621679029192"><span class="hs-identifier">i</span></a></a><span> </span><span class="hs-glyph">=</span><span>
165+</span><a name="line-165"></a><span> </span><span class="hs-keyword">let</span><span> </span><span class="hs-special">(</span><a name="local-6989586621679029193"><a href="#local-6989586621679029193"><span class="hs-identifier">listB</span></a></a><span> </span><span class="hs-glyph">::</span><span> </span><span class="hs-special">[</span><a href="#local-6989586621679029191"><span class="hs-identifier hs-type">b</span></a><span class="hs-special">]</span><span class="hs-special">)</span><span> </span><span class="hs-glyph">=</span><span> </span><span class="hs-special">[</span><span class="hs-identifier hs-var">minBound</span><span> </span><span class="hs-glyph">..</span><span> </span><span class="hs-identifier hs-var">maxBound</span><span class="hs-special">]</span><span>
166+</span><a name="line-166"></a><span> </span><a name="local-6989586621679029194"><a href="#local-6989586621679029194"><span class="hs-identifier">lengthB</span></a></a><span> </span><span class="hs-glyph">=</span><span> </span><span class="hs-identifier hs-var">length</span><span> </span><a href="#local-6989586621679029193"><span class="hs-identifier hs-var">listB</span></a><span>
167+</span><a name="line-167"></a><span> </span><a name="local-6989586621679029195"><a href="#local-6989586621679029195"><span class="hs-identifier">fstI</span></a></a><span> </span><span class="hs-glyph">=</span><span> </span><span class="hs-identifier hs-var">div</span><span> </span><a href="#local-6989586621679029192"><span class="hs-identifier hs-var">i</span></a><span> </span><a href="#local-6989586621679029194"><span class="hs-identifier hs-var">lengthB</span></a><span>
168+</span><a name="line-168"></a><span> </span><a name="local-6989586621679029196"><a href="#local-6989586621679029196"><span class="hs-identifier">sndI</span></a></a><span> </span><span class="hs-glyph">=</span><span> </span><span class="hs-identifier hs-var">mod</span><span> </span><a href="#local-6989586621679029192"><span class="hs-identifier hs-var">i</span></a><span> </span><a href="#local-6989586621679029194"><span class="hs-identifier hs-var">lengthB</span></a><span>
169+</span><a name="line-169"></a><span> </span><span class="hs-keyword">in</span><span> </span><span class="hs-special">(</span><span class="hs-identifier hs-var">toEnum</span><span> </span><a href="#local-6989586621679029195"><span class="hs-identifier hs-var">fstI</span></a><span class="hs-special">,</span><span> </span><span class="hs-identifier hs-var">toEnum</span><span> </span><a href="#local-6989586621679029196"><span class="hs-identifier hs-var">sndI</span></a><span class="hs-special">)</span><span>
170+</span><a name="line-170"></a><span>
171+</span><a name="line-171"></a><span> </span><a name="local-8214565720323790310"><span class="hs-identifier">fromEnum</span></a><span> </span><span class="hs-special">(</span><a name="local-6989586621679030843"><a href="#local-6989586621679030843"><span class="hs-identifier">a</span></a></a><span class="hs-special">,</span><span> </span><a name="local-6989586621679030844"><a href="#local-6989586621679030844"><span class="hs-identifier">b</span></a></a><span class="hs-special">)</span><span> </span><span class="hs-glyph">=</span><span>
172+</span><a name="line-172"></a><span> </span><span class="hs-keyword">let</span><span> </span><span class="hs-special">(</span><a name="local-6989586621679030845"><a href="#local-6989586621679030845"><span class="hs-identifier">listB</span></a></a><span> </span><span class="hs-glyph">::</span><span> </span><span class="hs-special">[</span><a href="#local-6989586621679029191"><span class="hs-identifier hs-type">b</span></a><span class="hs-special">]</span><span class="hs-special">)</span><span> </span><span class="hs-glyph">=</span><span> </span><span class="hs-special">[</span><span class="hs-identifier hs-var">minBound</span><span> </span><span class="hs-glyph">..</span><span> </span><span class="hs-identifier hs-var">maxBound</span><span class="hs-special">]</span><span>
173+</span><a name="line-173"></a><span> </span><a name="local-6989586621679030846"><a href="#local-6989586621679030846"><span class="hs-identifier">lengthB</span></a></a><span> </span><span class="hs-glyph">=</span><span> </span><span class="hs-identifier hs-var">length</span><span> </span><a href="#local-6989586621679030845"><span class="hs-identifier hs-var">listB</span></a><span>
174+</span><a name="line-174"></a><span> </span><a name="local-6989586621679030847"><a href="#local-6989586621679030847"><span class="hs-identifier">fstI</span></a></a><span> </span><span class="hs-glyph">=</span><span> </span><span class="hs-identifier hs-var">fromEnum</span><span> </span><a href="#local-6989586621679030843"><span class="hs-identifier hs-var">a</span></a><span>
175+</span><a name="line-175"></a><span> </span><a name="local-6989586621679030848"><a href="#local-6989586621679030848"><span class="hs-identifier">sndI</span></a></a><span> </span><span class="hs-glyph">=</span><span> </span><span class="hs-identifier hs-var">fromEnum</span><span> </span><a href="#local-6989586621679030844"><span class="hs-identifier hs-var">b</span></a><span>
176+</span><a name="line-176"></a><span> </span><span class="hs-keyword">in</span><span> </span><a href="#local-6989586621679030847"><span class="hs-identifier hs-var">fstI</span></a><span> </span><span class="hs-operator hs-var">*</span><span> </span><a href="#local-6989586621679030846"><span class="hs-identifier hs-var">lengthB</span></a><span> </span><span class="hs-operator hs-var">+</span><span> </span><a href="#local-6989586621679030848"><span class="hs-identifier hs-var">sndI</span></a><span>
177+</span><a name="line-177"></a></pre></body></html>
build/x86_64-linux/ghc-8.6.5/laop-0.1.0.0/doc/html/laop-0.1.0.0-docs/src/Utils.htmlnew file+101
@@ -0,0 +1,101 @@
1+<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"><html xmlns="http://www.w3.org/1999/xhtml"><head><link rel="stylesheet" type="text/css" href="style.css" /><script type="text/javascript" src="highlight.js"></script></head><body><pre><span class="hs-comment">-----------------------------------------------------------------------------</span><span>
2+</span><a name="line-2"></a><span class="hs-comment">-- |</span><span>
3+</span><a name="line-3"></a><span class="hs-comment">-- Module : Utils</span><span>
4+</span><a name="line-4"></a><span class="hs-comment">-- Copyright : (c) Armando Santos 2019-2020</span><span>
5+</span><a name="line-5"></a><span class="hs-comment">-- Maintainer : armandoifsantos@gmail.com</span><span>
6+</span><a name="line-6"></a><span class="hs-comment">-- Stability : experimental</span><span>
7+</span><a name="line-7"></a><span class="hs-comment">--</span><span>
8+</span><a name="line-8"></a><span class="hs-comment">-- __LAoP__ is a library for algebraic (inductive) construction and manipulation of matrices</span><span>
9+</span><a name="line-9"></a><span class="hs-comment">-- in Haskell. See &lt;https://github.com/bolt12/master-thesis my Msc Thesis&gt; for the</span><span>
10+</span><a name="line-10"></a><span class="hs-comment">-- motivation behind the library, the underlying theory, and implementation details.</span><span>
11+</span><a name="line-11"></a><span class="hs-comment">--</span><span>
12+</span><a name="line-12"></a><span class="hs-comment">-- This module provides the 'Natural' data type.</span><span>
13+</span><a name="line-13"></a><span class="hs-comment">-- The semantic associated with this data type is that</span><span>
14+</span><a name="line-14"></a><span class="hs-comment">-- it's meant to be a restricted 'Int' value.</span><span>
15+</span><a name="line-15"></a><span class="hs-comment">--</span><span>
16+</span><a name="line-16"></a><span class="hs-comment">-----------------------------------------------------------------------------</span><span>
17+</span><a name="line-17"></a><span>
18+</span><a name="line-18"></a><span class="hs-keyword">module</span><span> </span><span class="hs-identifier">Utils</span><span>
19+</span><a name="line-19"></a><span> </span><span class="hs-special">(</span><span> </span><span class="hs-comment">-- | Utility module that provides the 'Natural' data type.</span><span>
20+</span><a name="line-20"></a><span> </span><span class="hs-comment">-- The semantic associated with this data type is that</span><span>
21+</span><a name="line-21"></a><span> </span><span class="hs-comment">-- it's meant to be a restricted 'Int' value. For example</span><span>
22+</span><a name="line-22"></a><span> </span><span class="hs-comment">-- the type @Natural 1 6@ can only be instanciated with @nat n@</span><span>
23+</span><a name="line-23"></a><span> </span><span class="hs-comment">-- where @1 &lt;= n &lt;= 6@. Why, You might ask, because with normal</span><span>
24+</span><a name="line-24"></a><span> </span><span class="hs-comment">-- 'Int's it is not possible to have a decent @Enum (Int, Int)@</span><span>
25+</span><a name="line-25"></a><span> </span><span class="hs-comment">-- instance. See the following probabilistic programming model as and</span><span>
26+</span><a name="line-26"></a><span> </span><span class="hs-comment">-- example:</span><span>
27+</span><a name="line-27"></a><span> </span><span class="hs-comment">--</span><span>
28+</span><a name="line-28"></a><span> </span><span class="hs-comment">-- We want to calculate the probability of the sum of two dice throws.</span><span>
29+</span><a name="line-29"></a><span> </span><span class="hs-comment">-- To do this we start by defining the sample space: </span><span>
30+</span><a name="line-30"></a><span> </span><span class="hs-comment">--</span><span>
31+</span><a name="line-31"></a><span> </span><span class="hs-comment">-- @</span><span>
32+</span><a name="line-32"></a><span> </span><span class="hs-comment">-- type SampleSpace = Int -- We think 'Int' are enough</span><span>
33+</span><a name="line-33"></a><span> </span><span class="hs-comment">--</span><span>
34+</span><a name="line-34"></a><span> </span><span class="hs-comment">-- die :: Dist Int 6</span><span>
35+</span><a name="line-35"></a><span> </span><span class="hs-comment">-- die = unifrom [1..6] </span><span>
36+</span><a name="line-36"></a><span> </span><span class="hs-comment">--</span><span>
37+</span><a name="line-37"></a><span> </span><span class="hs-comment">-- -- Promote 'Int' addition to a matrix</span><span>
38+</span><a name="line-38"></a><span> </span><span class="hs-comment">-- addM = fromF (uncurry (+)) -- Impossible</span><span>
39+</span><a name="line-39"></a><span> </span><span class="hs-comment">-- @</span><span>
40+</span><a name="line-40"></a><span> </span><span class="hs-comment">--</span><span>
41+</span><a name="line-41"></a><span> </span><span class="hs-comment">-- The last line is impossible because @(Int, Int)@ does not have</span><span>
42+</span><a name="line-42"></a><span> </span><span class="hs-comment">-- a good 'Enum' instance: @[(0, 1), (0, 2), .. (0, maxBound), (1, 0),</span><span>
43+</span><a name="line-43"></a><span> </span><span class="hs-comment">-- ..]@. And we'd like the addition matrix to be of 36 columns by 12</span><span>
44+</span><a name="line-44"></a><span> </span><span class="hs-comment">-- rows but limited to integers up to @6@!</span><span>
45+</span><a name="line-45"></a><span> </span><span class="hs-comment">--</span><span>
46+</span><a name="line-46"></a><span> </span><span class="hs-comment">-- One way to solve this issue is by defining and auxilary data type to</span><span>
47+</span><a name="line-47"></a><span> </span><span class="hs-comment">-- represent the sample space:</span><span>
48+</span><a name="line-48"></a><span> </span><span class="hs-comment">--</span><span>
49+</span><a name="line-49"></a><span> </span><span class="hs-comment">-- @</span><span>
50+</span><a name="line-50"></a><span> </span><span class="hs-comment">-- data SampleSpace = S1 | S2 | S3 | S4 | S5 | S6</span><span>
51+</span><a name="line-51"></a><span> </span><span class="hs-comment">-- deriving (Show, Eq, Enum, Bounded) -- Enum and Bounded are</span><span>
52+</span><a name="line-52"></a><span> </span><span class="hs-comment">-- important</span><span>
53+</span><a name="line-53"></a><span> </span><span class="hs-comment">-- @</span><span>
54+</span><a name="line-54"></a><span> </span><span class="hs-comment">--</span><span>
55+</span><a name="line-55"></a><span> </span><span class="hs-comment">-- And write the sample space addition function:</span><span>
56+</span><a name="line-56"></a><span> </span><span class="hs-comment">--</span><span>
57+</span><a name="line-57"></a><span> </span><span class="hs-comment">-- @</span><span>
58+</span><a name="line-58"></a><span> </span><span class="hs-comment">-- ssAdd :: SampleSpace -&gt; SampleSpace -&gt; Int</span><span>
59+</span><a name="line-59"></a><span> </span><span class="hs-comment">-- ssAdd a b = (fromEnum a + 1) + (fromEnum b + 1)</span><span>
60+</span><a name="line-60"></a><span> </span><span class="hs-comment">-- @</span><span>
61+</span><a name="line-61"></a><span> </span><span class="hs-comment">--</span><span>
62+</span><a name="line-62"></a><span> </span><span class="hs-comment">-- And then promote that function to matrix and everything is alright:</span><span>
63+</span><a name="line-63"></a><span> </span><span class="hs-comment">--</span><span>
64+</span><a name="line-64"></a><span> </span><span class="hs-comment">-- @</span><span>
65+</span><a name="line-65"></a><span> </span><span class="hs-comment">-- ssAddM = fromF' (uncurry ssAdd)</span><span>
66+</span><a name="line-66"></a><span> </span><span class="hs-comment">--</span><span>
67+</span><a name="line-67"></a><span> </span><span class="hs-comment">-- dieSumProb = ssAddM `comp` (khatri die die)</span><span>
68+</span><a name="line-68"></a><span> </span><span class="hs-comment">-- @</span><span>
69+</span><a name="line-69"></a><span> </span><span class="hs-comment">--</span><span>
70+</span><a name="line-70"></a><span> </span><span class="hs-comment">-- This is a nice solution for small sample spaces. But for larger ones </span><span>
71+</span><a name="line-71"></a><span> </span><span class="hs-comment">-- it is not feasible to write a data type with hundreds of constructors</span><span>
72+</span><a name="line-72"></a><span> </span><span class="hs-comment">-- and then write manipulation functions that need to deal with them.</span><span>
73+</span><a name="line-73"></a><span> </span><span class="hs-comment">-- To mitigate this limitation the 'Natural' type comes a long way and</span><span>
74+</span><a name="line-74"></a><span> </span><span class="hs-comment">-- allows one to model the sample in an easier way. See for instance:</span><span>
75+</span><a name="line-75"></a><span> </span><span class="hs-comment">--</span><span>
76+</span><a name="line-76"></a><span> </span><span class="hs-comment">-- @</span><span>
77+</span><a name="line-77"></a><span> </span><span class="hs-comment">-- ssAdd :: Natural 1 6 -&gt; Natural 1 6 -&gt; Natural 1 12</span><span>
78+</span><a name="line-78"></a><span> </span><span class="hs-comment">-- ssAdd = coerceNat (+) </span><span>
79+</span><a name="line-79"></a><span> </span><span class="hs-comment">-- </span><span>
80+</span><a name="line-80"></a><span> </span><span class="hs-comment">-- ssAddM = fromF' (uncurry sumSS)</span><span>
81+</span><a name="line-81"></a><span> </span><span class="hs-comment">-- </span><span>
82+</span><a name="line-82"></a><span> </span><span class="hs-comment">-- die :: Dist (Natural 1 6) 6</span><span>
83+</span><a name="line-83"></a><span> </span><span class="hs-comment">-- die = uniform [nat @1 @6 1 .. nat 6]</span><span>
84+</span><a name="line-84"></a><span> </span><span class="hs-comment">--</span><span>
85+</span><a name="line-85"></a><span> </span><span class="hs-comment">-- dieSumProb = ssAddM `comp` (khatri die die)</span><span>
86+</span><a name="line-86"></a><span> </span><span class="hs-comment">-- @</span><span>
87+</span><a name="line-87"></a><span> </span><span class="hs-comment">--</span><span>
88+</span><a name="line-88"></a><span> </span><span class="hs-comment">-- * 'Natural' data type</span><span>
89+</span><a name="line-89"></a><span> </span><a href="Utils.Internal.html#Natural"><span class="hs-identifier hs-type">Natural</span></a><span class="hs-special">,</span><span>
90+</span><a name="line-90"></a><span> </span><a href="Utils.Internal.html#nat"><span class="hs-identifier hs-var">nat</span></a><span class="hs-special">,</span><span>
91+</span><a name="line-91"></a><span>
92+</span><a name="line-92"></a><span> </span><span class="hs-comment">-- * Coerce auxiliar functions to help promote 'Int' typed functions to</span><span>
93+</span><a name="line-93"></a><span> </span><span class="hs-comment">-- 'Natural' typed functions.</span><span>
94+</span><a name="line-94"></a><span> </span><a href="Utils.Internal.html#coerceNat"><span class="hs-identifier hs-var">coerceNat</span></a><span class="hs-special">,</span><span>
95+</span><a name="line-95"></a><span> </span><a href="Utils.Internal.html#coerceNat2"><span class="hs-identifier hs-var">coerceNat2</span></a><span class="hs-special">,</span><span>
96+</span><a name="line-96"></a><span> </span><a href="Utils.Internal.html#coerceNat3"><span class="hs-identifier hs-var">coerceNat3</span></a><span class="hs-special">,</span><span>
97+</span><a name="line-97"></a><span> </span><span class="hs-special">)</span><span>
98+</span><a name="line-98"></a><span class="hs-keyword">where</span><span>
99+</span><a name="line-99"></a><span>
100+</span><a name="line-100"></a><span class="hs-keyword">import</span><span> </span><a href="Utils.Internal.html"><span class="hs-identifier">Utils.Internal</span></a><span>
101+</span><a name="line-101"></a></pre></body></html>
build/x86_64-linux/ghc-8.6.5/laop-0.1.0.0/doc/html/laop-0.1.0.0-docs/src/highlight.jsnew file+27
@@ -0,0 +1,27 @@
1+
2+var highlight = function (on) {
3+ return function () {
4+ var links = document.getElementsByTagName('a');
5+ for (var i = 0; i < links.length; i++) {
6+ var that = links[i];
7+
8+ if (this.href != that.href) {
9+ continue;
10+ }
11+
12+ if (on) {
13+ that.classList.add("hover-highlight");
14+ } else {
15+ that.classList.remove("hover-highlight");
16+ }
17+ }
18+ }
19+};
20+
21+window.onload = function () {
22+ var links = document.getElementsByTagName('a');
23+ for (var i = 0; i < links.length; i++) {
24+ links[i].onmouseover = highlight(true);
25+ links[i].onmouseout = highlight(false);
26+ }
27+};
build/x86_64-linux/ghc-8.6.5/laop-0.1.0.0/doc/html/laop-0.1.0.0-docs/src/style.cssnew file+55
@@ -0,0 +1,55 @@
1+body {
2+ background-color: #fdf6e3;
3+}
4+
5+.hs-identifier {
6+ color: #073642;
7+}
8+
9+.hs-identifier.hs-var {
10+}
11+
12+.hs-identifier.hs-type {
13+ color: #5f5faf;
14+}
15+
16+.hs-keyword {
17+ color: #af005f;
18+}
19+
20+.hs-string, .hs-char {
21+ color: #cb4b16;
22+}
23+
24+.hs-number {
25+ color: #268bd2;
26+}
27+
28+.hs-operator {
29+ color: #d33682;
30+}
31+
32+.hs-glyph, .hs-special {
33+ color: #dc322f;
34+}
35+
36+.hs-comment {
37+ color: #8a8a8a;
38+}
39+
40+.hs-pragma {
41+ color: #2aa198;
42+}
43+
44+.hs-cpp {
45+ color: #859900;
46+}
47+
48+a:link, a:visited {
49+ text-decoration: none;
50+ border-bottom: 1px solid #eee8d5;
51+}
52+
53+a:hover, a.hover-highlight {
54+ background-color: #eee8d5;
55+}
build/x86_64-linux/ghc-8.6.5/laop-0.1.0.0/doc/html/laop-0.1.0.0-docs/synopsis.pngnew file

Binary file not shown.

build/x86_64-linux/ghc-8.6.5/laop-0.1.0.0/package.conf.inplace/package.cachenew file

Binary file not shown.

build/x86_64-linux/ghc-8.6.5/laop-0.1.0.0/package.conf.inplace/package.cache.locknew file

No changes to the content.

build/x86_64-linux/ghc-8.6.5/laop-0.1.0.0/setup-confignew file

Binary file not shown.

cache/compilernew file

Binary file not shown.

cache/confignew file

Binary file not shown.

cache/elaborated-plannew file

Binary file not shown.

cache/improved-plannew file

Binary file not shown.

cache/plan.jsonnew file+1
@@ -0,0 +1 @@
1+{"cabal-version":"2.4.1.0","cabal-lib-version":"2.4.1.0","compiler-id":"ghc-8.6.5","os":"linux","arch":"x86_64","install-plan":[{"type":"pre-existing","id":"array-0.5.3.0","pkg-name":"array","pkg-version":"0.5.3.0","depends":["base-4.12.0.0"]},{"type":"pre-existing","id":"base-4.12.0.0","pkg-name":"base","pkg-version":"4.12.0.0","depends":["ghc-prim-0.5.3","integer-gmp-1.0.2.0","rts"]},{"type":"pre-existing","id":"deepseq-1.4.4.0","pkg-name":"deepseq","pkg-version":"1.4.4.0","depends":["array-0.5.3.0","base-4.12.0.0"]},{"type":"pre-existing","id":"ghc-prim-0.5.3","pkg-name":"ghc-prim","pkg-version":"0.5.3","depends":["rts"]},{"type":"pre-existing","id":"integer-gmp-1.0.2.0","pkg-name":"integer-gmp","pkg-version":"1.0.2.0","depends":["ghc-prim-0.5.3"]},{"type":"configured","id":"laop-0.1.0.0-inplace","pkg-name":"laop","pkg-version":"0.1.0.0","flags":{},"style":"local","pkg-src":{"type":"local","path":"/home/bolt/Desktop/Bolt/Playground/Haskell/laop/."},"dist-dir":"/home/bolt/Desktop/Bolt/Playground/Haskell/laop/build/x86_64-linux/ghc-8.6.5/laop-0.1.0.0","depends":["base-4.12.0.0","deepseq-1.4.4.0"],"exe-depends":[],"component-name":"lib"},{"type":"configured","id":"laop-0.1.0.0-inplace-laop-exe","pkg-name":"laop","pkg-version":"0.1.0.0","flags":{},"style":"local","pkg-src":{"type":"local","path":"/home/bolt/Desktop/Bolt/Playground/Haskell/laop/."},"dist-dir":"/home/bolt/Desktop/Bolt/Playground/Haskell/laop/build/x86_64-linux/ghc-8.6.5/laop-0.1.0.0/x/laop-exe","depends":["base-4.12.0.0","deepseq-1.4.4.0","laop-0.1.0.0-inplace"],"exe-depends":[],"component-name":"exe:laop-exe","bin-file":"/home/bolt/Desktop/Bolt/Playground/Haskell/laop/build/x86_64-linux/ghc-8.6.5/laop-0.1.0.0/x/laop-exe/build/laop-exe/laop-exe"},{"type":"configured","id":"laop-0.1.0.0-inplace-laop-test","pkg-name":"laop","pkg-version":"0.1.0.0","flags":{},"style":"local","pkg-src":{"type":"local","path":"/home/bolt/Desktop/Bolt/Playground/Haskell/laop/."},"dist-dir":"/home/bolt/Desktop/Bolt/Playground/Haskell/laop/build/x86_64-linux/ghc-8.6.5/laop-0.1.0.0/t/laop-test","depends":["base-4.12.0.0","laop-0.1.0.0-inplace"],"exe-depends":[],"component-name":"test:laop-test","bin-file":"/home/bolt/Desktop/Bolt/Playground/Haskell/laop/build/x86_64-linux/ghc-8.6.5/laop-0.1.0.0/t/laop-test/build/laop-test/laop-test"},{"type":"pre-existing","id":"rts","pkg-name":"rts","pkg-version":"1.0","depends":[]}]}
cache/solver-plannew file

Binary file not shown.

cache/source-hashesnew file

Binary file not shown.

cache/up-to-datenew file

Binary file not shown.

dist-newstyle/build/x86_64-linux/ghc-8.6.5/fake-package-0/x/script/build/script/autogen/Paths_fake_package.hsnew file+50
@@ -0,0 +1,50 @@
1+{-# LANGUAGE CPP #-}
2+{-# LANGUAGE NoRebindableSyntax #-}
3+{-# OPTIONS_GHC -fno-warn-missing-import-lists #-}
4+module Paths_fake_package (
5+ version,
6+ getBinDir, getLibDir, getDynLibDir, getDataDir, getLibexecDir,
7+ getDataFileName, getSysconfDir
8+ ) where
9+
10+import qualified Control.Exception as Exception
11+import Data.Version (Version(..))
12+import System.Environment (getEnv)
13+import Prelude
14+
15+#if defined(VERSION_base)
16+
17+#if MIN_VERSION_base(4,0,0)
18+catchIO :: IO a -> (Exception.IOException -> IO a) -> IO a
19+#else
20+catchIO :: IO a -> (Exception.Exception -> IO a) -> IO a
21+#endif
22+
23+#else
24+catchIO :: IO a -> (Exception.IOException -> IO a) -> IO a
25+#endif
26+catchIO = Exception.catch
27+
28+version :: Version
29+version = Version [0] []
30+bindir, libdir, dynlibdir, datadir, libexecdir, sysconfdir :: FilePath
31+
32+bindir = "/home/bolt/.cabal/bin"
33+libdir = "/home/bolt/.cabal/lib/x86_64-linux-ghc-8.6.5/fake-package-0-inplace-script"
34+dynlibdir = "/home/bolt/.cabal/lib/x86_64-linux-ghc-8.6.5"
35+datadir = "/home/bolt/.cabal/share/x86_64-linux-ghc-8.6.5/fake-package-0"
36+libexecdir = "/home/bolt/.cabal/libexec/x86_64-linux-ghc-8.6.5/fake-package-0"
37+sysconfdir = "/home/bolt/.cabal/etc"
38+
39+getBinDir, getLibDir, getDynLibDir, getDataDir, getLibexecDir, getSysconfDir :: IO FilePath
40+getBinDir = catchIO (getEnv "fake_package_bindir") (\_ -> return bindir)
41+getLibDir = catchIO (getEnv "fake_package_libdir") (\_ -> return libdir)
42+getDynLibDir = catchIO (getEnv "fake_package_dynlibdir") (\_ -> return dynlibdir)
43+getDataDir = catchIO (getEnv "fake_package_datadir") (\_ -> return datadir)
44+getLibexecDir = catchIO (getEnv "fake_package_libexecdir") (\_ -> return libexecdir)
45+getSysconfDir = catchIO (getEnv "fake_package_sysconfdir") (\_ -> return sysconfdir)
46+
47+getDataFileName :: FilePath -> IO FilePath
48+getDataFileName name = do
49+ dir <- getDataDir
50+ return (dir ++ "/" ++ name)
dist-newstyle/build/x86_64-linux/ghc-8.6.5/fake-package-0/x/script/build/script/autogen/cabal_macros.hnew file+118
@@ -0,0 +1,118 @@
1+/* DO NOT EDIT: This file is automatically generated by Cabal */
2+
3+/* package fake-package-0 */
4+#ifndef VERSION_fake_package
5+#define VERSION_fake_package "0"
6+#endif /* VERSION_fake_package */
7+#ifndef MIN_VERSION_fake_package
8+#define MIN_VERSION_fake_package(major1,major2,minor) (\
9+ (major1) < 0 || \
10+ (major1) == 0 && (major2) < 0 || \
11+ (major1) == 0 && (major2) == 0 && (minor) <= 0)
12+#endif /* MIN_VERSION_fake_package */
13+
14+/* tool gcc-9.2.0 */
15+#ifndef TOOL_VERSION_gcc
16+#define TOOL_VERSION_gcc "9.2.0"
17+#endif /* TOOL_VERSION_gcc */
18+#ifndef MIN_TOOL_VERSION_gcc
19+#define MIN_TOOL_VERSION_gcc(major1,major2,minor) (\
20+ (major1) < 9 || \
21+ (major1) == 9 && (major2) < 2 || \
22+ (major1) == 9 && (major2) == 2 && (minor) <= 0)
23+#endif /* MIN_TOOL_VERSION_gcc */
24+
25+/* tool ghc-8.6.5 */
26+#ifndef TOOL_VERSION_ghc
27+#define TOOL_VERSION_ghc "8.6.5"
28+#endif /* TOOL_VERSION_ghc */
29+#ifndef MIN_TOOL_VERSION_ghc
30+#define MIN_TOOL_VERSION_ghc(major1,major2,minor) (\
31+ (major1) < 8 || \
32+ (major1) == 8 && (major2) < 6 || \
33+ (major1) == 8 && (major2) == 6 && (minor) <= 5)
34+#endif /* MIN_TOOL_VERSION_ghc */
35+
36+/* tool ghc-pkg-8.6.5 */
37+#ifndef TOOL_VERSION_ghc_pkg
38+#define TOOL_VERSION_ghc_pkg "8.6.5"
39+#endif /* TOOL_VERSION_ghc_pkg */
40+#ifndef MIN_TOOL_VERSION_ghc_pkg
41+#define MIN_TOOL_VERSION_ghc_pkg(major1,major2,minor) (\
42+ (major1) < 8 || \
43+ (major1) == 8 && (major2) < 6 || \
44+ (major1) == 8 && (major2) == 6 && (minor) <= 5)
45+#endif /* MIN_TOOL_VERSION_ghc_pkg */
46+
47+/* tool haddock-2.22.0 */
48+#ifndef TOOL_VERSION_haddock
49+#define TOOL_VERSION_haddock "2.22.0"
50+#endif /* TOOL_VERSION_haddock */
51+#ifndef MIN_TOOL_VERSION_haddock
52+#define MIN_TOOL_VERSION_haddock(major1,major2,minor) (\
53+ (major1) < 2 || \
54+ (major1) == 2 && (major2) < 22 || \
55+ (major1) == 2 && (major2) == 22 && (minor) <= 0)
56+#endif /* MIN_TOOL_VERSION_haddock */
57+
58+/* tool hpc-0.67 */
59+#ifndef TOOL_VERSION_hpc
60+#define TOOL_VERSION_hpc "0.67"
61+#endif /* TOOL_VERSION_hpc */
62+#ifndef MIN_TOOL_VERSION_hpc
63+#define MIN_TOOL_VERSION_hpc(major1,major2,minor) (\
64+ (major1) < 0 || \
65+ (major1) == 0 && (major2) < 67 || \
66+ (major1) == 0 && (major2) == 67 && (minor) <= 0)
67+#endif /* MIN_TOOL_VERSION_hpc */
68+
69+/* tool hsc2hs-0.68.5 */
70+#ifndef TOOL_VERSION_hsc2hs
71+#define TOOL_VERSION_hsc2hs "0.68.5"
72+#endif /* TOOL_VERSION_hsc2hs */
73+#ifndef MIN_TOOL_VERSION_hsc2hs
74+#define MIN_TOOL_VERSION_hsc2hs(major1,major2,minor) (\
75+ (major1) < 0 || \
76+ (major1) == 0 && (major2) < 68 || \
77+ (major1) == 0 && (major2) == 68 && (minor) <= 5)
78+#endif /* MIN_TOOL_VERSION_hsc2hs */
79+
80+/* tool pkg-config-1.6.3 */
81+#ifndef TOOL_VERSION_pkg_config
82+#define TOOL_VERSION_pkg_config "1.6.3"
83+#endif /* TOOL_VERSION_pkg_config */
84+#ifndef MIN_TOOL_VERSION_pkg_config
85+#define MIN_TOOL_VERSION_pkg_config(major1,major2,minor) (\
86+ (major1) < 1 || \
87+ (major1) == 1 && (major2) < 6 || \
88+ (major1) == 1 && (major2) == 6 && (minor) <= 3)
89+#endif /* MIN_TOOL_VERSION_pkg_config */
90+
91+/* tool runghc-8.6.5 */
92+#ifndef TOOL_VERSION_runghc
93+#define TOOL_VERSION_runghc "8.6.5"
94+#endif /* TOOL_VERSION_runghc */
95+#ifndef MIN_TOOL_VERSION_runghc
96+#define MIN_TOOL_VERSION_runghc(major1,major2,minor) (\
97+ (major1) < 8 || \
98+ (major1) == 8 && (major2) < 6 || \
99+ (major1) == 8 && (major2) == 6 && (minor) <= 5)
100+#endif /* MIN_TOOL_VERSION_runghc */
101+
102+/* tool strip-2.33 */
103+#ifndef TOOL_VERSION_strip
104+#define TOOL_VERSION_strip "2.33"
105+#endif /* TOOL_VERSION_strip */
106+#ifndef MIN_TOOL_VERSION_strip
107+#define MIN_TOOL_VERSION_strip(major1,major2,minor) (\
108+ (major1) < 2 || \
109+ (major1) == 2 && (major2) < 33 || \
110+ (major1) == 2 && (major2) == 33 && (minor) <= 0)
111+#endif /* MIN_TOOL_VERSION_strip */
112+
113+#ifndef CURRENT_COMPONENT_ID
114+#define CURRENT_COMPONENT_ID "fake-package-0-inplace-script"
115+#endif /* CURRENT_COMPONENT_ID */
116+#ifndef CURRENT_PACKAGE_VERSION
117+#define CURRENT_PACKAGE_VERSION "0"
118+#endif /* CURRENT_PACKAGE_VERSION */
dist-newstyle/build/x86_64-linux/ghc-8.6.5/fake-package-0/x/script/cache/confignew file

Binary file not shown.

dist-newstyle/build/x86_64-linux/ghc-8.6.5/fake-package-0/x/script/package.conf.inplace/package.cachenew file

Binary file not shown.

dist-newstyle/build/x86_64-linux/ghc-8.6.5/fake-package-0/x/script/package.conf.inplace/package.cache.locknew file

No changes to the content.

dist-newstyle/build/x86_64-linux/ghc-8.6.5/fake-package-0/x/script/setup-confignew file

Binary file not shown.

dist-newstyle/cache/compilernew file

Binary file not shown.

dist-newstyle/cache/confignew file

Binary file not shown.

dist-newstyle/cache/elaborated-plannew file

Binary file not shown.

dist-newstyle/cache/improved-plannew file

Binary file not shown.

dist-newstyle/cache/plan.jsonnew file+1
@@ -0,0 +1 @@
1+{"cabal-version":"2.4.1.0","cabal-lib-version":"2.4.1.0","compiler-id":"ghc-8.6.5","os":"linux","arch":"x86_64","install-plan":[{"type":"pre-existing","id":"array-0.5.3.0","pkg-name":"array","pkg-version":"0.5.3.0","depends":["base-4.12.0.0"]},{"type":"pre-existing","id":"base-4.12.0.0","pkg-name":"base","pkg-version":"4.12.0.0","depends":["ghc-prim-0.5.3","integer-gmp-1.0.2.0","rts"]},{"type":"pre-existing","id":"deepseq-1.4.4.0","pkg-name":"deepseq","pkg-version":"1.4.4.0","depends":["array-0.5.3.0","base-4.12.0.0"]},{"type":"configured","id":"fake-package-0-inplace-script","pkg-name":"fake-package","pkg-version":"0","flags":{},"style":"local","pkg-src":{"type":"local","path":"/tmp/cabal-repl.-15730"},"dist-dir":"/home/bolt/Desktop/Bolt/Playground/Haskell/laop/dist-newstyle/build/x86_64-linux/ghc-8.6.5/fake-package-0/x/script","depends":[],"exe-depends":[],"component-name":"exe:script","bin-file":"/home/bolt/Desktop/Bolt/Playground/Haskell/laop/dist-newstyle/build/x86_64-linux/ghc-8.6.5/fake-package-0/x/script/build/script/script"},{"type":"pre-existing","id":"ghc-prim-0.5.3","pkg-name":"ghc-prim","pkg-version":"0.5.3","depends":["rts"]},{"type":"pre-existing","id":"integer-gmp-1.0.2.0","pkg-name":"integer-gmp","pkg-version":"1.0.2.0","depends":["ghc-prim-0.5.3"]},{"type":"configured","id":"laop-0.1.0.0-inplace","pkg-name":"laop","pkg-version":"0.1.0.0","flags":{},"style":"local","pkg-src":{"type":"local","path":"/home/bolt/Desktop/Bolt/Playground/Haskell/laop/."},"dist-dir":"/home/bolt/Desktop/Bolt/Playground/Haskell/laop/dist-newstyle/build/x86_64-linux/ghc-8.6.5/laop-0.1.0.0","depends":["base-4.12.0.0","deepseq-1.4.4.0"],"exe-depends":[],"component-name":"lib"},{"type":"configured","id":"laop-0.1.0.0-inplace-laop-exe","pkg-name":"laop","pkg-version":"0.1.0.0","flags":{},"style":"local","pkg-src":{"type":"local","path":"/home/bolt/Desktop/Bolt/Playground/Haskell/laop/."},"dist-dir":"/home/bolt/Desktop/Bolt/Playground/Haskell/laop/dist-newstyle/build/x86_64-linux/ghc-8.6.5/laop-0.1.0.0/x/laop-exe","depends":["base-4.12.0.0","deepseq-1.4.4.0","laop-0.1.0.0-inplace"],"exe-depends":[],"component-name":"exe:laop-exe","bin-file":"/home/bolt/Desktop/Bolt/Playground/Haskell/laop/dist-newstyle/build/x86_64-linux/ghc-8.6.5/laop-0.1.0.0/x/laop-exe/build/laop-exe/laop-exe"},{"type":"configured","id":"laop-0.1.0.0-inplace-laop-test","pkg-name":"laop","pkg-version":"0.1.0.0","flags":{},"style":"local","pkg-src":{"type":"local","path":"/home/bolt/Desktop/Bolt/Playground/Haskell/laop/."},"dist-dir":"/home/bolt/Desktop/Bolt/Playground/Haskell/laop/dist-newstyle/build/x86_64-linux/ghc-8.6.5/laop-0.1.0.0/t/laop-test","depends":["base-4.12.0.0","laop-0.1.0.0-inplace"],"exe-depends":[],"component-name":"test:laop-test","bin-file":"/home/bolt/Desktop/Bolt/Playground/Haskell/laop/dist-newstyle/build/x86_64-linux/ghc-8.6.5/laop-0.1.0.0/t/laop-test/build/laop-test/laop-test"},{"type":"pre-existing","id":"rts","pkg-name":"rts","pkg-version":"1.0","depends":[]}]}
dist-newstyle/cache/solver-plannew file

Binary file not shown.

dist-newstyle/cache/source-hashesnew file

Binary file not shown.

dist-newstyle/cache/up-to-datenew file

Binary file not shown.

dist-newstyle/packagedb/ghc-8.6.5/package.cachenew file

Binary file not shown.

dist-newstyle/packagedb/ghc-8.6.5/package.cache.locknew file

No changes to the content.

dist/cabal-config-flagsnew file

Binary file not shown.

dist/laop-0.1.0.0.tar.gznew file

Binary file not shown.

dist/setup-confignew file

Binary file not shown.

hackage.shnew file+10
@@ -0,0 +1,10 @@
1+#!/bin/sh
2+set -e
3+
4+dir=$(mktemp -d dist-docs.XXXXXX)
5+trap 'rm -r "$dir"' EXIT
6+
7+# assumes cabal 2.4 or later
8+cabal v2-haddock --builddir="$dir" --haddock-for-hackage --enable-doc
9+
10+cabal upload -d $dir/*-docs.tar.gz
laop-0.1.0.0-docs.tar.gznew file

Binary file not shown.

laop.cabaldeleted−89
@@ -1,89 +0,0 @@
1−cabal-version: 2.4
2−name: laop
3−version: 0.1.1.1
4−synopsis: Matrix programming library
5−description: Matrix programming library that uses a type-safe inductive definition
6− inspired by the Linear Algebra of Programming
7−homepage: https://github.com/bolt12/laop
8−bug-reports: https://github.com/bolt12/laop/issues
9−license: MIT
10−license-file: LICENSE
11−author: Armando Santos
12−maintainer: Armando Santos <armandoifsantos@gmail.com>
13−copyright: 2020 Armando Santos
14−category: Data
15−build-type: Simple
16−extra-doc-files: README.md
17− CHANGELOG.md
18−tested-with: GHC == 8.6.5
19− GHC == 8.8.3
20−
21−source-repository head
22− type: git
23− location: https://github.com/bolt12/laop.git
24−
25−common common-options
26− build-depends: base >= 4.12.0.0 && < 5,
27− deepseq
28−
29− ghc-options: -Wall
30− -Wcompat
31− -Widentities
32− -Wincomplete-uni-patterns
33− -Wincomplete-record-updates
34− if impl(ghc >= 8.0)
35− ghc-options: -Wredundant-constraints
36− if impl(ghc >= 8.2)
37− ghc-options: -fhide-source-paths
38− if impl(ghc >= 8.4)
39− ghc-options: -Wmissing-export-lists
40− -Wpartial-fields
41− if impl(ghc >= 8.8)
42− ghc-options: -Wmissing-deriving-strategies
43−
44− default-language: Haskell2010
45−
46−library
47− import: common-options
48− hs-source-dirs: src
49− exposed-modules: LAoP.Dist
50− LAoP.Dist.Internal
51− LAoP.Matrix.Internal
52− LAoP.Matrix.Nat
53− LAoP.Matrix.Type
54− LAoP.Relation
55− LAoP.Relation.Internal
56− LAoP.Utils
57− LAoP.Utils.Internal
58−
59−test-suite laop-test
60− import: common-options
61− type: exitcode-stdio-1.0
62− hs-source-dirs: test
63− other-modules: Examples.Readme
64− main-is: Spec.hs
65− build-depends: laop
66− ghc-options: -threaded
67− -rtsopts
68− -with-rtsopts=-N
69− -funfolding-use-threshold=16
70− -fexcess-precision
71− -optc-O3
72− -optc-ffast-math
73−
74−benchmark laop-benchmark
75− import: common-options
76− type: exitcode-stdio-1.0
77− hs-source-dirs: benchmark
78− main-is: Main.hs
79− build-depends: criterion
80− , QuickCheck
81− , deepseq
82− , laop
83− ghc-options: -threaded
84− -rtsopts
85− -with-rtsopts=-N
86− -funfolding-use-threshold=16
87− -fexcess-precision
88− -optc-O3
89− -optc-ffast-math
package.yamlnew file+48
@@ -0,0 +1,48 @@
1+name: laop
2+version: 0.1.0.0
3+github: "bolt12/laop"
4+license: BSD3
5+author: "Armando Santos"
6+maintainer: "armandoifsantos@gmail.com"
7+copyright: "MIT"
8+
9+extra-source-files:
10+- README.md
11+- ChangeLog.md
12+
13+# Metadata used when publishing your package
14+# synopsis: Short description of your package
15+# category: Web
16+
17+# To avoid duplicated efforts in documentation and dealing with the
18+# complications of embedding Haddock markup inside cabal files, it is
19+# common to point users to the README.md file.
20+description: Please see the README on GitHub at <https://github.com/bolt12/laop#readme>
21+
22+dependencies:
23+- base >= 4.7 && < 5
24+
25+library:
26+ source-dirs: src
27+
28+executables:
29+ laop-exe:
30+ main: Main.hs
31+ source-dirs: app
32+ ghc-options:
33+ - -threaded
34+ - -rtsopts
35+ - -with-rtsopts=-N
36+ dependencies:
37+ - laop
38+
39+tests:
40+ laop-test:
41+ main: Spec.hs
42+ source-dirs: test
43+ ghc-options:
44+ - -threaded
45+ - -rtsopts
46+ - -with-rtsopts=-N
47+ dependencies:
48+ - laop
packagedb/ghc-8.6.5/package.cachenew file

Binary file not shown.

packagedb/ghc-8.6.5/package.cache.locknew file

No changes to the content.

src/LAoP/Dist.hs−10
@@ -36,14 +36,6 @@ module LAoP.Dist
3636 Dist (..),
3737 Prob,
3838
39− -- * Constraint type synonyms
40− Countable,
41− CountableN,
42− CountableDimsN,
43− FLN,
44− Liftable,
45− TrivialP,
46−
4739 -- * Functor instance equivalent functions
4840 fmapD,
4941
@@ -53,8 +45,6 @@ module LAoP.Dist
5345
5446 -- * Selective equivalent functions
5547 selectD,
56− branchD,
57− ifD,
5848
5949 -- * Monad equivalent functions
6050 returnD,
src/LAoP/Dist/Internal.hs+36−87
@@ -1,5 +1,3 @@
1−{-# LANGUAGE DerivingVia #-}
2−{-# LANGUAGE ConstraintKinds #-}
31{-# LANGUAGE GADTs #-}
42{-# LANGUAGE AllowAmbiguousTypes #-}
53{-# LANGUAGE TypeApplications #-}
@@ -10,27 +8,18 @@
108{-# LANGUAGE RankNTypes #-}
119
1210module LAoP.Dist.Internal
13− (
11+ (
1412 Dist(..),
1513 Prob,
1614
17− Countable,
18− CountableN,
19− CountableDimsN,
20− FLN,
21− Liftable,
22− TrivialP,
23−
2415 fmapD,
2516 unitD,
2617 multD,
2718 selectD,
28− branchD,
29− ifD,
3019 returnD,
3120 bindD,
3221 (??),
33−
22+
3423 choose,
3524 shape,
3625 linear,
@@ -43,15 +32,11 @@ module LAoP.Dist.Internal
4332 )
4433 where
4534
46−import LAoP.Matrix.Type hiding (TrivialP, Countable, CountableDims, CountableN, CountableDimsN, Liftable, FLN)
47−import Prelude hiding (id, (.))
48−import qualified LAoP.Matrix.Internal as I
35+import LAoP.Matrix.Type
4936import LAoP.Utils
5037import GHC.TypeLits
5138import Data.Proxy
5239import Data.List (sortBy)
53−import Control.DeepSeq
54−import Data.Bool
5540
5641-- | Type synonym for probability value
5742type Prob = Double
@@ -59,21 +44,17 @@ type Prob = Double
5944-- | Type synonym for column vector matrices. This represents a probability
6045-- distribution.
6146newtype Dist a = D (Matrix Prob () a)
62− deriving (Show, Num, Eq, Ord, NFData) via (Matrix Prob () a)
63−
64−-- | Constraint type synonyms to keep the type signatures less convoluted
65−type Countable a = KnownNat (I.Count a)
66−type CountableN a = KnownNat (I.Count (I.Normalize a))
67−type CountableDimsN a b = (CountableN a, CountableN b)
68−type FLN a b = I.FL (I.Normalize a) (I.Normalize b)
69−type Liftable a b = (Bounded a, Bounded b, Enum a, Enum b, Eq b, Num Prob, Ord Prob)
70−type TrivialP a b = Normalize (a, b) ~ Normalize (Normalize a, Normalize b)
7147
7248-- | Functor instance
7349fmapD ::
74− ( Liftable a b,
75− CountableDimsN a b,
76− FLN b a
50+ ( Bounded a,
51+ Bounded b,
52+ Enum a,
53+ Enum b,
54+ Eq b,
55+ KnownNat (Count (Normalize a)),
56+ KnownNat (Count (Normalize b)),
57+ FromLists Prob (Normalize b) (Normalize a)
7758 )
7859 =>
7960 (a -> b) -> Dist a -> Dist b
@@ -85,58 +66,26 @@ unitD = D (one 1)
8566
8667-- | Applicative/Monoidal instance 'mult' function
8768multD ::
88− ( CountableDimsN a b,
89− CountableN (a, b),
90− FLN (a, b) a,
91− FLN (a, b) b,
92− TrivialP a b
69+ ( KnownNat (Count (Normalize a)),
70+ KnownNat (Count (Normalize b)),
71+ KnownNat (Count (Normalize (a, b))),
72+ FromLists Prob (Normalize (a, b)) (Normalize a),
73+ FromLists Prob (Normalize (a, b)) (Normalize b),
74+ Normalize (a, b) ~ Normalize (Normalize a, Normalize b)
9375 ) => Dist a -> Dist b -> Dist (a, b)
94−multD (D a) (D b) = D (kr a b)
76+multD (D a) (D b) = D (khatri a b)
9577
9678-- | Selective instance function
9779selectD ::
98− ( FLN b b,
99− CountableN b
80+ ( Normalize (Either a b) ~ Either (Normalize a) (Normalize b),
81+ FromLists Prob (Normalize b) (Normalize b),
82+ KnownNat (Count (Normalize b))
10083 ) => Dist (Either a b) -> Matrix Prob a b -> Dist b
101−selectD (D d) m = D (selectM d m)
102−
103−-- | Chooses which of the two given effectful
104−-- functions to apply to a given argument;
105−branchD ::
106− ( Num e,
107− CountableDimsN a b,
108− CountableDimsN c (Either b c),
109− FLN c b,
110− FLN a b,
111− FLN a a,
112− FLN b b,
113− FLN c c,
114− FLN b a,
115− FLN b c,
116− FLN (Either b c) b,
117− FLN (Either b c) c
118− )
119− => Dist (Either a b) -> Matrix Prob a c -> Matrix Prob b c -> Dist c
120−branchD x l r = f x `selectD` g l `selectD` r
121− where
122− f (D m) = D (fork (tr i1) (i1 `comp` tr i2) `comp` m)
123− g m = i2 `comp` m
124−
125−-- | Branch on a Boolean value, skipping unnecessary computations.
126−ifD ::
127− ( CountableDimsN a (Either () a),
128− FLN a a,
129− FLN a (),
130− FLN () a,
131− FLN (Either () a) a
132− )
133− => Dist Bool -> Dist a -> Dist a -> Dist a
134−ifD x (D t) (D e) = branchD x' t e
135− where
136− x' = bool (Right ()) (Left ()) `fmapD` x
84+selectD (D d) m = D (junc m identity `comp` d)
85+
13786
13887-- | Monad instance 'return' function
139−returnD :: forall a . (Enum a, FLN () a, Countable a) => a -> Dist a
88+returnD :: forall a . (Enum a, FromLists Prob () (Normalize a), KnownNat (Count a)) => a -> Dist a
14089returnD a = D (col l)
14190 where
14291 i = fromInteger $ natVal (Proxy :: Proxy (Count a))
@@ -150,8 +99,8 @@ bindD (D d) m = D (m `comp` d)
15099-- | Extract probabilities given an Event.
151100(??) ::
152101 ( Enum a,
153− Countable a,
154− FLN () a
102+ KnownNat (Count a),
103+ FromLists Prob () (Normalize a)
155104 ) => (a -> Bool) -> Dist a -> Prob
156105(??) p d =
157106 let l = toValues d
@@ -161,11 +110,11 @@ bindD (D d) m = D (m `comp` d)
161110-- Distribution Construction
162111
163112-- | Constructs a Bernoulli distribution
164−choose :: (FLN () a) => Prob -> Dist a
113+choose :: (FromLists Prob () (Normalize a)) => Prob -> Dist a
165114choose prob = D (col [prob, 1 - prob])
166115
167116-- | Creates a distribution given a shape function
168−shape :: (FLN () a) => (Prob -> Prob) -> [a] -> Dist a
117+shape :: (FromLists Prob () (Normalize a)) => (Prob -> Prob) -> [a] -> Dist a
169118shape _ [] = error "Probability.shape: empty list"
170119shape f xs =
171120 let incr = 1 / fromIntegral (length xs - 1)
@@ -173,23 +122,23 @@ shape f xs =
173122 in fromFreqs (zip xs ps)
174123
175124-- | Constructs a Linear distribution
176−linear :: (FLN () a) => [a] -> Dist a
125+linear :: (FromLists Prob () (Normalize a)) => [a] -> Dist a
177126linear = shape id
178127
179128-- | Constructs an Uniform distribution
180−uniform :: (FLN () a) => [a] -> Dist a
129+uniform :: (FromLists Prob () (Normalize a)) => [a] -> Dist a
181130uniform = shape (const 1)
182131
183132-- | Constructs an Negative Exponential distribution
184−negExp :: (FLN () a) => [a] -> Dist a
133+negExp :: (FromLists Prob () (Normalize a)) => [a] -> Dist a
185134negExp = shape (\x -> exp (-x))
186135
187136-- | Constructs an Normal distribution
188−normal :: (FLN () a) => [a] -> Dist a
137+normal :: (FromLists Prob () (Normalize a)) => [a] -> Dist a
189138normal = shape (normalCurve 0.5 0.5)
190139
191140-- | Transforms a 'Dist' into a list of pairs.
192−toValues :: forall a . (Enum a, Countable a, FLN () a) => Dist a -> [(a, Prob)]
141+toValues :: forall a . (Enum a, KnownNat (Count a), FromLists Prob () (Normalize a)) => Dist a -> [(a, Prob)]
193142toValues (D d) =
194143 let rows = fromInteger (natVal (Proxy :: Proxy (Count a)))
195144 probs = toList d
@@ -197,7 +146,7 @@ toValues (D d) =
197146 in res
198147
199148-- | Pretty a distribution
200−prettyDist :: forall a. (Show a, Enum a, Countable a, FLN () a) => Dist a -> String
149+prettyDist :: forall a. (Show a, Enum a, KnownNat (Count a), FromLists Prob () (Normalize a)) => Dist a -> String
201150prettyDist d =
202151 let values = sortBy (\(a, p1) (b, p2) -> compare p2 p1) (toValues @a d)
203152 w = maximum (map (length . show . fst) values)
@@ -209,12 +158,12 @@ prettyDist d =
209158 showR n x = show x ++ " "
210159
211160-- | Pretty Print a distribution
212−prettyPrintDist :: forall a . (Show a, Enum a, Countable a, FLN () a) => Dist a -> IO ()
161+prettyPrintDist :: forall a . (Show a, Enum a, KnownNat (Count a), FromLists Prob () (Normalize a)) => Dist a -> IO ()
213162prettyPrintDist = putStrLn . prettyDist @a
214163
215164-- Auxiliary functions
216165
217−fromFreqs :: (FLN () a) => [(a,Prob)] -> Dist a
166+fromFreqs :: (FromLists Prob () (Normalize a)) => [(a,Prob)] -> Dist a
218167fromFreqs xs = D (col (map (\(x,p) -> p/q) xs))
219168 where q = sum $ map snd xs
220169
src/LAoP/Matrix/Internal.hs+436−445
@@ -1,6 +1,4 @@
1−{-# LANGUAGE StrictData #-}
21{-# LANGUAGE TypeFamilyDependencies #-}
3−{-# LANGUAGE ConstraintKinds #-}
42{-# LANGUAGE AllowAmbiguousTypes #-}
53{-# LANGUAGE DataKinds #-}
64{-# LANGUAGE FlexibleContexts #-}
@@ -30,7 +28,7 @@
3028-- motivation behind the library, the underlying theory, and implementation details.
3129--
3230-- This module offers many of the combinators mentioned in the work of
33−-- Macedo (2012) and Oliveira (2012).
31+-- Macedo (2012) and Oliveira (2012).
3432--
3533-- This is an Internal module and it is no supposed to be imported.
3634--
@@ -43,26 +41,17 @@ module LAoP.Matrix.Internal
4341 --
4442 -- There exists two type families that make it easier to write
4543 -- matrix dimensions: 'FromNat' and 'Count'. This approach
46− -- leads to a very straightforward implementation
47− -- of LAoP combinators.
44+ -- leads to a very straightforward implementation
45+ -- of LAoP combinators.
4846
4947 -- * Type safe matrix representation
5048 Matrix (..),
5149
52− -- * Constraint type aliases
53− Countable,
54− CountableDims,
55− CountableN,
56− CountableDimsN,
57− FL,
58− FLN,
59− Liftable,
60− Trivial,
61−
6250 -- * Primitives
51+ empty,
6352 one,
64− join,
65− fork,
53+ junc,
54+ split,
6655
6756 -- * Auxiliary type families
6857 FromNat,
@@ -75,7 +64,6 @@ module LAoP.Matrix.Internal
7564 toLists,
7665 toList,
7766 matrixBuilder,
78− matrixBuilder',
7967 row,
8068 col,
8169 zeros,
@@ -86,38 +74,28 @@ module LAoP.Matrix.Internal
8674 -- * Misc
8775 -- ** Get dimensions
8876 columns,
89− columns',
9077 rows,
91− rows',
9278
9379 -- ** Matrix Transposition
9480 tr,
9581
96− -- ** Scalar multiplication/division of matrices
97− (.|),
98− (./),
99−
10082 -- ** Selective operator
101− select,
102− branch,
83+ select,
10384
10485 -- ** McCarthy's Conditional
10586 cond,
10687
10788 -- ** Matrix "abiding"
108− abideJF,
109− abideFJ,
110−
111− -- ** Zip matrices
112− zipWithM,
89+ abideJS,
90+ abideSJ,
11391
11492 -- * Biproduct approach
115− -- ** Fork
93+ -- ** Split
11694 (===),
11795 -- *** Projections
11896 p1,
11997 p2,
120− -- ** Join
98+ -- ** Junc
12199 (|||),
122100 -- *** Injections
123101 i1,
@@ -130,13 +108,12 @@ module LAoP.Matrix.Internal
130108
131109 -- | Note that given the restrictions imposed it is not possible to
132110 -- implement the standard type classes present in standard Haskell.
133−
134111 -- *** Matrix pairing projections
135− fstM,
136− sndM,
112+ kp1,
113+ kp2,
137114
138115 -- *** Matrix pairing
139− kr,
116+ khatri,
140117
141118 -- * Matrix composition and lifting
142119
@@ -144,10 +121,10 @@ module LAoP.Matrix.Internal
144121
145122 -- | Note that given the restrictions imposed it is not possible to
146123 -- implement the standard type classes present in standard Haskell.
147− iden,
124+ identity,
148125 comp,
149− fromF',
150126 fromF,
127+ fromF',
151128
152129 -- * Matrix printing
153130 pretty,
@@ -174,22 +151,21 @@ import LAoP.Utils.Internal
174151import Data.Bool
175152import Data.Kind
176153import Data.List
177−import Data.Maybe
178154import Data.Proxy
179−import Data.Typeable
180155import Data.Void
181156import GHC.TypeLits
182157import Data.Type.Equality
183158import GHC.Generics
184159import Control.DeepSeq
185−import Prelude hiding (id, (.))
186−import qualified Prelude (id, (.))
160+import Control.Category
161+import Prelude hiding ((.))
187162
188163-- | LAoP (Linear Algebra of Programming) Inductive Matrix definition.
189164data Matrix e cols rows where
165+ Empty :: Matrix e Void Void
190166 One :: e -> Matrix e () ()
191− Join :: Matrix e a rows -> Matrix e b rows -> Matrix e (Either a b) rows
192− Fork :: Matrix e cols a -> Matrix e cols b -> Matrix e cols (Either a b)
167+ Junc :: Matrix e a rows -> Matrix e b rows -> Matrix e (Either a b) rows
168+ Split :: Matrix e cols a -> Matrix e cols b -> Matrix e cols (Either a b)
193169
194170deriving instance (Show e) => Show (Matrix e cols rows)
195171
@@ -199,214 +175,221 @@ deriving instance (Show e) => Show (Matrix e cols rows)
199175-- 'Generic' instance.
200176type family Count (d :: Type) :: Nat where
201177 Count (Natural n m) = (m - n) + 1
202− Count (List a) = (^) 2 (Count a)
203− Count (Either a b) = (+) (Count a) (Count b)
204− Count (a, b) = (*) (Count a) (Count b)
205− Count (a -> b) = (^) (Count b) (Count a)
178+ Count (Either a b) = (+) (Count a) (Count b)
179+ Count (a, b) = (*) (Count a) (Count b)
180+ Count (a -> b) = (^) (Count b) (Count a)
206181 -- Generics
207− Count (M1 _ _ f p) = Count (f p)
208− Count (K1 _ _ _) = 1
209− Count (V1 _) = 0
210− Count (U1 _) = 1
182+ Count (M1 _ _ f p) = Count (f p)
183+ Count (K1 _ _ _) = 1
184+ Count (V1 _) = 0
185+ Count (U1 _) = 1
211186 Count ((:*:) a b p) = Count (a p) * Count (b p)
212187 Count ((:+:) a b p) = Count (a p) + Count (b p)
213− Count d = Count (Rep d R)
188+ Count d = Count (Rep d R)
214189
215190-- | Type family that computes of a given type dimension from a given natural
216191--
217192-- Thanks to Li-Yao Xia this type family is super fast.
218193type family FromNat (n :: Nat) :: Type where
194+ FromNat 0 = Void
219195 FromNat 1 = ()
220196 FromNat n = FromNat' (Mod n 2 == 0) (FromNat (Div n 2))
221197
222198type family FromNat' (b :: Bool) (m :: Type) :: Type where
223− FromNat' 'True m = Either m m
199+ FromNat' 'True m = Either m m
224200 FromNat' 'False m = Either () (Either m m)
225201
226202-- | Type family that normalizes the representation of a given data
227203-- structure
228204type family Normalize (d :: Type) :: Type where
229− Normalize (Either a b) = Either (Normalize a) (Normalize b)
230− Normalize d = FromNat (Count d)
231−
232−-- | Constraint type synonyms to keep the type signatures less convoluted
233−type Countable a = KnownNat (Count a)
234−type CountableN a = KnownNat (Count (Normalize a))
235−type CountableDims a b = (Countable a, Countable b)
236−type CountableDimsN a b = (CountableN a, CountableN b)
237−type FL a b = FromLists a b
238−type FLN a b = FromLists (Normalize a) (Normalize b)
239−type Liftable e a b = (Bounded a, Bounded b, Enum a, Enum b, Eq b, Num e, Ord e)
240−type Trivial a = FromNat (Count a) ~ a
241−
242−-- | It is possible to implement a constrained version of the category type
243−-- class.
205+ Normalize d = FromNat (Count d)
206+
207+-- | It isn't possible to implement the 'id' function so it's
208+-- implementation is 'undefined'. However 'comp' can be and this partial
209+-- class implementation exists just to make the code more readable.
210+--
211+-- Please use 'identity' instead.
244212instance (Num e) => Category (Matrix e) where
245− type Object (Matrix e) a = (FL a a, Countable a)
246− id = iden
247− (.) = comp
213+ id = undefined
214+ (.) = comp
248215
249216instance NFData e => NFData (Matrix e cols rows) where
250− rnf (One e) = rnf e
251− rnf (Join a b) = rnf a `seq` rnf b
252− rnf (Fork a b) = rnf a `seq` rnf b
217+ rnf Empty = ()
218+ rnf (One e) = rnf e
219+ rnf (Junc a b) = rnf a `seq` rnf b
220+ rnf (Split a b) = rnf a `seq` rnf b
253221
254222instance Eq e => Eq (Matrix e cols rows) where
255− (One a) == (One b) = a == b
256− (Join a b) == (Join c d) = a == c && b == d
257− (Fork a b) == (Fork c d) = a == c && b == d
258− x@(Fork _ _) == y@(Join _ _) = x == abideJF y
259− x@(Join _ _) == y@(Fork _ _) = abideJF x == y
223+ Empty == Empty = True
224+ (One a) == (One b) = a == b
225+ (Junc a b) == (Junc c d) = a == c && b == d
226+ (Split a b) == (Split c d) = a == c && b == d
227+ x@(Split _ _) == y@(Junc _ _) = x == abideJS y
228+ x@(Junc _ _) == y@(Split _ _) = abideJS x == y
260229
261230instance Num e => Num (Matrix e cols rows) where
262− a + b = zipWithM (+) a b
263−
264− a - b = zipWithM (-) a b
265−
266− a * b = zipWithM (*) a b
267−
268− abs (One a) = One (abs a)
269− abs (Join a b) = Join (abs a) (abs b)
270− abs (Fork a b) = Fork (abs a) (abs b)
271231
272− signum (One a) = One (signum a)
273− signum (Join a b) = Join (signum a) (signum b)
274− signum (Fork a b) = Fork (signum a) (signum b)
232+ Empty + Empty = Empty
233+ (One a) + (One b) = One (a + b)
234+ (Junc a b) + (Junc c d) = Junc (a + c) (b + d)
235+ (Split a b) + (Split c d) = Split (a + c) (b + d)
236+ x@(Split _ _) + y@(Junc _ _) = x + abideJS y
237+ x@(Junc _ _) + y@(Split _ _) = abideJS x + y
238+
239+ Empty - Empty = Empty
240+ (One a) - (One b) = One (a - b)
241+ (Junc a b) - (Junc c d) = Junc (a - c) (b - d)
242+ (Split a b) - (Split c d) = Split (a - c) (b - d)
243+ x@(Split _ _) - y@(Junc _ _) = x - abideJS y
244+ x@(Junc _ _) - y@(Split _ _) = abideJS x - y
245+
246+ Empty * Empty = Empty
247+ (One a) * (One b) = One (a * b)
248+ (Junc a b) * (Junc c d) = Junc (a * c) (b * d)
249+ (Split a b) * (Split c d) = Split (a * c) (b * d)
250+ x@(Split _ _) * y@(Junc _ _) = x * abideJS y
251+ x@(Junc _ _) * y@(Split _ _) = abideJS x * y
252+
253+ abs Empty = Empty
254+ abs (One a) = One (abs a)
255+ abs (Junc a b) = Junc (abs a) (abs b)
256+ abs (Split a b) = Split (abs a) (abs b)
257+
258+ signum Empty = Empty
259+ signum (One a) = One (signum a)
260+ signum (Junc a b) = Junc (signum a) (signum b)
261+ signum (Split a b) = Split (signum a) (signum b)
275262
276263instance Ord e => Ord (Matrix e cols rows) where
277− (One a) <= (One b) = a <= b
278− (Join a b) <= (Join c d) = (a <= c) && (b <= d)
279− (Fork a b) <= (Fork c d) = (a <= c) && (b <= d)
280− x@(Fork _ _) <= y@(Join _ _) = x <= abideJF y
281− x@(Join _ _) <= y@(Fork _ _) = abideJF x <= y
264+ Empty <= Empty = True
265+ (One a) <= (One b) = a <= b
266+ (Junc a b) <= (Junc c d) = (a <= c) && (b <= d)
267+ (Split a b) <= (Split c d) = (a <= c) && (b <= d)
268+ x@(Split _ _) <= y@(Junc _ _) = x <= abideJS y
269+ x@(Junc _ _) <= y@(Split _ _) = abideJS x <= y
282270
283271-- Primitives
284272
273+-- | Empty matrix constructor
274+empty :: Matrix e Void Void
275+empty = Empty
276+
285277-- | Unit matrix constructor
286278one :: e -> Matrix e () ()
287279one = One
288280
289−-- | Matrix 'Join' constructor
290−join :: Matrix e a rows -> Matrix e b rows -> Matrix e (Either a b) rows
291−join = Join
281+-- | Matrix 'Junc' constructor
282+junc :: Matrix e a rows -> Matrix e b rows -> Matrix e (Either a b) rows
283+junc = Junc
292284
293285infixl 3 |||
294286
295−-- | Matrix 'Join' constructor
287+-- | Matrix 'Junc' constructor
296288(|||) :: Matrix e a rows -> Matrix e b rows -> Matrix e (Either a b) rows
297−(|||) = Join
289+(|||) = Junc
298290
299−-- | Matrix 'Fork' constructor
300−fork :: Matrix e cols a -> Matrix e cols b -> Matrix e cols (Either a b)
301−fork = Fork
291+-- | Matrix 'Split' constructor
292+split :: Matrix e cols a -> Matrix e cols b -> Matrix e cols (Either a b)
293+split = Split
302294
303295infixl 2 ===
304296
305−-- | Matrix 'Fork' constructor
297+-- | Matrix 'Split' constructor
306298(===) :: Matrix e cols a -> Matrix e cols b -> Matrix e cols (Either a b)
307−(===) = Fork
299+(===) = Split
308300
309301-- Construction
310302
311303-- | Type class for defining the 'fromList' conversion function.
312304--
313305-- Given that it is not possible to branch on types at the term level type
314−-- classes are needed very much like an inductive definition but on types.
315−class FromLists cols rows where
306+-- classes are needed bery much like an inductive definition but on types.
307+class FromLists e cols rows where
316308 -- | Build a matrix out of a list of list of elements. Throws a runtime
317309 -- error if the dimensions do not match.
318310 fromLists :: [[e]] -> Matrix e cols rows
319311
320−instance FromLists () () where
312+instance FromLists e Void Void where
313+ fromLists [] = Empty
314+ fromLists _ = error "Wrong dimensions"
315+
316+instance {-# OVERLAPPING #-} FromLists e () () where
321317 fromLists [[e]] = One e
322318 fromLists _ = error "Wrong dimensions"
323319
324−instance (FromLists cols ()) => FromLists (Either () cols) () where
325− fromLists [h : t] = Join (One h) (fromLists [t])
320+instance {-# OVERLAPPING #-} (FromLists e cols ()) => FromLists e (Either () cols) () where
321+ fromLists [h : t] = Junc (One h) (fromLists [t])
326322 fromLists _ = error "Wrong dimensions"
327323
328−instance {-# OVERLAPPABLE #-}
329− (FromLists a (), FromLists b (), Countable a) => FromLists (Either a b) () where
330− fromLists [l] =
324+instance {-# OVERLAPPABLE #-} (FromLists e a (), FromLists e b (), KnownNat (Count a)) => FromLists e (Either a b) () where
325+ fromLists [l] =
331326 let rowsA = fromInteger (natVal (Proxy :: Proxy (Count a)))
332− in Join (fromLists [take rowsA l]) (fromLists [drop rowsA l])
327+ in Junc (fromLists [take rowsA l]) (fromLists [drop rowsA l])
333328 fromLists _ = error "Wrong dimensions"
334329
335−instance (FromLists () rows) => FromLists () (Either () rows) where
336− fromLists ([h] : t) = Fork (One h) (fromLists t)
330+instance {-# OVERLAPPING #-} (FromLists e () rows) => FromLists e () (Either () rows) where
331+ fromLists ([h] : t) = Split (One h) (fromLists t)
337332 fromLists _ = error "Wrong dimensions"
338333
339−instance {-# OVERLAPPABLE #-}
340− (FromLists () a, FromLists () b, Countable a) => FromLists () (Either a b) where
341− fromLists l@([_] : _) =
334+instance {-# OVERLAPPABLE #-} (FromLists e () a, FromLists e () b, KnownNat (Count a)) => FromLists e () (Either a b) where
335+ fromLists l@([_] : _) =
342336 let rowsA = fromInteger (natVal (Proxy :: Proxy (Count a)))
343− in Fork (fromLists (take rowsA l)) (fromLists (drop rowsA l))
337+ in Split (fromLists (take rowsA l)) (fromLists (drop rowsA l))
344338 fromLists _ = error "Wrong dimensions"
345339
346−instance (FromLists (Either a b) c, FromLists (Either a b) d, Countable c)
347− => FromLists (Either a b) (Either c d) where
340+instance {-# OVERLAPPABLE #-} (FromLists e (Either a b) c, FromLists e (Either a b) d, KnownNat (Count c)) => FromLists e (Either a b) (Either c d) where
348341 fromLists l@(h : t) =
349342 let lh = length h
350343 rowsC = fromInteger (natVal (Proxy :: Proxy (Count c)))
351− condition = all ((== lh) . length) t
344+ condition = all (== lh) (map length t)
352345 in if lh > 0 && condition
353− then Fork (fromLists (take rowsC l)) (fromLists (drop rowsC l))
346+ then Split (fromLists (take rowsC l)) (fromLists (drop rowsC l))
354347 else error "Not all rows have the same length"
355348
356349-- | Matrix builder function. Constructs a matrix provided with
357−-- a construction function that operates with indices.
358−matrixBuilder' ::
350+-- a construction function.
351+matrixBuilder ::
359352 forall e cols rows.
360− ( FL cols rows,
361− CountableDims cols rows
362− ) => ((Int, Int) -> e) -> Matrix e cols rows
363−matrixBuilder' f =
353+ ( FromLists e cols rows,
354+ KnownNat (Count cols),
355+ KnownNat (Count rows)
356+ ) =>
357+ ((Int, Int) -> e) ->
358+ Matrix e cols rows
359+matrixBuilder f =
364360 let c = fromInteger $ natVal (Proxy :: Proxy (Count cols))
365361 r = fromInteger $ natVal (Proxy :: Proxy (Count rows))
366362 positions = [(a, b) | a <- [0 .. (r - 1)], b <- [0 .. (c - 1)]]
367363 in fromLists . map (map f) . groupBy (\(x, _) (w, _) -> x == w) $ positions
368364
369−-- | Matrix builder function. Constructs a matrix provided with
370−-- a construction function that operates with arbitrary types.
371−matrixBuilder ::
372− forall e a b.
373− ( FLN a b,
374− Enum a,
375− Enum b,
376− Bounded a,
377− Bounded b,
378− Eq a,
379− Countable b
380− ) => ((a, b) -> e) -> Matrix e (Normalize a) (Normalize b)
381−matrixBuilder f =
382− let r = fromInteger $ natVal (Proxy :: Proxy (Count b))
383− positions = [(a, b) | a <- [minBound .. maxBound], b <- [minBound .. maxBound]]
384− in fromLists . map (map f) . transpose . buildList r $ positions
385− where
386− buildList _ [] = []
387− buildList r l = take r l : buildList r (drop r l)
388−
389365-- | Constructs a column vector matrix
390−col :: (FL () rows) => [e] -> Matrix e () rows
366+col :: (FromLists e () rows) => [e] -> Matrix e () rows
391367col = fromLists . map (: [])
392368
393369-- | Constructs a row vector matrix
394−row :: (FL cols ()) => [e] -> Matrix e cols ()
370+row :: (FromLists e cols ()) => [e] -> Matrix e cols ()
395371row = fromLists . (: [])
396372
397373-- | Lifts functions to matrices with arbitrary dimensions.
398374--
399375-- NOTE: Be careful to not ask for a matrix bigger than the cardinality of
400376-- types @a@ or @b@ allows.
401−fromF' ::
377+fromF ::
402378 forall a b cols rows e.
403− ( Liftable e a b,
404− CountableDims cols rows,
405− FL rows cols
379+ ( Bounded a,
380+ Bounded b,
381+ Enum a,
382+ Enum b,
383+ Eq b,
384+ Num e,
385+ Ord e,
386+ KnownNat (Count cols),
387+ KnownNat (Count rows),
388+ FromLists e rows cols
406389 ) =>
407390 (a -> b) ->
408391 Matrix e cols rows
409−fromF' f =
392+fromF f =
410393 let minA = minBound @a
411394 maxA = maxBound @a
412395 minB = minBound @b
@@ -416,8 +399,8 @@ fromF' f =
416399 elementsA = take ccols [minA .. maxA]
417400 elementsB = take rrows [minB .. maxB]
418401 combinations = (,) <$> elementsA <*> elementsB
419− combAp = map snd . sort . map (\(a, b) -> if f a == b
420− then ((fromEnum a, fromEnum b), 1)
402+ combAp = map snd . sort . map (\(a, b) -> if f a == b
403+ then ((fromEnum a, fromEnum b), 1)
421404 else ((fromEnum a, fromEnum b), 0)) $ combinations
422405 mList = buildList combAp rrows
423406 in tr $ fromLists mList
@@ -427,23 +410,48 @@ fromF' f =
427410
428411-- | Lifts functions to matrices with dimensions matching @a@ and @b@
429412-- cardinality's.
430−fromF ::
413+fromF' ::
431414 forall a b e.
432− ( Liftable e a b,
433− CountableDimsN a b,
434− FLN b a
415+ ( Bounded a,
416+ Bounded b,
417+ Enum a,
418+ Enum b,
419+ Eq b,
420+ Num e,
421+ Ord e,
422+ KnownNat (Count (Normalize a)),
423+ KnownNat (Count (Normalize b)),
424+ FromLists e (Normalize b) (Normalize a)
435425 ) =>
436426 (a -> b) ->
437427 Matrix e (Normalize a) (Normalize b)
438−fromF = fromF'
428+fromF' f =
429+ let minA = minBound @a
430+ maxA = maxBound @a
431+ minB = minBound @b
432+ maxB = maxBound @b
433+ ccols = fromInteger $ natVal (Proxy :: Proxy (Count (Normalize a)))
434+ rrows = fromInteger $ natVal (Proxy :: Proxy (Count (Normalize b)))
435+ elementsA = take ccols [minA .. maxA]
436+ elementsB = take rrows [minB .. maxB]
437+ combinations = (,) <$> elementsA <*> elementsB
438+ combAp = map snd . sort . map (\(a, b) -> if f a == b
439+ then ((fromEnum a, fromEnum b), 1)
440+ else ((fromEnum a, fromEnum b), 0)) $ combinations
441+ mList = buildList combAp rrows
442+ in tr $ fromLists mList
443+ where
444+ buildList [] _ = []
445+ buildList l r = take r l : buildList (drop r l) r
439446
440447-- Conversion
441448
442449-- | Converts a matrix to a list of lists of elements.
443450toLists :: Matrix e cols rows -> [[e]]
451+toLists Empty = []
444452toLists (One e) = [[e]]
445−toLists (Fork l r) = toLists l ++ toLists r
446−toLists (Join l r) = zipWith (++) (toLists l) (toLists r)
453+toLists (Split l r) = toLists l ++ toLists r
454+toLists (Junc l r) = zipWith (++) (toLists l) (toLists r)
447455
448456-- | Converts a matrix to a list of elements.
449457toList :: Matrix e cols rows -> [e]
@@ -452,38 +460,37 @@ toList = concat . toLists
452460-- Zeros Matrix
453461
454462-- | The zero matrix. A matrix wholly filled with zeros.
455−zeros :: (Num e, FL cols rows, CountableDims cols rows) => Matrix e cols rows
456−zeros = matrixBuilder' (const 0)
463+zeros :: (Num e, FromLists e cols rows, KnownNat (Count cols), KnownNat (Count rows)) => Matrix e cols rows
464+zeros = matrixBuilder (const 0)
457465
458466-- Ones Matrix
459467
460468-- | The ones matrix. A matrix wholly filled with ones.
461469--
462470-- Also known as T (Top) matrix.
463−ones :: (Num e, FL cols rows, CountableDims cols rows) => Matrix e cols rows
464−ones = matrixBuilder' (const 1)
471+ones :: (Num e, FromLists e cols rows, KnownNat (Count cols), KnownNat (Count rows)) => Matrix e cols rows
472+ones = matrixBuilder (const 1)
465473
466474-- Const Matrix
467475
468476-- | The constant matrix constructor. A matrix wholly filled with a given
469477-- value.
470−constant :: (Num e, FL cols rows, CountableDims cols rows) => e -> Matrix e cols rows
471−constant e = matrixBuilder' (const e)
478+constant :: (Num e, FromLists e cols rows, KnownNat (Count cols), KnownNat (Count rows)) => e -> Matrix e cols rows
479+constant e = matrixBuilder (const e)
472480
473481-- Bang Matrix
474482
475483-- | The T (Top) row vector matrix.
476−bang :: forall e cols. (Num e, Enum e, FL cols (), Countable cols) => Matrix e cols ()
484+bang :: forall e cols. (Num e, Enum e, FromLists e cols (), KnownNat (Count cols)) => Matrix e cols ()
477485bang =
478486 let c = fromInteger $ natVal (Proxy :: Proxy (Count cols))
479487 in fromLists [take c [1, 1 ..]]
480488
481−-- iden Matrix
489+-- Identity Matrix
482490
483−-- | iden matrix.
484−iden :: forall e cols . (Num e, FL cols cols, Countable cols) => Matrix e cols cols
485−iden = matrixBuilder' (bool 0 1 . uncurry (==))
486−{-# NOINLINE iden #-}
491+-- | Identity matrix.
492+identity :: (Num e, FromLists e cols cols, KnownNat (Count cols)) => Matrix e cols cols
493+identity = matrixBuilder (bool 0 1 . uncurry (==))
487494
488495-- Matrix composition (MMM)
489496
@@ -492,90 +499,60 @@ iden = matrixBuilder' (bool 0 1 . uncurry (==))
492499-- This definition takes advantage of divide-and-conquer and fusion laws
493500-- from LAoP.
494501comp :: (Num e) => Matrix e cr rows -> Matrix e cols cr -> Matrix e cols rows
495−comp (One a) (One b) = One (a * b)
496−comp (Join a b) (Fork c d) = comp a c + comp b d -- Divide-and-conquer law
497−comp (Fork a b) c = Fork (comp a c) (comp b c) -- Fork fusion law
498−comp c (Join a b) = Join (comp c a) (comp c b) -- Join fusion law
499−{-# NOINLINE comp #-}
500−{-# RULES
501− "comp/iden1" forall m. comp m iden = m ;
502− "comp/iden2" forall m. comp iden m = m
503−#-}
504−
505−-- Scalar multiplication of matrices
506−
507−infixl 7 .|
508−-- | Scalar multiplication of matrices.
509−(.|) :: Num e => e -> Matrix e cols rows -> Matrix e cols rows
510−(.|) e (One a) = One (e * a)
511−(.|) e (Join a b) = Join (e .| a) (e .| b)
512−(.|) e (Fork a b) = Fork (e .| a) (e .| b)
513−
514−-- Scalar division of matrices
515−
516−infixl 7 ./
517−-- | Scalar multiplication of matrices.
518−(./) :: Fractional e => Matrix e cols rows -> e -> Matrix e cols rows
519−(./) (One a) e = One (a / e)
520−(./) (Join a b) e = Join (a ./ e) (b ./ e)
521−(./) (Fork a b) e = Fork (a ./ e) (b ./ e)
502+comp Empty Empty = Empty
503+comp (One a) (One b) = One (a * b)
504+comp (Junc a b) (Split c d) = comp a c + comp b d -- Divide-and-conquer law
505+comp (Split a b) c = Split (comp a c) (comp b c) -- Split fusion law
506+comp c (Junc a b) = Junc (comp c a) (comp c b) -- Junc fusion law
522507
523508-- Projections
524509
525510-- | Biproduct first component projection
526−p1 :: (Num e, CountableDims n m, FL n m, FL m m) => Matrix e (Either m n) m
527−p1 = join id zeros
511+p1 :: forall e m n. (Num e, KnownNat (Count n), KnownNat (Count m), FromLists e n m, FromLists e m m) => Matrix e (Either m n) m
512+p1 =
513+ let iden = identity :: Matrix e m m
514+ zero = zeros :: Matrix e n m
515+ in junc iden zero
528516
529517-- | Biproduct second component projection
530−p2 :: (Num e, CountableDims n m, FL m n, FL n n) => Matrix e (Either m n) n
531−p2 = join zeros id
518+p2 :: forall e m n. (Num e, KnownNat (Count n), KnownNat (Count m), FromLists e m n, FromLists e n n) => Matrix e (Either m n) n
519+p2 =
520+ let iden = identity :: Matrix e n n
521+ zero = zeros :: Matrix e m n
522+ in junc zero iden
532523
533524-- Injections
534525
535526-- | Biproduct first component injection
536−i1 :: (Num e, CountableDims n m, FL n m, FL m m) => Matrix e m (Either m n)
527+i1 :: (Num e, KnownNat (Count n), KnownNat (Count m), FromLists e n m, FromLists e m m) => Matrix e m (Either m n)
537528i1 = tr p1
538529
539530-- | Biproduct second component injection
540−i2 :: (Num e, CountableDims n m, FL m n, FL n n) => Matrix e n (Either m n)
531+i2 :: (Num e, KnownNat (Count n), KnownNat (Count m), FromLists e m n, FromLists e n n) => Matrix e n (Either m n)
541532i2 = tr p2
542533
543534-- Dimensions
544535
545536-- | Obtain the number of rows.
546537--
547−-- NOTE: The 'KnownNat' constraint is needed in order to obtain the
548−-- dimensions in constant time. For a version that doesn't require the
549−-- constraint see 'rows''.
550−rows :: forall e cols rows. (Countable rows) => Matrix e cols rows -> Int
551−rows _ = fromInteger $ natVal (Proxy :: Proxy (Count rows))
552−
553−-- | Obtain the number of rows in an inefficient manner, but without any
554−-- constraints.
538+-- NOTE: The 'KnownNat' constaint is needed in order to obtain the
539+-- dimensions in constant time.
555540--
556−-- For a more efficient version see 'rows'.
557−rows' :: Matrix e cols rows -> Int
558−rows' (One _) = 1
559−rows' (Join lhs _) = rows' lhs
560−rows' (Fork top bottom) = rows' top + rows' bottom
541+-- TODO: A 'rows' function that does not need the 'KnownNat' constraint in
542+-- exchange for performance.
543+rows :: forall e cols rows. (KnownNat (Count rows)) => Matrix e cols rows -> Int
544+rows _ = fromInteger $ natVal (Proxy :: Proxy (Count rows))
561545
562546-- | Obtain the number of columns.
547+--
548+-- NOTE: The 'KnownNat' constaint is needed in order to obtain the
549+-- dimensions in constant time.
563550--
564−-- NOTE: The 'KnownNat' constraint is needed in order to obtain the
565−-- dimensions in constant time. For a version that doesn't require the
566−-- constraint see 'columns''.
567−columns :: forall e cols rows. (Countable cols) => Matrix e cols rows -> Int
551+-- TODO: A 'columns' function that does not need the 'KnownNat' constraint in
552+-- exchange for performance.
553+columns :: forall e cols rows. (KnownNat (Count cols)) => Matrix e cols rows -> Int
568554columns _ = fromInteger $ natVal (Proxy :: Proxy (Count cols))
569555
570−-- | Obtain the number of columns in an inefficient manner, but without any
571−-- constraints.
572−--
573−-- For a more efficient version see 'columns'.
574−columns' :: Matrix e cols rows -> Int
575−columns' (One _) = 1
576−columns' (Join lhs rhs) = columns' lhs + columns' rhs
577−columns' (Fork top _) = columns' top
578−
579556-- Coproduct Bifunctor
580557
581558infixl 5 -|-
@@ -584,172 +561,157 @@ infixl 5 -|-
584561(-|-) ::
585562 forall e n k m j.
586563 ( Num e,
587− CountableDims j k,
588− FL k k,
589− FL j k,
590− FL k j,
591− FL j j
564+ KnownNat (Count j),
565+ KnownNat (Count k),
566+ FromLists e k k,
567+ FromLists e j k,
568+ FromLists e k j,
569+ FromLists e j j
592570 ) =>
593571 Matrix e n k ->
594572 Matrix e m j ->
595573 Matrix e (Either n m) (Either k j)
596−(-|-) a b = Join (i1 . a) (i2 . b)
574+(-|-) a b = Junc (i1 . a) (i2 . b)
597575
598576-- Khatri Rao Product and projections
599577
600578-- | Khatri Rao product first component projection matrix.
601−fstM ::
579+kp1 ::
602580 forall e m k .
603581 ( Num e,
604− CountableDims k m,
605− FL (Normalize (m, k)) m,
606− CountableN (m, k)
582+ KnownNat (Count k),
583+ FromLists e (FromNat (Count m * Count k)) m,
584+ KnownNat (Count m),
585+ KnownNat (Count (Normalize (m, k)))
607586 ) => Matrix e (Normalize (m, k)) m
608−fstM = matrixBuilder' f
587+kp1 = matrixBuilder f
609588 where
610589 offset = fromInteger (natVal (Proxy :: Proxy (Count k)))
611590 f (x, y)
612591 | y >= (x * offset) && y <= (x * offset + offset - 1) = 1
613− | otherwise = 0
592+ | otherwise = 0
614593
615594-- | Khatri Rao product second component projection matrix.
616−sndM ::
595+kp2 ::
617596 forall e m k .
618597 ( Num e,
619− CountableDims k m,
620− FL (Normalize (m, k)) k,
621− CountableN (m, k)
598+ KnownNat (Count k),
599+ FromLists e (FromNat (Count m * Count k)) k,
600+ KnownNat (Count m),
601+ KnownNat (Count (Normalize (m, k)))
622602 ) => Matrix e (Normalize (m, k)) k
623−sndM = matrixBuilder' f
603+kp2 = matrixBuilder f
624604 where
625605 offset = fromInteger (natVal (Proxy :: Proxy (Count k)))
626606 f (x, y)
627607 | x == y || mod (y - x) offset == 0 = 1
628− | otherwise = 0
608+ | otherwise = 0
629609
630610-- | Khatri Rao Matrix product also known as matrix pairing.
631611--
632612-- NOTE: That this is not a true categorical product, see for instance:
633−--
613+--
634614-- @
635−-- | fstM . kr a b == a
636−-- kr a b ==> |
637−-- | sndM . kr a b == b
615+-- | kp1 . khatri a b == a
616+-- khatri a b ==> |
617+-- | kp2 . khatri a b == b
638618-- @
639619--
640620-- __Emphasis__ on the implication symbol.
641−kr ::
642− forall e cols a b.
621+khatri ::
622+ forall e cols a b.
643623 ( Num e,
644− CountableDims a b,
645− CountableN (a, b),
646− FL (Normalize (a, b)) a,
647− FL (Normalize (a, b)) b
624+ KnownNat (Count a),
625+ KnownNat (Count b),
626+ KnownNat (Count (Normalize (a, b))),
627+ FromLists e (Normalize (a, b)) a,
628+ FromLists e (Normalize (a, b)) b
648629 ) => Matrix e cols a -> Matrix e cols b -> Matrix e cols (Normalize (a, b))
649−kr a b =
650− let fstM' = fstM @e @a @b
651− sndM' = sndM @e @a @b
652− in (tr fstM' . a) * (tr sndM' . b)
630+khatri a b =
631+ let kp1' = kp1 @e @a @b
632+ kp2' = kp2 @e @a @b
633+ in (tr kp1') . a * (tr kp2') . b
653634
654635-- Product Bifunctor (Kronecker)
655636
656637infixl 4 ><
657638
658639-- | Matrix product functor also known as kronecker product
659−(><) ::
660− forall e m p n q.
640+(><) ::
641+ forall e m p n q.
661642 ( Num e,
662− CountableDims m n,
663− CountableDims p q,
664− CountableDimsN (m, n) (p, q),
665− FL (Normalize (m, n)) m,
666− FL (Normalize (m, n)) n,
667− FL (Normalize (p, q)) p,
668− FL (Normalize (p, q)) q
669− )
643+ KnownNat (Count m),
644+ KnownNat (Count n),
645+ KnownNat (Count p),
646+ KnownNat (Count q),
647+ KnownNat (Count (Normalize (m, n))),
648+ FromLists e (Normalize (m, n)) m,
649+ FromLists e (Normalize (m, n)) n,
650+ KnownNat (Count (Normalize (p, q))),
651+ FromLists e (Normalize (p, q)) p,
652+ FromLists e (Normalize (p, q)) q
653+ )
670654 => Matrix e m p -> Matrix e n q -> Matrix e (Normalize (m, n)) (Normalize (p, q))
671655(><) a b =
672− let fstM' = fstM @e @m @n
673− sndM' = sndM @e @m @n
674− in kr (a . fstM') (b . sndM')
656+ let kp1' = kp1 @e @m @n
657+ kp2' = kp2 @e @m @n
658+ in khatri (a . kp1') (b . kp2')
675659
676−-- Matrix abide Join Fork
660+-- Matrix abide Junc Split
677661
678−-- | Matrix "abiding" following the 'Join'-'Fork' exchange law.
679−--
662+-- | Matrix "abiding" followin the 'Junc'-'Split' abide law.
663+--
680664-- Law:
681665--
682666-- @
683−-- 'Join' ('Fork' a c) ('Fork' b d) == 'Fork' ('Join' a b) ('Join' c d)
667+-- 'Junc' ('Split' a c) ('Split' b d) == 'Split' ('Junc' a b) ('Junc' c d)
684668-- @
685−abideJF :: Matrix e cols rows -> Matrix e cols rows
686−abideJF (Join (Fork a c) (Fork b d)) = Fork (Join (abideJF a) (abideJF b)) (Join (abideJF c) (abideJF d)) -- Join-Fork abide law
687−abideJF (One e) = One e
688−abideJF (Join a b) = Join (abideJF a) (abideJF b)
689−abideJF (Fork a b) = Fork (abideJF a) (abideJF b)
669+abideJS :: Matrix e cols rows -> Matrix e cols rows
670+abideJS (Junc (Split a c) (Split b d)) = Split (Junc (abideJS a) (abideJS b)) (Junc (abideJS c) (abideJS d)) -- Junc-Split abide law
671+abideJS Empty = Empty
672+abideJS (One e) = One e
673+abideJS (Junc a b) = Junc (abideJS a) (abideJS b)
674+abideJS (Split a b) = Split (abideJS a) (abideJS b)
690675
691−-- Matrix abide Fork Join
676+-- Matrix abide Split Junc
692677
693−-- | Matrix "abiding" followin the 'Fork'-'Join' abide law.
694−--
678+-- | Matrix "abiding" followin the 'Split'-'Junc' abide law.
679+--
695680-- @
696−-- 'Fork' ('Join' a b) ('Join' c d) == 'Join' ('Fork' a c) ('Fork' b d)
681+-- 'Split' ('Junc' a b) ('Junc' c d) == 'Junc' ('Split' a c) ('Split' b d)
697682-- @
698−abideFJ :: Matrix e cols rows -> Matrix e cols rows
699−abideFJ (Fork (Join a b) (Join c d)) = Join (Fork (abideFJ a) (abideFJ c)) (Fork (abideFJ b) (abideFJ d)) -- Fork-Join abide law
700−abideFJ (One e) = One e
701−abideFJ (Join a b) = Join (abideFJ a) (abideFJ b)
702−abideFJ (Fork a b) = Fork (abideFJ a) (abideFJ b)
683+abideSJ :: Matrix e cols rows -> Matrix e cols rows
684+abideSJ (Split (Junc a b) (Junc c d)) = Junc (Split (abideSJ a) (abideSJ c)) (Split (abideSJ b) (abideSJ d)) -- Split-Junc abide law
685+abideSJ Empty = Empty
686+abideSJ (One e) = One e
687+abideSJ (Junc a b) = Junc (abideSJ a) (abideSJ b)
688+abideSJ (Split a b) = Split (abideSJ a) (abideSJ b)
703689
704690-- Matrix transposition
705691
706692-- | Matrix transposition.
707693tr :: Matrix e cols rows -> Matrix e rows cols
708−tr (One e) = One e
709−tr (Join a b) = Fork (tr a) (tr b)
710−tr (Fork a b) = Join (tr a) (tr b)
694+tr Empty = Empty
695+tr (One e) = One e
696+tr (Junc a b) = Split (tr a) (tr b)
697+tr (Split a b) = Junc (tr a) (tr b)
711698
712699-- Selective 'select' operator
713700
714701-- | Selective functors 'select' operator equivalent inspired by the
715702-- ArrowMonad solution presented in the paper.
716−select :: (Num e, FL b b, Countable b) => Matrix e cols (Either a b) -> Matrix e a b -> Matrix e cols b
717−select (Fork a b) y = y . a + b -- Divide-and-conquer law
718−select (Join (Fork a c) (Fork b d)) y = join (y . a + c) (y . b + d) -- Pattern matching + DnC law
719−select m y = join y id . m
720−
721−branch ::
722− ( Num e,
723− CountableDims a b,
724− CountableDims c (Either b c),
725− FL c b,
726− FL a b,
727− FL a a,
728− FL b b,
729− FL c c,
730− FL b a,
731− FL b c,
732− FL (Either b c) b,
733− FL (Either b c) c
734− )
735− => Matrix e cols (Either a b) -> Matrix e a c -> Matrix e b c -> Matrix e cols c
736−branch x l r = f x `select` g l `select` r
737− where
738− f :: (Num e, Countable a, CountableDims b c, FL a b, FL c b, FL b b, FL b a, FL a a)
739− => Matrix e cols (Either a b) -> Matrix e cols (Either a (Either b c))
740− f m = fork (tr i1) (i1 . tr i2) . m
741− g :: (Num e, CountableDims b c, FL b c, FL c c) => Matrix e a c -> Matrix e a (Either b c)
742− g m = i2 . m
703+select :: (Num e, FromLists e b b, KnownNat (Count b)) => Matrix e cols (Either a b) -> Matrix e a b -> Matrix e cols b
704+select m y = junc y identity . m
743705
744706-- McCarthy's Conditional
745707
746708-- | McCarthy's Conditional expresses probabilistic choice.
747709cond ::
748− ( Trivial cols,
749− Countable cols,
750− FL () cols,
751− FL cols (),
752− FL cols cols,
710+ ( cols ~ FromNat (Count cols),
711+ KnownNat (Count cols),
712+ FromLists e () cols,
713+ FromLists e cols (),
714+ FromLists e cols cols,
753715 Bounded a,
754716 Enum a,
755717 Num e,
@@ -757,14 +719,14 @@ cond ::
757719 )
758720 =>
759721 (a -> Bool) -> Matrix e cols rows -> Matrix e cols rows -> Matrix e cols rows
760−cond p f g = join f g . grd p
761−
762−grd ::
763− ( Trivial q,
764− Countable q,
765− FL () q,
766− FL q (),
767− FL q q,
722+cond p f g = junc f g . grd p
723+
724+grd ::
725+ ( q ~ FromNat (Count q),
726+ KnownNat (Count q),
727+ FromLists e () q,
728+ FromLists e q (),
729+ FromLists e q q,
768730 Bounded a,
769731 Enum a,
770732 Num e,
@@ -772,86 +734,63 @@ grd ::
772734 )
773735 =>
774736 (a -> Bool) -> Matrix e q (Either q q)
775−grd f = fork (corr f) (corr (not . f))
776−
777−corr ::
778− forall e a q .
779− ( Trivial q,
780− Countable q,
781− FL () q,
782− FL q (),
783− FL q q,
784− Liftable e a Bool
785− )
737+grd f = split (corr f) (corr (not . f))
738+
739+corr ::
740+ forall e a q .
741+ ( q ~ FromNat (Count q),
742+ KnownNat (Count q),
743+ FromLists e () q,
744+ FromLists e q (),
745+ FromLists e q q,
746+ Bounded a,
747+ Enum a,
748+ Num e,
749+ Ord e
750+ )
786751 => (a -> Bool) -> Matrix e q q
787−corr p = let f = fromF' p :: Matrix e q ()
788− in kr f (id :: Matrix e q q)
752+corr p = let f = fromF p :: Matrix e q ()
753+ in khatri f (identity :: Matrix e q q)
789754
790755-- Pretty print
791756
792757prettyAux :: Show e => [[e]] -> [[e]] -> String
793758prettyAux [] _ = ""
794−prettyAux [[e]] m = "│ " ++ fill (show e) ++ " │\n"
759+prettyAux [[e]] m = "│ " ++ fill (show e) ++ " │\n"
795760 where
796761 v = fmap show m
797762 widest = maximum $ fmap length v
798763 fill str = replicate (widest - length str - 2) ' ' ++ str
799−prettyAux [h] m = "│ " ++ fill (unwords $ map show h) ++ " │\n"
764+prettyAux [h] m = "│ " ++ fill (unwords $ map show h) ++ " │\n"
800765 where
801− v = fmap show m
802− widest = maximum $ fmap length v
766+ v = fmap show m
767+ widest = maximum $ fmap length v
803768 fill str = replicate (widest - length str - 2) ' ' ++ str
804−prettyAux (h : t) l = "│ " ++ fill (unwords $ map show h) ++ " │\n" ++
769+prettyAux (h : t) l = "│ " ++ fill (unwords $ map show h) ++ " │\n" ++
805770 prettyAux t l
806771 where
807− v = fmap show l
808− widest = maximum $ fmap length v
772+ v = fmap show l
773+ widest = maximum $ fmap length v
809774 fill str = replicate (widest - length str - 2) ' ' ++ str
810775
811776-- | Matrix pretty printer
812−pretty :: (CountableDims cols rows, Show e) => Matrix e cols rows -> String
813−pretty m = concat
814− [ "┌ ", unwords (replicate (columns m) blank), " ┐\n"
815− , unlines
816− [ "│ " ++ unwords (fmap (\j -> fill $ show $ getElem i j m) [1..columns m]) ++ " │" | i <- [1..rows m] ]
817− , "└ ", unwords (replicate (columns m) blank), " ┘"
818− ]
819− where
820− strings = map show (toList m)
821− widest = maximum $ map length strings
777+pretty :: (KnownNat (Count cols), Show e) => Matrix e cols rows -> String
778+pretty m = "┌ " ++ unwords (replicate (columns m) blank) ++ " ┐\n" ++
779+ prettyAux (toLists m) (toLists m) ++
780+ "└ " ++ unwords (replicate (columns m) blank) ++ " ┘"
781+ where
782+ v = fmap show (toList m)
783+ widest = maximum $ fmap length v
822784 fill str = replicate (widest - length str) ' ' ++ str
823− blank = fill ""
824− safeGet i j m
825− | i > rows m || j > columns m || i < 1 || j < 1 = Nothing
826− | otherwise = Just $ unsafeGet i j m (toList m)
827− unsafeGet i j m l = l !! encode (columns m) (i,j)
828− encode m (i,j) = (i-1)*m + j - 1
829− getElem i j m =
830− fromMaybe
831− (error $
832− "getElem: Trying to get the "
833− ++ show (i, j)
834− ++ " element from a "
835− ++ show (rows m) ++ "x" ++ show (columns m)
836− ++ " matrix."
837− )
838− (safeGet i j m)
785+ blank = fill ""
839786
840787-- | Matrix pretty printer
841−prettyPrint :: (CountableDims cols rows, Show e) => Matrix e cols rows -> IO ()
788+prettyPrint :: (KnownNat (Count cols), Show e) => Matrix e cols rows -> IO ()
842789prettyPrint = putStrLn . pretty
843790
844−-- | Zip two matrices with a given binary function
845−zipWithM :: (e -> f -> g) -> Matrix e cols rows -> Matrix f cols rows -> Matrix g cols rows
846−zipWithM f (One a) (One b) = One (f a b)
847−zipWithM f (Join a b) (Join c d) = Join (zipWithM f a c) (zipWithM f b d)
848−zipWithM f (Fork a b) (Fork c d) = Fork (zipWithM f a c) (zipWithM f b d)
849−zipWithM f x@(Fork _ _) y@(Join _ _) = zipWithM f x (abideJF y)
850−zipWithM f x@(Join _ _) y@(Fork _ _) = zipWithM f (abideJF x) y
851−
852791-- Relational operators functions
853792
854−type Boolean = Natural 0 1
793+type Boolean = Natural 0 1
855794type Relation a b = Matrix Boolean a b
856795
857796-- | Helper conversion function
@@ -867,47 +806,54 @@ fromBool False = nat 0
867806
868807-- | Relational negation
869808negateM :: Relation cols rows -> Relation cols rows
870−negateM (One (Nat p)) = One (Nat (negate p))
871−negateM (Join a b) = Join (negateM a) (negateM b)
872−negateM (Fork a b) = Fork (negateM a) (negateM b)
809+negateM Empty = Empty
810+negateM (One (Nat 0)) = One (Nat 1)
811+negateM (One (Nat 1)) = One (Nat 0)
812+negateM (Junc a b) = Junc (negateM a) (negateM b)
813+negateM (Split a b) = Split (negateM a) (negateM b)
873814
874815-- | Relational addition
875816orM :: Relation cols rows -> Relation cols rows -> Relation cols rows
876−orM (One a) (One b) = One (fromBool (toBool a || toBool b))
877−orM (Join a b) (Join c d) = Join (orM a c) (orM b d)
878−orM (Fork a b) (Fork c d) = Fork (orM a c) (orM b d)
879−orM x@(Fork _ _) y@(Join _ _) = orM x (abideJF y)
880−orM x@(Join _ _) y@(Fork _ _) = orM (abideJF x) y
817+orM Empty Empty = Empty
818+orM (One a) (One b) = One (fromBool (toBool a || toBool b))
819+orM (Junc a b) (Junc c d) = Junc (orM a c) (orM b d)
820+orM (Split a b) (Split c d) = Split (orM a c) (orM b d)
821+orM x@(Split _ _) y@(Junc _ _) = orM x (abideJS y)
822+orM x@(Junc _ _) y@(Split _ _) = orM (abideJS x) y
881823
882824-- | Relational multiplication
883825andM :: Relation cols rows -> Relation cols rows -> Relation cols rows
884−andM (One a) (One b) = One (fromBool (toBool a && toBool b))
885−andM (Join a b) (Join c d) = Join (andM a c) (andM b d)
886−andM (Fork a b) (Fork c d) = Fork (andM a c) (andM b d)
887−andM x@(Fork _ _) y@(Join _ _) = andM x (abideJF y)
888−andM x@(Join _ _) y@(Fork _ _) = andM (abideJF x) y
826+andM Empty Empty = Empty
827+andM (One a) (One b) = One (fromBool (toBool a && toBool b))
828+andM (Junc a b) (Junc c d) = Junc (andM a c) (andM b d)
829+andM (Split a b) (Split c d) = Split (andM a c) (andM b d)
830+andM x@(Split _ _) y@(Junc _ _) = andM x (abideJS y)
831+andM x@(Junc _ _) y@(Split _ _) = andM (abideJS x) y
889832
890833-- | Relational subtraction
891834subM :: Relation cols rows -> Relation cols rows -> Relation cols rows
892−subM (One a) (One b) = if a - b < nat 0 then One (nat 0) else One (a - b)
893−subM (Join a b) (Join c d) = Join (subM a c) (subM b d)
894−subM (Fork a b) (Fork c d) = Fork (subM a c) (subM b d)
895−subM x@(Fork _ _) y@(Join _ _) = subM x (abideJF y)
896−subM x@(Join _ _) y@(Fork _ _) = subM (abideJF x) y
835+subM Empty Empty = Empty
836+subM (One a) (One b) = if a - b < nat 0 then One (nat 0) else One (a - b)
837+subM (Junc a b) (Junc c d) = Junc (subM a c) (subM b d)
838+subM (Split a b) (Split c d) = Split (subM a c) (subM b d)
839+subM x@(Split _ _) y@(Junc _ _) = subM x (abideJS y)
840+subM x@(Junc _ _) y@(Split _ _) = subM (abideJS x) y
897841
898842-- | Matrix relational composition.
899843compRel :: Relation cr rows -> Relation cols cr -> Relation cols rows
900−compRel (One a) (One b) = One (fromBool (toBool a && toBool b))
901−compRel (Join a b) (Fork c d) = orM (compRel a c) (compRel b d) -- Divide-and-conquer law
902−compRel (Fork a b) c = Fork (compRel a c) (compRel b c) -- Fork fusion law
903−compRel c (Join a b) = Join (compRel c a) (compRel c b) -- Join fusion law
844+compRel Empty Empty = Empty
845+compRel (One a) (One b) = One (fromBool (toBool a && toBool b))
846+compRel (Junc a b) (Split c d) = orM (compRel a c) (compRel b d) -- Divide-and-conquer law
847+compRel (Split a b) c = Split (compRel a c) (compRel b c) -- Split fusion law
848+compRel c (Junc a b) = Junc (compRel c a) (compRel c b) -- Junc fusion law
904849
905850-- | Matrix relational right division
906851divR :: Relation b c -> Relation b a -> Relation a c
852+divR Empty Empty = Empty
907853divR (One a) (One b) = One (fromBool (not (toBool b) || toBool a)) -- b implies a
908−divR (Join a b) (Join c d) = andM (divR a c) (divR b d)
909−divR (Fork a b) c = Fork (divR a c) (divR b c)
910−divR c (Fork a b) = Join (divR c a) (divR c b)
854+divR (Junc a b) (Junc c d) = andM (divR a c) (divR b d)
855+divR (Split a b) c = Split (divR a c) (divR b c)
856+divR c (Split a b) = Junc (divR c a) (divR c b)
911857
912858-- | Matrix relational left division
913859divL :: Relation c b -> Relation a b -> Relation a c
@@ -923,52 +869,97 @@ divS s r = divL r s `intersection` divR (tr r) (tr s)
923869--
924870-- NOTE: Be careful to not ask for a relation bigger than the cardinality of
925871-- types @a@ or @b@ allows.
926−fromFRel' ::
872+fromFRel ::
927873 forall a b cols rows.
928− ( Liftable Boolean a b,
929− CountableDims cols rows,
930− FL rows cols
874+ ( Bounded a,
875+ Bounded b,
876+ Enum a,
877+ Enum b,
878+ Eq b,
879+ KnownNat (Count cols),
880+ KnownNat (Count rows),
881+ FromLists (Natural 0 1) rows cols
931882 ) =>
932883 (a -> b) ->
933884 Relation cols rows
934−fromFRel' = fromF'
885+fromFRel f =
886+ let minA = minBound @a
887+ maxA = maxBound @a
888+ minB = minBound @b
889+ maxB = maxBound @b
890+ ccols = fromInteger $ natVal (Proxy :: Proxy (Count cols))
891+ rrows = fromInteger $ natVal (Proxy :: Proxy (Count rows))
892+ elementsA = take ccols [minA .. maxA]
893+ elementsB = take rrows [minB .. maxB]
894+ combinations = (,) <$> elementsA <*> elementsB
895+ combAp = map snd . sort . map (\(a, b) -> if f a == b
896+ then ((fromEnum a, fromEnum b), nat 1)
897+ else ((fromEnum a, fromEnum b), nat 0)) $ combinations
898+ mList = buildList combAp rrows
899+ in tr $ fromLists mList
900+ where
901+ buildList [] _ = []
902+ buildList l r = take r l : buildList (drop r l) r
935903
936904-- | Lifts functions to relations with dimensions matching @a@ and @b@
937905-- cardinality's.
938−fromFRel ::
906+fromFRel' ::
939907 forall a b.
940− ( Liftable Boolean a b,
941− CountableDimsN a b,
942− FLN b a
908+ ( Bounded a,
909+ Bounded b,
910+ Enum a,
911+ Enum b,
912+ Eq b,
913+ KnownNat (Count (Normalize a)),
914+ KnownNat (Count (Normalize b)),
915+ FromLists (Natural 0 1) (Normalize b) (Normalize a)
943916 ) =>
944917 (a -> b) ->
945918 Relation (Normalize a) (Normalize b)
946−fromFRel = fromFRel'
919+fromFRel' f =
920+ let minA = minBound @a
921+ maxA = maxBound @a
922+ minB = minBound @b
923+ maxB = maxBound @b
924+ ccols = fromInteger $ natVal (Proxy :: Proxy (Count (Normalize a)))
925+ rrows = fromInteger $ natVal (Proxy :: Proxy (Count (Normalize b)))
926+ elementsA = take ccols [minA .. maxA]
927+ elementsB = take rrows [minB .. maxB]
928+ combinations = (,) <$> elementsA <*> elementsB
929+ combAp = map snd . sort . map (\(a, b) -> if f a == b
930+ then ((fromEnum a, fromEnum b), nat 1)
931+ else ((fromEnum a, fromEnum b), nat 0)) $ combinations
932+ mList = buildList combAp rrows
933+ in tr $ fromLists mList
934+ where
935+ buildList [] _ = []
936+ buildList l r = take r l : buildList (drop r l) r
947937
948938-- | Lifts a relation function to a Boolean Matrix
949−toRel ::
939+toRel ::
950940 forall a b.
951941 ( Bounded a,
952942 Bounded b,
953943 Enum a,
954944 Enum b,
955945 Eq b,
956− CountableDims a b,
957− FLN b a
958− )
946+ KnownNat (Count (Normalize a)),
947+ KnownNat (Count (Normalize b)),
948+ FromLists (Natural 0 1) (Normalize b) (Normalize a)
949+ )
959950 => (a -> b -> Bool) -> Relation (Normalize a) (Normalize b)
960951toRel f =
961952 let minA = minBound @a
962953 maxA = maxBound @a
963954 minB = minBound @b
964955 maxB = maxBound @b
965− ccols = fromInteger $ natVal (Proxy :: Proxy (Count a))
966− rrows = fromInteger $ natVal (Proxy :: Proxy (Count b))
956+ ccols = fromInteger $ natVal (Proxy :: Proxy (Count (Normalize a)))
957+ rrows = fromInteger $ natVal (Proxy :: Proxy (Count (Normalize b)))
967958 elementsA = take ccols [minA .. maxA]
968959 elementsB = take rrows [minB .. maxB]
969960 combinations = (,) <$> elementsA <*> elementsB
970− combAp = map snd . sort . map (\(a, b) -> if uncurry f (a, b)
971− then ((fromEnum a, fromEnum b), nat 1)
961+ combAp = map snd . sort . map (\(a, b) -> if uncurry f (a, b)
962+ then ((fromEnum a, fromEnum b), nat 1)
972963 else ((fromEnum a, fromEnum b), nat 0)) $ combinations
973964 mList = buildList combAp rrows
974965 in tr $ fromLists mList
src/LAoP/Matrix/Nat.hs+187−194
@@ -1,4 +1,3 @@
1−{-# LANGUAGE ConstraintKinds #-}
21{-# LANGUAGE AllowAmbiguousTypes #-}
32{-# LANGUAGE DataKinds #-}
43{-# LANGUAGE DerivingVia #-}
@@ -54,22 +53,11 @@ module LAoP.Matrix.Nat
5453 -- * Type safe matrix representation
5554 Matrix (..),
5655
57− -- * Constraint type synonyms
58− Countable,
59− CountableDims,
60− CountableN,
61− CountableNz,
62− CountableDimsN,
63− FLN,
64− FLNz,
65− Liftable,
66− TrivialE,
67− TrivialP,
68−
6956 -- * Primitives
57+ empty,
7058 one,
71− join,
72− fork,
59+ junc,
60+ split,
7361
7462 -- * Auxiliary type families
7563 I.FromNat,
@@ -77,11 +65,11 @@ module LAoP.Matrix.Nat
7765 I.Normalize,
7866
7967 -- * Matrix construction and conversion
80− I.FL,
68+ I.FromLists,
8169 fromLists,
8270 toLists,
8371 toList,
84− matrixBuilder',
72+ matrixBuilder,
8573 row,
8674 col,
8775 zeros,
@@ -97,10 +85,6 @@ module LAoP.Matrix.Nat
9785 -- ** Matrix Transposition
9886 tr,
9987
100− -- ** Scalar multiplication/division of matrices
101− (.|),
102− (./),
103−
10488 -- ** Selective operator
10589 select,
10690
@@ -108,19 +92,16 @@ module LAoP.Matrix.Nat
10892 cond,
10993
11094 -- ** Matrix "abiding"
111− abideJF,
112− abideFJ,
113−
114− -- ** Zip Matrices
115− zipWithM,
95+ abideJS,
96+ abideSJ,
11697
11798 -- * Biproduct approach
118− -- ** Fork
99+ -- ** Split
119100 (===),
120101 -- *** Projections
121102 p1,
122103 p2,
123− -- ** Join
104+ -- ** Junc
124105 (|||),
125106 -- *** Injections
126107 i1,
@@ -134,11 +115,11 @@ module LAoP.Matrix.Nat
134115 -- | Note that given the restrictions imposed it is not possible to
135116 -- implement the standard type classes present in standard Haskell.
136117 -- *** Matrix pairing projections
137− fstM,
138− sndM,
118+ kp1,
119+ kp2,
139120
140121 -- *** Matrix pairing
141− kr,
122+ khatri,
142123
143124 -- * Matrix composition and lifting
144125
@@ -146,10 +127,10 @@ module LAoP.Matrix.Nat
146127
147128 -- | Note that given the restrictions imposed it is not possible to
148129 -- implement the standard type classes present in standard Haskell.
149− iden,
130+ identity,
150131 comp,
151− fromF',
152132 fromF,
133+ fromF',
153134
154135 -- * Matrix printing
155136 pretty,
@@ -160,95 +141,107 @@ where
160141import Data.Proxy
161142import GHC.TypeLits
162143import Control.DeepSeq
144+import qualified Control.Category as C
163145import qualified LAoP.Matrix.Internal as I
164146
165147newtype Matrix e (cols :: Nat) (rows :: Nat) = M (I.Matrix e (I.FromNat cols) (I.FromNat rows))
166148 deriving (Show, Num, Eq, Ord, NFData) via (I.Matrix e (I.FromNat cols) (I.FromNat rows))
167149
168−-- | Constraint type synonyms to keep the type signatures less convoluted
169−type Countable a = KnownNat (I.Count a)
170−type CountableDims a b = (Countable a, Countable b)
171−type CountableN a = KnownNat (I.Count (I.FromNat a))
172−type CountableNz a = KnownNat (I.Count (I.Normalize a))
173−type CountableDimsN a b = (CountableN a, CountableN b)
174−type FLN e a b = I.FL (I.FromNat a) (I.FromNat b)
175−type FLNz e a b = I.FL (I.Normalize a) (I.Normalize b)
176−type Liftable e a b = (Bounded a, Bounded b, Enum a, Enum b, Eq b, Num e, Ord e)
177−type TrivialE a b = I.FromNat (a + b) ~ Either (I.FromNat a) (I.FromNat b)
178−type TrivialP a b = I.FromNat (a * b) ~ I.FromNat (I.Count (I.FromNat a) * I.Count (I.FromNat b))
150+-- | It isn't possible to implement the 'id' function so it's
151+-- implementation is 'undefined'. However 'comp' can be and this partial
152+-- class implementation exists just to make the code more readable.
153+--
154+-- Please use 'identity' instead.
155+instance (Num e) => C.Category (Matrix e) where
156+ id = undefined
157+ (.) = comp
179158
180159-- Primitives
181160
161+empty :: Matrix e 0 0
162+empty = M I.Empty
163+
182164one :: e -> Matrix e 1 1
183165one = M . I.One
184166
185−join ::
186− (TrivialE a b) =>
187− Matrix e a rows ->
188− Matrix e b rows ->
189− Matrix e (a + b) rows
190−join (M a) (M b) = M (I.Join a b)
167+junc ::
168+ (I.FromNat cols3 ~ Either (I.FromNat cols1) (I.FromNat cols2)) =>
169+ Matrix e cols1 rows ->
170+ Matrix e cols2 rows ->
171+ Matrix e cols3 rows
172+junc (M a) (M b) = M (I.Junc a b)
191173
192174infixl 3 |||
193175(|||) ::
194− (TrivialE a b) =>
195− Matrix e a rows ->
196− Matrix e b rows ->
197− Matrix e (a + b) rows
198−(|||) = join
199−
200−fork ::
201− (TrivialE a b) =>
202− Matrix e cols a ->
203− Matrix e cols b ->
204− Matrix e cols (a + b)
205−fork (M a) (M b) = M (I.Fork a b)
176+ (I.FromNat cols3 ~ Either (I.FromNat cols1) (I.FromNat cols2)) =>
177+ Matrix e cols1 rows ->
178+ Matrix e cols2 rows ->
179+ Matrix e cols3 rows
180+(|||) = junc
181+
182+split ::
183+ (I.FromNat rows3 ~ Either (I.FromNat rows1) (I.FromNat rows2)) =>
184+ Matrix e cols rows1 ->
185+ Matrix e cols rows2 ->
186+ Matrix e cols rows3
187+split (M a) (M b) = M (I.Split a b)
206188
207189infixl 2 ===
208190(===) ::
209− (TrivialE a b) =>
210− Matrix e cols a ->
211− Matrix e cols b ->
212− Matrix e cols (a + b)
213−(===) = fork
191+ (I.FromNat rows3 ~ Either (I.FromNat rows1) (I.FromNat rows2)) =>
192+ Matrix e cols rows1 ->
193+ Matrix e cols rows2 ->
194+ Matrix e cols rows3
195+(===) = split
214196
215197-- Construction
216198
217−fromLists :: (FLN e cols rows) => [[e]] -> Matrix e cols rows
199+fromLists :: (I.FromLists e (I.FromNat cols) (I.FromNat rows)) => [[e]] -> Matrix e cols rows
218200fromLists = M . I.fromLists
219201
220−-- | Matrix builder function. Constructs a matrix provided with
221−-- a construction function that operates with indices.
222−matrixBuilder' ::
223− (FLN e cols rows, CountableN cols, CountableN rows)
224− => ((Int, Int) -> e) -> Matrix e cols rows
225−matrixBuilder' = M . I.matrixBuilder'
202+matrixBuilder ::
203+ (I.FromLists e (I.FromNat cols) (I.FromNat rows), KnownNat (I.Count (I.FromNat cols)), KnownNat (I.Count (I.FromNat rows))) =>
204+ ((Int, Int) -> e) ->
205+ Matrix e cols rows
206+matrixBuilder = M . I.matrixBuilder
226207
227−col :: (I.FL () (I.FromNat rows)) => [e] -> Matrix e 1 rows
208+col :: (I.FromLists e () (I.FromNat rows)) => [e] -> Matrix e 1 rows
228209col = M . I.col
229210
230−row :: (I.FL (I.FromNat cols) ()) => [e] -> Matrix e cols 1
211+row :: (I.FromLists e (I.FromNat cols) ()) => [e] -> Matrix e cols 1
231212row = M . I.row
232213
233−fromF' ::
234− ( Liftable e a b,
235− CountableN cols,
236− CountableN rows,
237− FLN e rows cols
214+fromF ::
215+ ( Bounded a,
216+ Bounded b,
217+ Enum a,
218+ Enum b,
219+ Eq b,
220+ Num e,
221+ Ord e,
222+ KnownNat (I.Count (I.FromNat cols)),
223+ KnownNat (I.Count (I.FromNat rows)),
224+ I.FromLists e (I.FromNat rows) (I.FromNat cols)
238225 ) =>
239226 (a -> b) ->
240227 Matrix e cols rows
241−fromF' = M . I.fromF'
228+fromF = M . I.fromF
242229
243−fromF ::
244− ( Liftable e a b,
245− CountableNz a,
246− CountableNz b,
247− FLNz e b a
230+fromF' ::
231+ ( Bounded a,
232+ Bounded b,
233+ Enum a,
234+ Enum b,
235+ Eq b,
236+ Num e,
237+ Ord e,
238+ KnownNat (I.Count (I.Normalize a)),
239+ KnownNat (I.Count (I.Normalize b)),
240+ I.FromLists e (I.Normalize b) (I.Normalize a)
248241 ) =>
249242 (a -> b) ->
250243 Matrix e (I.Count a) (I.Count b)
251−fromF = undefined -- M . I.fromF
244+fromF' = M . I.fromF'
252245
253246-- Conversion
254247
@@ -261,21 +254,21 @@ toList (M m) = I.toList m
261254-- Zeros Matrix
262255
263256zeros ::
264− (Num e, FLN e cols rows, CountableN cols, CountableN rows) =>
257+ (Num e, I.FromLists e (I.FromNat cols) (I.FromNat rows), KnownNat (I.Count (I.FromNat cols)), KnownNat (I.Count (I.FromNat rows))) =>
265258 Matrix e cols rows
266259zeros = M I.zeros
267260
268261-- Ones Matrix
269262
270263ones ::
271− (Num e, FLN e cols rows, CountableN cols, CountableN rows) =>
264+ (Num e, I.FromLists e (I.FromNat cols) (I.FromNat rows), KnownNat (I.Count (I.FromNat cols)), KnownNat (I.Count (I.FromNat rows))) =>
272265 Matrix e cols rows
273266ones = M I.ones
274267
275268-- Const Matrix
276269
277270constant ::
278− (Num e, FLN e cols rows, CountableN cols, CountableN rows) =>
271+ (Num e, I.FromLists e (I.FromNat cols) (I.FromNat rows), KnownNat (I.Count (I.FromNat cols)), KnownNat (I.Count (I.FromNat rows))) =>
279272 e ->
280273 Matrix e cols rows
281274constant = M . I.constant
@@ -284,52 +277,40 @@ constant = M . I.constant
284277
285278bang ::
286279 forall e cols.
287− (Num e, Enum e, I.FL (I.FromNat cols) (), CountableN cols) =>
280+ (Num e, Enum e, I.FromLists e (I.FromNat cols) (), KnownNat (I.Count (I.FromNat cols))) =>
288281 Matrix e cols 1
289282bang = M I.bang
290283
291−-- iden Matrix
284+-- Identity Matrix
292285
293−iden ::
294− (Num e, FLN e cols cols, CountableN cols) =>
286+identity ::
287+ (Num e, I.FromLists e (I.FromNat cols) (I.FromNat cols), KnownNat (I.Count (I.FromNat cols))) =>
295288 Matrix e cols cols
296−iden = M I.iden
289+identity = M I.identity
297290
298291-- Matrix composition (MMM)
299292
300293comp :: (Num e) => Matrix e cr rows -> Matrix e cols cr -> Matrix e cols rows
301294comp (M a) (M b) = M (I.comp a b)
302295
303−-- Scalar multiplication of matrices
304−
305−infixl 7 .|
306−-- | Scalar multiplication of matrices.
307−(.|) :: Num e => e -> Matrix e cols rows -> Matrix e cols rows
308−(.|) e (M m) = M (e I..| m)
309−
310−-- Scalar division of matrices
311−
312−infixl 7 ./
313−-- | Scalar multiplication of matrices.
314−(./) :: Fractional e => Matrix e cols rows -> e -> Matrix e cols rows
315−(./) (M m) e = M (m I../ e)
316−
317296p1 ::
318297 ( Num e,
319− CountableDimsN n m,
320− FLN e n m,
321− FLN e m m,
322− TrivialE m n
298+ KnownNat (I.Count (I.FromNat n)),
299+ KnownNat (I.Count (I.FromNat m)),
300+ I.FromLists e (I.FromNat n) (I.FromNat m),
301+ I.FromLists e (I.FromNat m) (I.FromNat m),
302+ I.FromNat (m + n) ~ Either (I.FromNat m) (I.FromNat n)
323303 ) =>
324304 Matrix e (m + n) m
325305p1 = M I.p1
326306
327307p2 ::
328308 ( Num e,
329− CountableDimsN n m,
330− FLN e m n,
331− FLN e n n,
332− TrivialE m n
309+ KnownNat (I.Count (I.FromNat n)),
310+ KnownNat (I.Count (I.FromNat m)),
311+ I.FromLists e (I.FromNat m) (I.FromNat n),
312+ I.FromLists e (I.FromNat n) (I.FromNat n),
313+ I.FromNat (m + n) ~ Either (I.FromNat m) (I.FromNat n)
333314 ) =>
334315 Matrix e (m + n) n
335316p2 = M I.p2
@@ -338,125 +319,138 @@ p2 = M I.p2
338319
339320i1 ::
340321 ( Num e,
341− CountableDimsN n rows,
342− FLN e n rows,
343− FLN e rows rows,
344− TrivialE rows n
322+ KnownNat (I.Count (I.FromNat n)),
323+ KnownNat (I.Count (I.FromNat rows)),
324+ I.FromLists e (I.FromNat n) (I.FromNat rows),
325+ I.FromLists e (I.FromNat rows) (I.FromNat rows),
326+ I.FromNat (rows + n) ~ Either (I.FromNat rows) (I.FromNat n)
345327 ) =>
346328 Matrix e rows (rows + n)
347329i1 = tr p1
348330
349331i2 ::
350332 ( Num e,
351− CountableDimsN rows m,
352− FLN e m rows,
353− FLN e rows rows,
354− TrivialE m rows
333+ KnownNat (I.Count (I.FromNat rows)),
334+ KnownNat (I.Count (I.FromNat m)),
335+ I.FromLists e (I.FromNat m) (I.FromNat rows),
336+ I.FromLists e (I.FromNat rows) (I.FromNat rows),
337+ I.FromNat (m + rows) ~ Either (I.FromNat m) (I.FromNat rows)
355338 ) =>
356339 Matrix e rows (m + rows)
357340i2 = tr p2
358341
359342-- Dimensions
360343
361−rows :: (CountableN rows) => Matrix e cols rows -> Int
344+rows :: (KnownNat (I.Count (I.FromNat rows))) => Matrix e cols rows -> Int
362345rows (M m) = I.rows m
363346
364−columns :: (CountableN cols) => Matrix e cols rows -> Int
347+columns :: (KnownNat (I.Count (I.FromNat cols))) => Matrix e cols rows -> Int
365348columns (M m) = I.columns m
366349
350+-- Coproduct Bifunctor
351+
367352infixl 5 -|-
368353
369−-- | Coproduct Bifunctor (Direct sum)
370354(-|-) ::
371355 ( Num e,
372− CountableDimsN j k,
373− FLN e k k,
374− FLN e j k,
375− FLN e k j,
376− FLN e j j,
377− TrivialE n m,
378− TrivialE k j
356+ KnownNat (I.Count (I.FromNat j)),
357+ KnownNat (I.Count (I.FromNat k)),
358+ I.FromLists e (I.FromNat k) (I.FromNat k),
359+ I.FromLists e (I.FromNat j) (I.FromNat k),
360+ I.FromLists e (I.FromNat k) (I.FromNat j),
361+ I.FromLists e (I.FromNat j) (I.FromNat j),
362+ I.FromNat (n + m) ~ Either (I.FromNat n) (I.FromNat m),
363+ I.FromNat (k + j) ~ Either (I.FromNat k) (I.FromNat j)
379364 ) =>
380365 Matrix e n k ->
381366 Matrix e m j ->
382367 Matrix e (n + m) (k + j)
383368(-|-) (M a) (M b) = M ((I.-|-) a b)
384369
385−-- | Khatri Rao Product first projection
386−fstM ::
370+-- Khatri Rao Product and projections
371+
372+kp1 ::
387373 forall e m k .
388374 ( Num e,
389− CountableDimsN m k,
390− CountableN (m * k),
391− FLN e (m * k) m,
392− TrivialP m k
375+ KnownNat (I.Count (I.FromNat m)),
376+ KnownNat (I.Count (I.FromNat k)),
377+ KnownNat (I.Count (I.FromNat (m * k))),
378+ I.FromLists e (I.FromNat (m * k)) (I.FromNat m),
379+ I.FromNat (m * k) ~ I.FromNat (I.Count (I.FromNat m) * I.Count (I.FromNat k))
393380 ) => Matrix e (m * k) m
394−fstM = M (I.fstM @e @(I.FromNat m) @(I.FromNat k))
381+kp1 = M (I.kp1 @e @(I.FromNat m) @(I.FromNat k))
395382
396−-- | Khatri Rao Product second projection
397−sndM ::
383+kp2 ::
398384 forall e m k.
399385 ( Num e,
400− CountableDimsN k m,
401− FLN e (m * k) k,
402− CountableN (m * k),
403− TrivialP m k
386+ KnownNat (I.Count (I.FromNat k)),
387+ I.FromLists e (I.FromNat (m * k)) (I.FromNat k),
388+ KnownNat (I.Count (I.FromNat m)),
389+ KnownNat (I.Count (I.FromNat (m * k))),
390+ I.FromNat (m * k) ~ I.FromNat (I.Count (I.FromNat m) * I.Count (I.FromNat k))
404391 ) => Matrix e (m * k) k
405−sndM = M (I.sndM @e @(I.FromNat m) @(I.FromNat k))
392+kp2 = M (I.kp2 @e @(I.FromNat m) @(I.FromNat k))
406393
407−-- | Khatri Rao Product
408−kr ::
394+khatri ::
409395 forall e cols a b.
410396 ( Num e,
411− CountableDimsN a b,
412− CountableN (a * b),
413− FLN e (a * b) a,
414− FLN e (a * b) b,
415− TrivialP a b
397+ KnownNat (I.Count (I.FromNat a)),
398+ KnownNat (I.Count (I.FromNat b)),
399+ KnownNat (I.Count (I.FromNat (a * b))),
400+ I.FromLists e (I.FromNat (a * b)) (I.FromNat a),
401+ I.FromLists e (I.FromNat (a * b)) (I.FromNat b),
402+ I.FromNat (a * b) ~ I.FromNat (I.Count (I.FromNat a) * I.Count (I.FromNat b))
416403 ) => Matrix e cols a -> Matrix e cols b -> Matrix e cols (a * b)
417−kr a b =
418− let fstM' = fstM @e @a @b
419− sndM' = sndM @e @a @b
420− in comp (tr fstM') a * comp (tr sndM') b
404+khatri a b =
405+ let kp1' = kp1 @e @a @b
406+ kp2' = kp2 @e @a @b
407+ in comp (tr kp1') a * comp (tr kp2') b
408+
409+-- Product Bifunctor (Kronecker)
421410
422−-- | Product Bifunctor (Kronecker)
423411infixl 4 ><
424412
425413(><) ::
426414 forall e m p n q.
427415 ( Num e,
428− CountableDimsN m n,
429− CountableDimsN p q,
430− CountableDimsN (m * n) (p * q),
431− FLN e (m * n) m,
432− FLN e (m * n) n,
433− FLN e (p * q) p,
434− FLN e (p * q) q,
435− TrivialP m n,
436− TrivialP p q
416+ KnownNat (I.Count (I.FromNat m)),
417+ KnownNat (I.Count (I.FromNat n)),
418+ KnownNat (I.Count (I.FromNat p)),
419+ KnownNat (I.Count (I.FromNat q)),
420+ KnownNat (I.Count (I.FromNat (m * n))),
421+ KnownNat (I.Count (I.FromNat (p * q))),
422+ I.FromLists e (I.FromNat (m * n)) (I.FromNat m),
423+ I.FromLists e (I.FromNat (m * n)) (I.FromNat n),
424+ I.FromLists e (I.FromNat (p * q)) (I.FromNat p),
425+ I.FromLists e (I.FromNat (p * q)) (I.FromNat q),
426+ I.FromNat (m * n) ~ I.FromNat (I.Count (I.FromNat m) * I.Count (I.FromNat n)),
427+ I.FromNat (p * q) ~ I.FromNat (I.Count (I.FromNat p) * I.Count (I.FromNat q))
437428 ) => Matrix e m p -> Matrix e n q -> Matrix e (m * n) (p * q)
438429(><) a b =
439− let fstM' = fstM @e @m @n
440− sndM' = sndM @e @m @n
441− in kr (comp a fstM') (comp b sndM')
430+ let kp1' = kp1 @e @m @n
431+ kp2' = kp2 @e @m @n
432+ in khatri (comp a kp1') (comp b kp2')
433+
434+-- Matrix abide Junc Split
442435
443−-- | Matrix abide Join Fork
444−abideJF :: Matrix e cols rows -> Matrix e cols rows
445−abideJF (M m) = M (I.abideJF m)
436+abideJS :: Matrix e cols rows -> Matrix e cols rows
437+abideJS (M m) = M (I.abideJS m)
446438
447−-- | Matrix abide Fork Join
448−abideFJ :: Matrix e cols rows -> Matrix e cols rows
449−abideFJ (M m) = M (I.abideFJ m)
439+-- Matrix abide Split Junc
440+
441+abideSJ :: Matrix e cols rows -> Matrix e cols rows
442+abideSJ (M m) = M (I.abideSJ m)
443+
444+-- Matrix transposition
450445
451−-- | Matrix transposition
452446tr :: Matrix e cols rows -> Matrix e rows cols
453447tr (M m) = M (I.tr m)
454448
455449-- Selective 'select' operator
456450select ::
457451 ( Num e,
458− FLN e rows1 rows1,
459− CountableN rows1,
452+ I.FromLists e (I.FromNat rows1) (I.FromNat rows1),
453+ KnownNat (I.Count (I.FromNat rows1)),
460454 I.FromNat rows2 ~ I.FromNat rows1,
461455 I.FromNat cols1 ~ I.FromNat cols2,
462456 I.FromNat rows3 ~ Either (I.FromNat cols3) (I.FromNat rows1)
@@ -467,11 +461,14 @@ select (M m) (M y) = M (I.select m y)
467461
468462cond ::
469463 ( I.FromNat (I.Count (I.FromNat cols)) ~ I.FromNat cols,
470− CountableN cols,
471− I.FL () (I.FromNat cols),
472− I.FL (I.FromNat cols) (),
473− FLN e cols cols,
474− Liftable e a Bool
464+ KnownNat (I.Count (I.FromNat cols)),
465+ I.FromLists e () (I.FromNat cols),
466+ I.FromLists e (I.FromNat cols) (),
467+ I.FromLists e (I.FromNat cols) (I.FromNat cols),
468+ Bounded a,
469+ Enum a,
470+ Num e,
471+ Ord e
475472 )
476473 =>
477474 (a -> Bool) -> Matrix e cols rows -> Matrix e cols rows -> Matrix e cols rows
@@ -479,12 +476,8 @@ cond p (M a) (M b) = M (I.cond p a b)
479476
480477-- Pretty print
481478
482−pretty :: (CountableDimsN cols rows, Show e) => Matrix e cols rows -> String
479+pretty :: (KnownNat (I.Count (I.FromNat cols)), Show e) => Matrix e cols rows -> String
483480pretty (M m) = I.pretty m
484481
485−prettyPrint :: (CountableDimsN cols rows, Show e) => Matrix e cols rows -> IO ()
482+prettyPrint :: (KnownNat (I.Count (I.FromNat cols)), Show e) => Matrix e cols rows -> IO ()
486483prettyPrint (M m) = I.prettyPrint m
487−
488−-- | Zip two matrices with a given binary function
489−zipWithM :: (e -> f -> g) -> Matrix e cols rows -> Matrix f cols rows -> Matrix g cols rows
490−zipWithM f (M a) (M b) = M (I.zipWithM f a b)
src/LAoP/Matrix/Type.hs+240−283
@@ -1,11 +1,10 @@
1−{-# LANGUAGE ConstraintKinds #-}
2−{-# LANGUAGE TypeFamilies #-}
31{-# LANGUAGE AllowAmbiguousTypes #-}
42{-# LANGUAGE DataKinds #-}
53{-# LANGUAGE DerivingVia #-}
64{-# LANGUAGE FlexibleContexts #-}
75{-# LANGUAGE FlexibleInstances #-}
86{-# LANGUAGE GADTs #-}
7+{-# LANGUAGE KindSignatures #-}
98{-# LANGUAGE MultiParamTypeClasses #-}
109{-# LANGUAGE NoStarIsType #-}
1110{-# LANGUAGE RankNTypes #-}
@@ -56,24 +55,15 @@ module LAoP.Matrix.Type
5655 -- * Type safe matrix representation
5756 Matrix (..),
5857
59− -- * Constraint type aliases
60− Countable,
61− CountableDims,
62− CountableN,
63− CountableDimsN,
64− FLN,
65− Liftable,
66− Trivial,
67− TrivialP,
68−
6958 -- * Type aliases
7059 Zero,
7160 One,
7261
7362 -- * Primitives
63+ empty,
7464 one,
75− join,
76− fork,
65+ junc,
66+ split,
7767
7868 -- * Auxiliary type families
7969 I.FromNat,
@@ -85,27 +75,24 @@ module LAoP.Matrix.Type
8575 fromLists,
8676 toLists,
8777 toList,
88− matrixBuilder',
8978 matrixBuilder,
9079 row,
9180 col,
9281 zeros,
9382 ones,
9483 bang,
95− point,
9684 constant,
9785
9886 -- * Functor instance equivalent function
9987 fmapM,
100− bimapM,
10188
10289 -- * Applicative/Monoidal instance equivalent functions
10390 unitM,
10491 multM,
10592
10693 -- * Selective equivalent instance function
107− selectM,
108−
94+ selectM,
95+
10996 -- * Monad equivalent instance function
11097 returnM,
11198 bindM,
@@ -113,34 +100,25 @@ module LAoP.Matrix.Type
113100 -- * Misc
114101 -- ** Get dimensions
115102 columns,
116− columns',
117103 rows,
118− rows',
119104
120105 -- ** Matrix Transposition
121106 tr,
122107
123− -- ** Scalar multiplication/division of matrices
124− (.|),
125− (./),
126−
127108 -- ** McCarthy's Conditional
128109 cond,
129110
130111 -- ** Matrix "abiding"
131− abideJF,
132− abideFJ,
133−
134− -- ** Zip Matrices
135− zipWithM,
112+ abideJS,
113+ abideSJ,
136114
137115 -- * Biproduct approach
138− -- ** Fork
116+ -- ** Split
139117 (===),
140118 -- *** Projections
141119 p1,
142120 p2,
143− -- ** Join
121+ -- ** Junc
144122 (|||),
145123 -- *** Injections
146124 i1,
@@ -154,11 +132,11 @@ module LAoP.Matrix.Type
154132 -- | Note that given the restrictions imposed it is not possible to
155133 -- implement the standard type classes present in standard Haskell.
156134 -- *** Matrix pairing projections
157− fstM,
158− sndM,
135+ kp1,
136+ kp2,
159137
160138 -- *** Matrix pairing
161− kr,
139+ khatri,
162140
163141 -- * Matrix composition and lifting
164142
@@ -166,10 +144,10 @@ module LAoP.Matrix.Type
166144
167145 -- | Note that given the restrictions imposed it is not possible to
168146 -- implement the standard type classes present in standard Haskell.
169− iden,
147+ identity,
170148 comp,
171− fromF',
172149 fromF,
150+ fromF',
173151
174152 -- * Relation
175153 toRel,
@@ -183,44 +161,23 @@ where
183161import Data.Void
184162import Data.Proxy
185163import Data.Kind
186−import GHC.TypeLits
164+import GHC.TypeLits
187165import Control.DeepSeq
188166import LAoP.Utils
167+import qualified Control.Category as C
189168import qualified LAoP.Matrix.Internal as I
190−import Prelude hiding (id, (.))
191169
192170newtype Matrix e (cols :: Type) (rows :: Type) = M (I.Matrix e (I.Normalize cols) (I.Normalize rows))
193171 deriving (Show, Num, Eq, Ord, NFData) via (I.Matrix e (I.Normalize cols) (I.Normalize rows))
194172
195−-- | Constraint type synonyms to keep the type signatures less convoluted
196−type Countable a = KnownNat (I.Count a)
197−type CountableDims a b = (Countable a, Countable b)
198−type CountableN a = KnownNat (I.Count (I.Normalize a))
199−type CountableDimsN a b = (CountableN a, CountableN b)
200−type FLN a b = I.FromLists (I.Normalize a) (I.Normalize b)
201−type Liftable e a b = (Bounded a, Bounded b, Enum a, Enum b, Eq b, Num e, Ord e)
202−type Trivial a = I.Normalize (I.Normalize a) ~ I.Normalize (I.Normalize (I.Normalize a))
203−type Trivial2 a = I.Normalize a ~ I.Normalize (I.Normalize a)
204−type Trivial3 a = I.FromNat (I.Count (I.Normalize (I.Normalize a))) ~ I.Normalize (I.Normalize a)
205−type TrivialP a b = I.Normalize (a, b) ~ I.Normalize (I.Normalize a, I.Normalize b)
206−
207−-- | It is possible to implement a constrained version of the category type
208−-- class.
209−instance (Num e) => Category (Matrix e) where
210− type Object (Matrix e) a = (FLN a a, CountableN a)
211− id = iden
212− (.) = comp
213−
214−-- | Bifunctor equivalent function
215−bimapM ::
216− ( Liftable e a b,
217− Liftable e c d,
218− CountableDimsN a c,
219− CountableDimsN b d,
220− FLN d c,
221− FLN b a
222− ) => (a -> b) -> (c -> d) -> Matrix e a c -> Matrix e b d
223−bimapM f g m = fromF g . m . tr (fromF f)
173+-- | It isn't possible to implement the 'id' function so it's
174+-- implementation is 'undefined'. However 'comp' can be and this partial
175+-- class implementation exists just to make the code more readable.
176+--
177+-- Please use 'identity' instead.
178+instance (Num e) => C.Category (Matrix e) where
179+ id = undefined
180+ (.) = comp
224181
225182-- | Zero type alias
226183type Zero = Void
@@ -230,75 +187,92 @@ type One = ()
230187
231188-- Primitives
232189
190+-- | Empty matrix constructor
191+empty :: Matrix e Zero Zero
192+empty = M I.Empty
193+
233194-- | Unit matrix constructor
234195one :: e -> Matrix e One One
235196one = M . I.One
236197
237−-- | Matrix 'Join' constructor
238−join ::
198+-- | Matrix 'Junc' constructor
199+junc ::
200+ (I.Normalize (Either a b) ~ Either (I.Normalize a) (I.Normalize b)) =>
239201 Matrix e a rows ->
240202 Matrix e b rows ->
241203 Matrix e (Either a b) rows
242−join (M a) (M b) = M (I.Join a b)
204+junc (M a) (M b) = M (I.Junc a b)
243205
244206infixl 3 |||
245−-- | Matrix 'Join' constructor
207+-- | Matrix 'Junc' constructor
246208(|||) ::
209+ (I.Normalize (Either a b) ~ Either (I.Normalize a) (I.Normalize b)) =>
247210 Matrix e a rows ->
248211 Matrix e b rows ->
249212 Matrix e (Either a b) rows
250−(|||) = join
213+(|||) = junc
251214
252−-- | Matrix 'Fork' constructor
253−fork ::
215+-- | Matrix 'Split' constructor
216+split ::
217+ (I.Normalize (Either a b) ~ Either (I.Normalize a) (I.Normalize b)) =>
254218 Matrix e cols a ->
255219 Matrix e cols b ->
256220 Matrix e cols (Either a b)
257−fork (M a) (M b) = M (I.Fork a b)
221+split (M a) (M b) = M (I.Split a b)
258222
259223infixl 2 ===
260−-- | Matrix 'Fork' constructor
224+-- | Matrix 'Split' constructor
261225(===) ::
226+ (I.Normalize (Either a b) ~ Either (I.Normalize a) (I.Normalize b)) =>
262227 Matrix e cols a ->
263228 Matrix e cols b ->
264229 Matrix e cols (Either a b)
265−(===) = fork
230+(===) = split
266231
267232-- Functor hierarchy
268233
269234-- | Functor instance equivalent function
270−fmapM ::
271− ( Liftable e a b,
272− CountableDimsN a b,
273− FLN b a
235+fmapM ::
236+ ( Bounded a,
237+ Bounded b,
238+ Enum a,
239+ Enum b,
240+ Eq b,
241+ Num e,
242+ Ord e,
243+ KnownNat (I.Count (I.Normalize a)),
244+ KnownNat (I.Count (I.Normalize b)),
245+ I.FromLists e (I.Normalize b) (I.Normalize a)
274246 )
275247 =>
276248 (a -> b) -> Matrix e c a -> Matrix e c b
277−fmapM f m = fromF f . m
249+fmapM f m = fromF' f `comp` m
278250
279251-- | Applicative instance equivalent 'unit' function,
280252unitM :: (Num e) => Matrix e () ()
281253unitM = one 1
282254
283255-- | Applicative instance equivalent 'unit' function,
284−multM ::
285− ( CountableDimsN a b,
286− CountableN (a, b),
256+multM ::
257+ ( KnownNat (I.Count (I.Normalize a)),
258+ KnownNat (I.Count (I.Normalize b)),
259+ KnownNat (I.Count (I.Normalize (a, b))),
287260 Num e,
288− FLN (a, b) a,
289− FLN (a, b) b,
290− TrivialP a b
261+ I.FromLists e (I.Normalize (a, b)) (I.Normalize a),
262+ I.FromLists e (I.Normalize (a, b)) (I.Normalize b),
263+ I.Normalize (a, b) ~ I.Normalize (I.Normalize a, I.Normalize b)
291264 ) => Matrix e c a -> Matrix e c b -> Matrix e c (a, b)
292−multM = kr
265+multM a b = khatri a b
266+
293267
294268-- | Monad instance equivalent 'return' function,
295−returnM ::
296− forall e a .
297− ( Num e,
298− Enum e,
299− Enum a,
300− FLN () a,
301− Countable a
269+returnM ::
270+ forall e a .
271+ ( Num e,
272+ Enum e,
273+ Enum a,
274+ I.FromLists e () (I.Normalize a),
275+ KnownNat (I.Count a)
302276 ) => a -> Matrix e One a
303277returnM a = col l
304278 where
@@ -314,64 +288,73 @@ bindM = flip comp
314288
315289-- | Build a matrix out of a list of list of elements. Throws a runtime
316290-- error if the dimensions do not match.
317−fromLists :: (FLN cols rows) => [[e]] -> Matrix e cols rows
291+fromLists :: (I.FromLists e (I.Normalize cols) (I.Normalize rows)) => [[e]] -> Matrix e cols rows
318292fromLists = M . I.fromLists
319293
320294-- | Matrix builder function. Constructs a matrix provided with
321−-- a construction function that operates with indices.
322−matrixBuilder' ::
323− (FLN cols rows, CountableDimsN cols rows )
324− => ((Int, Int) -> e) -> Matrix e cols rows
325−matrixBuilder' = M . I.matrixBuilder'
326−
327−-- | Matrix builder function. Constructs a matrix provided with
328−-- a construction function that operates with arbitrary types.
295+-- a construction function.
329296matrixBuilder ::
330− ( FLN a b,
331− Enum a,
332− Enum b,
333− Bounded a,
334− Bounded b,
335− Eq a,
336− Countable b
337− ) => ((a, b) -> e) -> Matrix e a b
338−matrixBuilder f = M (I.matrixBuilder f)
297+ (I.FromLists e (I.Normalize cols) (I.Normalize rows), KnownNat (I.Count (I.Normalize cols)), KnownNat (I.Count (I.Normalize rows))) =>
298+ ((Int, Int) -> e) ->
299+ Matrix e cols rows
300+matrixBuilder = M . I.matrixBuilder
339301
340302-- | Constructs a column vector matrix
341−col :: (FLN () rows) => [e] -> Matrix e One rows
303+col :: (I.FromLists e () (I.Normalize rows)) => [e] -> Matrix e One rows
342304col = M . I.col
343305
344306-- | Constructs a row vector matrix
345−row :: (FLN cols ()) => [e] -> Matrix e cols One
307+row :: (I.FromLists e (I.Normalize cols) ()) => [e] -> Matrix e cols One
346308row = M . I.row
347309
348310-- | Lifts functions to matrices with arbitrary dimensions.
349311--
350312-- NOTE: Be careful to not ask for a matrix bigger than the cardinality of
351313-- types @a@ or @b@ allows.
352−fromF' ::
353− ( Liftable e a b,
354− CountableDimsN cols rows,
355− FLN rows cols
314+fromF ::
315+ ( Bounded a,
316+ Bounded b,
317+ Enum a,
318+ Enum b,
319+ Eq b,
320+ Num e,
321+ Ord e,
322+ KnownNat (I.Count (I.Normalize cols)),
323+ KnownNat (I.Count (I.Normalize rows)),
324+ I.FromLists e (I.Normalize rows) (I.Normalize cols)
356325 ) =>
357− (a -> b) -> Matrix e cols rows
358−fromF' = M . I.fromF'
326+ (a -> b) ->
327+ Matrix e cols rows
328+fromF = M . I.fromF
359329
360330-- | Lifts functions to matrices with dimensions matching @a@ and @b@
361331-- cardinality's.
362−fromF ::
363− ( Liftable e a b,
364− CountableDimsN a b,
365− FLN b a
332+fromF' ::
333+ ( Bounded a,
334+ Bounded b,
335+ Enum a,
336+ Enum b,
337+ Eq b,
338+ Num e,
339+ Ord e,
340+ KnownNat (I.Count (I.Normalize a)),
341+ KnownNat (I.Count (I.Normalize b)),
342+ I.FromLists e (I.Normalize b) (I.Normalize a)
366343 ) =>
367− (a -> b) -> Matrix e a b
368−fromF = M . I.fromF
344+ (a -> b) ->
345+ Matrix e a b
346+fromF' = M . I.fromF'
369347
370348-- | Lifts relation functions to Boolean Matrix
371349toRel ::
372− ( Liftable (Natural 0 1) a b,
373− CountableDims a b,
374− FLN b a
350+ ( Bounded a,
351+ Bounded b,
352+ Enum a,
353+ Enum b,
354+ Eq b,
355+ KnownNat (I.Count (I.Normalize a)),
356+ KnownNat (I.Count (I.Normalize b)),
357+ I.FromLists (Natural 0 1) (I.Normalize b) (I.Normalize a)
375358 ) => (a -> b -> Bool) -> Matrix (Natural 0 1) a b
376359toRel = M . I.toRel
377360
@@ -389,8 +372,8 @@ toList (M m) = I.toList m
389372
390373-- | The zero matrix. A matrix wholly filled with zeros.
391374zeros ::
392− (Num e, FLN cols rows, CountableDimsN cols rows)
393− => Matrix e cols rows
375+ (Num e, I.FromLists e (I.Normalize cols) (I.Normalize rows), KnownNat (I.Count (I.Normalize cols)), KnownNat (I.Count (I.Normalize rows))) =>
376+ Matrix e cols rows
394377zeros = M I.zeros
395378
396379-- Ones Matrix
@@ -399,8 +382,8 @@ zeros = M I.zeros
399382--
400383-- Also known as T (Top) matrix.
401384ones ::
402− (Num e, FLN cols rows, CountableDimsN cols rows)
403− => Matrix e cols rows
385+ (Num e, I.FromLists e (I.Normalize cols) (I.Normalize rows), KnownNat (I.Count (I.Normalize cols)), KnownNat (I.Count (I.Normalize rows))) =>
386+ Matrix e cols rows
404387ones = M I.ones
405388
406389-- Const Matrix
@@ -408,8 +391,9 @@ ones = M I.ones
408391-- | The constant matrix constructor. A matrix wholly filled with a given
409392-- value.
410393constant ::
411− (Num e, FLN cols rows, CountableDimsN cols rows)
412− => e -> Matrix e cols rows
394+ (Num e, I.FromLists e (I.Normalize cols) (I.Normalize rows), KnownNat (I.Count (I.Normalize cols)), KnownNat (I.Count (I.Normalize rows))) =>
395+ e ->
396+ Matrix e cols rows
413397constant = M . I.constant
414398
415399-- Bang Matrix
@@ -417,30 +401,17 @@ constant = M . I.constant
417401-- | The T (Top) row vector matrix.
418402bang ::
419403 forall e cols.
420− (Num e, Enum e, FLN cols (), CountableN cols) =>
404+ (Num e, Enum e, I.FromLists e (I.Normalize cols) (), KnownNat (I.Count (I.Normalize cols))) =>
421405 Matrix e cols One
422406bang = M I.bang
423407
424−-- | Point constant relation
425−point ::
426− ( Bounded a,
427− Enum a,
428− Eq a,
429− Num e,
430− Ord e,
431− CountableN a,
432− FLN a One
433− ) => a -> Matrix e One a
434−point = fromF . const
435−
436−-- iden Matrix
408+-- Identity Matrix
437409
438−-- | iden matrix
439−iden ::
440− (Num e, FLN a a, CountableN a) =>
410+-- | Identity matrix
411+identity ::
412+ (Num e, I.FromLists e (I.Normalize a) (I.Normalize a), KnownNat (I.Count (I.Normalize a))) =>
441413 Matrix e a a
442−iden = M I.iden
443−{-# NOINLINE iden #-}
414+identity = M I.identity
444415
445416-- Matrix composition (MMM)
446417
@@ -450,32 +421,15 @@ iden = M I.iden
450421-- from LAoP.
451422comp :: (Num e) => Matrix e cr rows -> Matrix e cols cr -> Matrix e cols rows
452423comp (M a) (M b) = M (I.comp a b)
453−{-# NOINLINE comp #-}
454−{-# RULES
455− "comp/iden1" forall m. comp m iden = m ;
456− "comp/iden2" forall m. comp iden m = m
457−#-}
458−
459−-- Scalar multiplication of matrices
460−
461−infixl 7 .|
462−-- | Scalar multiplication of matrices.
463−(.|) :: Num e => e -> Matrix e cols rows -> Matrix e cols rows
464−(.|) e (M m) = M (e I..| m)
465−
466−-- Scalar division of matrices
467−
468−infixl 7 ./
469−-- | Scalar multiplication of matrices.
470−(./) :: Fractional e => Matrix e cols rows -> e -> Matrix e cols rows
471−(./) (M m) e = M (m I../ e)
472424
473425-- | Biproduct first component projection
474426p1 ::
475427 ( Num e,
476− CountableDimsN n m,
477− FLN n m,
478− FLN m m
428+ KnownNat (I.Count (I.Normalize n)),
429+ KnownNat (I.Count (I.Normalize m)),
430+ I.FromLists e (I.Normalize n) (I.Normalize m),
431+ I.FromLists e (I.Normalize m) (I.Normalize m),
432+ I.Normalize (Either m n) ~ Either (I.Normalize m) (I.Normalize n)
479433 ) =>
480434 Matrix e (Either m n) m
481435p1 = M I.p1
@@ -483,9 +437,11 @@ p1 = M I.p1
483437-- | Biproduct second component projection
484438p2 ::
485439 ( Num e,
486− CountableDimsN n m,
487− FLN m n,
488− FLN n n
440+ KnownNat (I.Count (I.Normalize n)),
441+ KnownNat (I.Count (I.Normalize m)),
442+ I.FromLists e (I.Normalize m) (I.Normalize n),
443+ I.FromLists e (I.Normalize n) (I.Normalize n),
444+ I.Normalize (Either m n) ~ Either (I.Normalize m) (I.Normalize n)
489445 ) =>
490446 Matrix e (Either m n) n
491447p2 = M I.p2
@@ -495,9 +451,11 @@ p2 = M I.p2
495451-- | Biproduct first component injection
496452i1 ::
497453 ( Num e,
498− CountableDimsN n m,
499− FLN n m,
500− FLN m m
454+ KnownNat (I.Count (I.Normalize n)),
455+ KnownNat (I.Count (I.Normalize m)),
456+ I.FromLists e (I.Normalize n) (I.Normalize m),
457+ I.FromLists e (I.Normalize m) (I.Normalize m),
458+ I.Normalize (Either m n) ~ Either (I.Normalize m) (I.Normalize n)
501459 ) =>
502460 Matrix e m (Either m n)
503461i1 = tr p1
@@ -505,9 +463,11 @@ i1 = tr p1
505463-- | Biproduct second component injection
506464i2 ::
507465 ( Num e,
508− CountableDimsN n m,
509− FLN m n,
510− FLN n n
466+ KnownNat (I.Count (I.Normalize n)),
467+ KnownNat (I.Count (I.Normalize m)),
468+ I.FromLists e (I.Normalize m) (I.Normalize n),
469+ I.FromLists e (I.Normalize n) (I.Normalize n),
470+ I.Normalize (Either m n) ~ Either (I.Normalize m) (I.Normalize n)
511471 ) =>
512472 Matrix e n (Either m n)
513473i2 = tr p2
@@ -516,34 +476,24 @@ i2 = tr p2
516476
517477-- | Obtain the number of rows.
518478--
519−-- NOTE: The 'KnownNat' constraint is needed in order to obtain the
520−-- dimensions in constant time. For a version that doesn't require the
521−-- constraint see 'rows''.
522−rows :: (CountableN rows) => Matrix e cols rows -> Int
523−rows (M m) = I.rows m
524−
525−-- | Obtain the number of rows in an inefficient manner, but without any
526−-- constraints.
479+-- NOTE: The 'KnownNat' constaint is needed in order to obtain the
480+-- dimensions in constant time.
527481--
528−-- For a more efficient version see 'rows'.
529−rows' :: Matrix e cols rows -> Int
530−rows' (M m) = I.rows' m
482+-- TODO: A 'rows' function that does not need the 'KnownNat' constraint in
483+-- exchange for performance.
484+rows :: (KnownNat (I.Count (I.Normalize rows))) => Matrix e cols rows -> Int
485+rows (M m) = I.rows m
531486
532487-- | Obtain the number of columns.
488+--
489+-- NOTE: The 'KnownNat' constaint is needed in order to obtain the
490+-- dimensions in constant time.
533491--
534−-- NOTE: The 'KnownNat' constraint is needed in order to obtain the
535−-- dimensions in constant time. For a version that doesn't require the
536−-- constraint see 'columns''.
537−columns :: (CountableN cols) => Matrix e cols rows -> Int
492+-- TODO: A 'columns' function that does not need the 'KnownNat' constraint in
493+-- exchange for performance.
494+columns :: (KnownNat (I.Count (I.Normalize cols))) => Matrix e cols rows -> Int
538495columns (M m) = I.columns m
539496
540−-- | Obtain the number of columns in an inefficient manner, but without any
541−-- constraints.
542−--
543−-- For a more efficient version see 'columns'.
544−columns' :: Matrix e cols rows -> Int
545−columns' (M m) = I.columns' m
546−
547497-- Coproduct Bifunctor
548498
549499infixl 5 -|-
@@ -551,11 +501,14 @@ infixl 5 -|-
551501-- | Matrix coproduct functor also known as matrix direct sum.
552502(-|-) ::
553503 ( Num e,
554− CountableDimsN j k,
555− FLN k k,
556− FLN j k,
557− FLN k j,
558− FLN j j
504+ KnownNat (I.Count (I.Normalize j)),
505+ KnownNat (I.Count (I.Normalize k)),
506+ I.FromLists e (I.Normalize k) (I.Normalize k),
507+ I.FromLists e (I.Normalize j) (I.Normalize k),
508+ I.FromLists e (I.Normalize k) (I.Normalize j),
509+ I.FromLists e (I.Normalize j) (I.Normalize j),
510+ I.Normalize (Either n m) ~ Either (I.Normalize n) (I.Normalize m),
511+ I.Normalize (Either k j) ~ Either (I.Normalize k) (I.Normalize j)
559512 ) =>
560513 Matrix e n k ->
561514 Matrix e m j ->
@@ -565,98 +518,104 @@ infixl 5 -|-
565518-- Khatri Rao Product and projections
566519
567520-- | Khatri Rao product first component projection matrix.
568−fstM ::
521+kp1 ::
569522 forall e m k .
570523 ( Num e,
571− CountableDimsN m k,
572− CountableN (m, k),
573− FLN (m, k) m,
574− TrivialP m k
524+ KnownNat (I.Count (I.Normalize m)),
525+ KnownNat (I.Count (I.Normalize k)),
526+ KnownNat (I.Count (I.Normalize (m, k))),
527+ I.FromLists e (I.Normalize (m, k)) (I.Normalize m),
528+ I.Normalize (m, k) ~ I.Normalize (I.Normalize m, I.Normalize k)
575529 ) => Matrix e (m, k) m
576−fstM = M (I.fstM @e @(I.Normalize m) @(I.Normalize k))
530+kp1 = M (I.kp1 @e @(I.Normalize m) @(I.Normalize k))
577531
578532-- | Khatri Rao product second component projection matrix.
579−sndM ::
533+kp2 ::
580534 forall e m k.
581535 ( Num e,
582− CountableDimsN k m,
583− CountableN (m, k),
584− FLN (m, k) k,
585− TrivialP m k
536+ KnownNat (I.Count (I.Normalize k)),
537+ KnownNat (I.Count (I.Normalize m)),
538+ KnownNat (I.Count (I.Normalize (m, k))),
539+ I.FromLists e (I.Normalize (m, k)) (I.Normalize k),
540+ I.Normalize (m, k) ~ I.Normalize (I.Normalize m, I.Normalize k)
586541 ) => Matrix e (m, k) k
587−sndM = M (I.sndM @e @(I.Normalize m) @(I.Normalize k))
542+kp2 = M (I.kp2 @e @(I.Normalize m) @(I.Normalize k))
588543
589544-- | Khatri Rao Matrix product also known as matrix pairing.
590545--
591546-- NOTE: That this is not a true categorical product, see for instance:
592−--
547+--
593548-- @
594−-- | fstM . kr a b == a
595−-- kr a b ==> |
596−-- | sndM . kr a b == b
549+-- | kp1 `comp` khatri a b == a
550+-- khatri a b ==> |
551+-- | kp2 `comp` khatri a b == b
597552-- @
598553--
599554-- __Emphasis__ on the implication symbol.
600−kr ::
555+khatri ::
601556 forall e cols a b.
602557 ( Num e,
603− CountableDimsN a b,
604− CountableN (a, b),
605− FLN (a, b) a,
606− FLN (a, b) b,
607− TrivialP a b
558+ KnownNat (I.Count (I.Normalize a)),
559+ KnownNat (I.Count (I.Normalize b)),
560+ KnownNat (I.Count (I.Normalize (a, b))),
561+ I.FromLists e (I.Normalize (a, b)) (I.Normalize a),
562+ I.FromLists e (I.Normalize (a, b)) (I.Normalize b),
563+ I.Normalize (a, b) ~ I.Normalize (I.Normalize a, I.Normalize b)
608564 ) => Matrix e cols a -> Matrix e cols b -> Matrix e cols (a, b)
609−kr a b =
610− let fstM' = fstM @e @a @b
611− sndM' = sndM @e @a @b
612− in comp (tr fstM') a * comp (tr sndM') b
565+khatri a b =
566+ let kp1' = kp1 @e @a @b
567+ kp2' = kp2 @e @a @b
568+ in comp (tr kp1') a * comp (tr kp2') b
613569
614570-- Product Bifunctor (Kronecker)
615571
616572infixl 4 ><
617573
618−-- | Matrix product functor also known as Kronecker product
574+-- | Matrix product functor also known as kronecker product
619575(><) ::
620576 forall e m p n q.
621577 ( Num e,
622− CountableDimsN m n,
623− CountableDimsN p q,
624− CountableDimsN (m, n) (p, q),
625− FLN (m, n) m,
626− FLN (m, n) n,
627− FLN (p, q) p,
628− FLN (p, q) q,
629− TrivialP m n,
630− TrivialP p q
578+ KnownNat (I.Count (I.Normalize m)),
579+ KnownNat (I.Count (I.Normalize n)),
580+ KnownNat (I.Count (I.Normalize p)),
581+ KnownNat (I.Count (I.Normalize q)),
582+ KnownNat (I.Count (I.Normalize (m, n))),
583+ KnownNat (I.Count (I.Normalize (p, q))),
584+ I.FromLists e (I.Normalize (m, n)) (I.Normalize m),
585+ I.FromLists e (I.Normalize (m, n)) (I.Normalize n),
586+ I.FromLists e (I.Normalize (p, q)) (I.Normalize p),
587+ I.FromLists e (I.Normalize (p, q)) (I.Normalize q),
588+ I.Normalize (m, n) ~ I.Normalize (I.Normalize m, I.Normalize n),
589+ I.Normalize (p, q) ~ I.Normalize (I.Normalize p, I.Normalize q)
631590 ) => Matrix e m p -> Matrix e n q -> Matrix e (m, n) (p, q)
632591(><) a b =
633− let fstM' = fstM @e @m @n
634− sndM' = sndM @e @m @n
635− in kr (comp a fstM') (comp b sndM')
592+ let kp1' = kp1 @e @m @n
593+ kp2' = kp2 @e @m @n
594+ in khatri (comp a kp1') (comp b kp2')
636595
637−-- Matrix abide Join Fork
596+-- Matrix abide Junc Split
638597
639−-- | Matrix "abiding" followin the 'Join'-'Fork' abide law.
640−--
598+-- | Matrix "abiding" followin the 'Junc'-'Split' abide law.
599+--
641600-- Law:
642601--
643602-- @
644−-- 'Join' ('Fork' a c) ('Fork' b d) == 'Fork' ('Join' a b) ('Join' c d)
603+-- 'Junc' ('Split' a c) ('Split' b d) == 'Split' ('Junc' a b) ('Junc' c d)
645604-- @
646−abideJF :: Matrix e cols rows -> Matrix e cols rows
647−abideJF (M m) = M (I.abideJF m)
605+abideJS :: Matrix e cols rows -> Matrix e cols rows
606+abideJS (M m) = M (I.abideJS m)
648607
649−-- Matrix abide Fork Join
608+-- Matrix abide Split Junc
650609
651−-- | Matrix "abiding" followin the 'Fork'-'Join' abide law.
652−--
610+-- | Matrix "abiding" followin the 'Split'-'Junc' abide law.
611+--
653612-- Law:
654613--
655614-- @
656−-- 'Fork' ('Join' a b) ('Join' c d) == 'Join' ('Fork' a c) ('Fork' b d)
615+-- 'Split' ('Junc' a b) ('Junc' c d) == 'Junc' ('Split' a c) ('Split' b d)
657616-- @
658−abideFJ :: Matrix e cols rows -> Matrix e cols rows
659−abideFJ (M m) = M (I.abideFJ m)
617+abideSJ :: Matrix e cols rows -> Matrix e cols rows
618+abideSJ (M m) = M (I.abideSJ m)
660619
661620-- Matrix transposition
662621
@@ -668,10 +627,11 @@ tr (M m) = M (I.tr m)
668627
669628-- | Selective functors 'select' operator equivalent inspired by the
670629-- ArrowMonad solution presented in the paper.
671−selectM ::
630+selectM ::
672631 ( Num e,
673− FLN b b,
674− CountableN b
632+ I.FromLists e (I.Normalize b) (I.Normalize b),
633+ KnownNat (I.Count (I.Normalize b)),
634+ I.Normalize (Either a b) ~ Either (I.Normalize a) (I.Normalize b)
675635 ) => Matrix e cols (Either a b) -> Matrix e a b -> Matrix e cols b
676636selectM (M m) (M y) = M (I.select m y)
677637
@@ -679,14 +639,15 @@ selectM (M m) (M y) = M (I.select m y)
679639
680640-- | McCarthy's Conditional expresses probabilistic choice.
681641cond ::
682− ( Trivial a,
683− Trivial2 a,
684− Trivial3 a,
685− CountableN a,
686− FLN () a,
687− FLN a (),
688− FLN a a,
689− Liftable e a Bool
642+ ( I.Normalize (I.Normalize a) ~ I.Normalize a,
643+ KnownNat (I.Count (I.Normalize a)),
644+ I.FromLists e () (I.Normalize a),
645+ I.FromLists e (I.Normalize a) (),
646+ I.FromLists e (I.Normalize a) (I.Normalize a),
647+ Bounded a,
648+ Enum a,
649+ Num e,
650+ Ord e
690651 )
691652 =>
692653 (a -> Bool) -> Matrix e a b -> Matrix e a b -> Matrix e a b
@@ -695,13 +656,9 @@ cond p (M a) (M b) = M (I.cond p a b)
695656-- Pretty print
696657
697658-- | Matrix pretty printer
698−pretty :: (CountableDimsN cols rows, Show e) => Matrix e cols rows -> String
659+pretty :: (KnownNat (I.Count (I.Normalize cols)), Show e) => Matrix e cols rows -> String
699660pretty (M m) = I.pretty m
700661
701662-- | Matrix pretty printer
702−prettyPrint :: (CountableDimsN cols rows, Show e) => Matrix e cols rows -> IO ()
663+prettyPrint :: (KnownNat (I.Count (I.Normalize cols)), Show e) => Matrix e cols rows -> IO ()
703664prettyPrint (M m) = I.prettyPrint m
704−
705−-- | Zip two matrices with a given binary function
706−zipWithM :: (e -> f -> g) -> Matrix e a b -> Matrix f a b -> Matrix g a b
707−zipWithM f (M a) (M b) = M (I.zipWithM f a b)
src/LAoP/Relation.hs+7−34
@@ -30,21 +30,12 @@ module LAoP.Relation
3030 Relation (..),
3131 Boolean,
3232
33− -- * Constraint type synonyms
34− Countable,
35− CountableDims,
36− CountableN,
37− CountableDimsN,
38− FLN,
39− Liftable,
40− Trivial,
41− TrivialP,
42−
4333 -- * Primitives
34+ empty,
4435 one,
45− join,
36+ junc,
4637 (|||),
47− fork,
38+ split,
4839 (===),
4940
5041 -- * Auxiliary type families
@@ -62,7 +53,6 @@ module LAoP.Relation
6253 toList,
6354 toBool,
6455 pt,
65− belongs,
6656 relationBuilder,
6757 zeros,
6858 ones,
@@ -90,25 +80,15 @@ module LAoP.Relation
9080 injection,
9181 surjection,
9282 bijection,
93− domain,
94− range,
9583
9684 -- * Function division
9785 divisionF,
9886
99− -- * Relation division
100− divR,
101− divL,
102− divS,
103− shrunkBy,
104− overriddenBy,
105−
10687 -- * Relational pairing
10788 splitR,
108−
10989 -- ** Projections
110− fstR,
111− sndR,
90+ p1,
91+ p2,
11292 -- ** Bifunctor
11393 (><),
11494 -- * Relational coproduct
@@ -136,25 +116,18 @@ module LAoP.Relation
136116 linearOrder,
137117 equivalence,
138118 partialEquivalence,
139− difunctional,
140−
141− -- * Conditionals
142− equalizer,
143119
144120 -- ** McCarthy's Conditional
145− predR,
146− guard,
147− cond,
121+ -- cond,
148122
149123 -- * Relational composition and lifting
150− iden,
124+ identity,
151125 comp,
152126 fromF,
153127 fromF',
154128
155129 -- ** Relational application
156130 pointAp,
157− pointApBool,
158131
159132 -- * Matrix printing
160133 pretty,
src/LAoP/Relation/Internal.hs+317−486
@@ -1,5 +1,3 @@
1−{-# LANGUAGE TypeFamilies #-}
2−{-# LANGUAGE ConstraintKinds #-}
31{-# LANGUAGE GADTs #-}
42{-# LANGUAGE UndecidableInstances #-}
53{-# LANGUAGE FlexibleContexts #-}
@@ -41,21 +39,12 @@ module LAoP.Relation.Internal
4139 Relation (..),
4240 Boolean,
4341
44− -- * Constraint type synonyms
45− Countable,
46− CountableDims,
47− CountableN,
48− CountableDimsN,
49− FLN,
50− Liftable,
51− Trivial,
52− TrivialP,
53−
5442 -- * Primitives
43+ empty,
5544 one,
56− join,
45+ junc,
5746 (|||),
58− fork,
47+ split,
5948 (===),
6049
6150 -- * Auxiliary type families
@@ -66,15 +55,13 @@ module LAoP.Relation.Internal
6655 -- * Matrix construction and conversion
6756 I.FromLists,
6857 fromLists,
69− fromF',
7058 fromF,
59+ fromF',
7160 toRel,
7261 toLists,
7362 toList,
7463 toBool,
7564 pt,
76− belongs,
77− relationBuilder',
7865 relationBuilder,
7966 zeros,
8067 ones,
@@ -102,8 +89,6 @@ module LAoP.Relation.Internal
10289 injection,
10390 surjection,
10491 bijection,
105− domain,
106− range,
10792
10893 -- * Function division
10994 divisionF,
@@ -119,8 +104,8 @@ module LAoP.Relation.Internal
119104 splitR,
120105
121106 -- ** Projections
122− fstR,
123− sndR,
107+ p1,
108+ p2,
124109 -- ** Bifunctor
125110 (><),
126111 -- * Relational coproduct
@@ -148,7 +133,6 @@ module LAoP.Relation.Internal
148133 linearOrder,
149134 equivalence,
150135 partialEquivalence,
151− difunctional,
152136
153137 -- * Conditionals
154138 equalizer,
@@ -159,10 +143,10 @@ module LAoP.Relation.Internal
159143 cond,
160144
161145 -- * Relational composition and lifting
162− iden,
146+ identity,
163147 comp,
164− fromF',
165148 fromF,
149+ fromF',
166150
167151 -- ** Relational application
168152 pointAp,
@@ -178,13 +162,12 @@ import Data.Void
178162import qualified LAoP.Matrix.Internal as I
179163import LAoP.Utils.Internal
180164import Control.DeepSeq
165+import qualified Control.Category as C
181166import Data.Bool
182167import GHC.TypeLits
183−import Prelude hiding (id, (.))
184168
185169-- | Boolean type synonym for working with boolean matrices
186170type Boolean = Natural 0 1
187−type Powerset a = List (List a)
188171
189172-- | Relation data type.
190173newtype Relation a b = R (I.Matrix Boolean (I.Normalize a) (I.Normalize b))
@@ -192,34 +175,25 @@ newtype Relation a b = R (I.Matrix Boolean (I.Normalize a) (I.Normalize b))
192175
193176deriving instance (Read (I.Matrix Boolean (I.Normalize a) (I.Normalize b))) => Read (Relation a b)
194177
195−-- | Constraint type synonyms to keep the type signatures less convoluted
196−type Countable a = KnownNat (I.Count a)
197−type CountableDims a b = (Countable a, Countable b)
198−type CountableN a = KnownNat (I.Count (I.Normalize a))
199−type CountableDimsN a b = (CountableN a, CountableN b)
200−type FLN a b = I.FromLists (I.Normalize a) (I.Normalize b)
201−type Liftable a b = (Bounded a, Bounded b, Enum a, Enum b, Eq b, Num Boolean, Ord Boolean)
202−type Trivial a = I.Normalize a ~ I.Normalize (I.Normalize a)
203−type TrivialP a b = I.Normalize (a, b) ~ I.Normalize (I.Normalize a, I.Normalize b)
204−
205−-- | It is possible to implement a constrained version of the category type
206−-- class.
207−instance Category Relation where
208− type Object Relation a = (FLN a a, CountableN a)
209− id = iden
210− (.) = comp
178+-- | It isn't possible to implement the 'id' function so it's
179+-- implementation is 'undefined'. However 'comp' can be and this partial
180+-- class implementation exists just to make the code more readable.
181+--
182+-- Please use 'identity' instead.
183+instance C.Category Relation where
184+ id = undefined
185+ (.) = comp
211186
212187instance Num (Relation a b) where
213− -- | Matrix addition becomes Boolean matrix disjointion
188+ -- | Matrix addition becomes Boolean matrix disjunction
214189 (R a) + (R b) = R (I.orM a b)
215190
216191 -- | Matrix subtraction becomes Relational subtraction
217192 (R a) - (R b) = R (I.subM a b)
218193
219− -- | Matrix multiplication becomes Boolean matrix conjointion
194+ -- | Matrix multiplication becomes Boolean matrix conjunction
220195 (R a) * (R b) = R (I.andM a b)
221196
222− -- | Matrix negation becomes Boolean matrix negation
223197 negate (R a) = R (I.negateM a)
224198
225199-- Type alias
@@ -228,107 +202,105 @@ type One = ()
228202
229203-- Primitives
230204
205+-- | Empty matrix constructor
206+empty :: Relation Zero Zero
207+empty = R I.Empty
208+
231209-- | Unit matrix constructor
232210one :: Boolean -> Relation One One
233211one = R . I.One
234212
235−-- | Boolean Matrix 'Join' constructor, also known as relational coproduct.
213+-- | Boolean Matrix 'Junc' constructor, also known as relational coproduct.
236214--
237215-- See 'eitherR'.
238−join :: Relation a c -> Relation b c -> Relation (Either a b) c
239−join (R a) (R b) = R (I.Join a b)
216+junc :: (I.Normalize (Either a b) ~ Either (I.Normalize a) (I.Normalize b))
217+ => Relation a c -> Relation b c -> Relation (Either a b) c
218+junc (R a) (R b) = R (I.Junc a b)
240219
241220infixl 3 |||
242−-- | Boolean Matrix 'Join' constructor
243−--
244−-- See 'eitherR'.
221+-- | Boolean Matrix 'Junc' constructor
245222(|||) ::
223+ (I.Normalize (Either a b) ~ Either (I.Normalize a) (I.Normalize b)) =>
246224 Relation a c ->
247225 Relation b c ->
248226 Relation (Either a b) c
249−(|||) = join
227+(|||) = junc
250228
251−-- | Boolean Matrix 'Fork' constructor, also known as relational product.
252−fork :: Relation c a -> Relation c b -> Relation c (Either a b)
253−fork (R a) (R b) = R (I.Fork a b)
229+-- | Boolean Matrix 'Split' constructor, also known as relational product.
230+split :: (I.Normalize (Either a b) ~ Either (I.Normalize a) (I.Normalize b))
231+ => Relation c a -> Relation c b -> Relation c (Either a b)
232+split (R a) (R b) = R (I.Split a b)
254233
255234infixl 2 ===
256−-- | Boolean Matrix 'Fork' constructor
235+-- | Boolean Matrix 'Split' constructor
257236(===) ::
237+ (I.Normalize (Either a b) ~ Either (I.Normalize a) (I.Normalize b)) =>
258238 Relation c a ->
259239 Relation c b ->
260240 Relation c (Either a b)
261−(===) = fork
241+(===) = split
262242
263243-- Construction
264244
265245-- | Build a matrix out of a list of list of elements. Throws a runtime
266246-- error if the dimensions do not match.
267−fromLists :: (FLN a b) => [[Boolean]] -> Relation a b
247+fromLists :: (I.FromLists Boolean (I.Normalize a) (I.Normalize b)) => [[Boolean]] -> Relation a b
268248fromLists = R . I.fromLists
269249
270−-- | Relation builder function. Constructs a relation provided with
271−-- a construction function that operates with indices.
272−relationBuilder' ::
273− (FLN a b, CountableDimsN a b) =>
274− ((Int, Int) -> Boolean) -> Relation a b
275−relationBuilder' = R . I.matrixBuilder'
276−
277−-- | Relation builder function. Constructs a relation provided with
278−-- a construction function that operates with arbitrary types.
250+-- | Matrix builder function. Constructs a matrix provided with
251+-- a construction function.
279252relationBuilder ::
280− ( FLN a b,
281− Enum a,
282− Enum b,
283− Bounded a,
284− Bounded b,
285− Eq a,
286− CountableDims a b
287− ) => ((a, b) -> Boolean) -> Relation a b
253+ (I.FromLists Boolean (I.Normalize a) (I.Normalize b), KnownNat (I.Count (I.Normalize a)), KnownNat (I.Count (I.Normalize b))) =>
254+ ((Int, Int) -> Boolean) ->
255+ Relation a b
288256relationBuilder = R . I.matrixBuilder
289257
290258-- | Lifts functions to matrices with arbitrary dimensions.
291259--
292260-- NOTE: Be careful to not ask for a matrix bigger than the cardinality of
293261-- types @a@ or @b@ allows.
294−fromF' ::
295− ( Liftable a b,
296− CountableDimsN c d,
297− FLN d c
262+fromF ::
263+ ( Bounded a,
264+ Bounded b,
265+ Enum a,
266+ Enum b,
267+ Eq b,
268+ KnownNat (I.Count (I.Normalize c)),
269+ KnownNat (I.Count (I.Normalize d)),
270+ I.FromLists Boolean (I.Normalize d) (I.Normalize c)
298271 )
299272 => (a -> b) -> Relation c d
300−fromF' f = R (I.fromFRel' f)
273+fromF f = R (I.fromFRel f)
301274
302275-- | Lifts functions to matrices with dimensions matching @a@ and @b@
303276-- cardinality's.
304−fromF ::
305− ( Liftable a b,
306− CountableDimsN a b,
307− FLN b a
277+fromF' ::
278+ ( Bounded b,
279+ Bounded a,
280+ Enum a,
281+ Enum b,
282+ Eq b,
283+ KnownNat (I.Count (I.Normalize a)),
284+ KnownNat (I.Count (I.Normalize b)),
285+ I.FromLists Boolean (I.Normalize b) (I.Normalize a)
308286 )
309287 => (a -> b) -> Relation a b
310−fromF f = R (I.fromFRel f)
288+fromF' f = R (I.fromFRel' f)
311289
312290-- | Lifts relation functions to 'Relation'
313291toRel ::
314− ( Liftable a b,
315− CountableDims a b,
316− FLN b a
292+ ( Bounded b,
293+ Bounded a,
294+ Enum a,
295+ Enum b,
296+ Eq b,
297+ KnownNat (I.Count (I.Normalize a)),
298+ KnownNat (I.Count (I.Normalize b)),
299+ I.FromLists Boolean (I.Normalize b) (I.Normalize a)
317300 )
318− => (a -> b -> Bool) -> Relation a b
301+ => (a -> b -> Bool) -> Relation a b
319302toRel = R . I.toRel
320303
321−-- | Lowers a 'Relation' to a function
322−fromRel ::
323− ( Liftable a b,
324− Eq a,
325− CountableDimsN a b,
326− FLN a One,
327− FLN b One
328− )
329− => Relation a b -> (a -> b -> Bool)
330−fromRel r a b = pointApBool a b r
331−
332304-- Conversion
333305
334306-- | Converts a matrix to a list of lists of elements.
@@ -339,135 +311,93 @@ toLists (R m) = I.toLists m
339311toList :: Relation a b -> [Boolean]
340312toList (R m) = I.toList m
341313
342−-- | Converts a well typed 'Relation' to 'Bool'.
314+-- | Converts a well typed @'Relation'@ to @'Bool'@.
343315toBool :: Relation One One -> Bool
344316toBool r = case toList r of
345317 [Nat 0] -> False
346318 _ -> True
347319
348−-- | Power transpose.
349−--
350−-- Maps a relation to a set valued function.
351−pt ::
352− ( Liftable a b,
320+-- | Power transpose
321+pt ::
322+ ( Bounded a,
323+ Bounded b,
324+ Enum a,
325+ Enum b,
353326 Eq a,
354− CountableDimsN a b,
355− FLN a One,
356− FLN b One
327+ Eq b,
328+ KnownNat (I.Count (I.Normalize a)),
329+ KnownNat (I.Count (I.Normalize b)),
330+ I.FromLists Boolean (I.Normalize a) One,
331+ I.FromLists Boolean (I.Normalize b) One
357332 )
358− => Relation a b -> (a -> List b)
333+ => Relation a b -> (a -> [b])
359334pt r a =
360− let (L lb) = maxBound
361− in L [ b | b <- lb, toBool (pointAp a b r) ]
362−
363−-- | Belongs relation
364−belongs ::
365− ( Bounded a,
366− Enum a,
367− Eq a,
368− CountableDims (List a) a,
369− FLN a (List a)
370− )
371− => Relation (List a) a
372−belongs = toRel elemR
373− where
374− elemR (L l) x = x `elem` l
335+ let lb = [minBound .. maxBound]
336+ in [ b | b <- lb, toBool (pointAp a b r) ]
375337
376338-- Zeros Matrix
377339
378−-- | The zero relation. A relation where no element of type @a@ relates
379−-- with elements of type @b@.
380−--
381−-- Also known as ⊥ (Bottom) Relation.
382−--
383−-- @
384−-- r `.` ⊥ == ⊥ `.` r == ⊥
385−-- ⊥ ``sse`` R && R ``sse`` T == True
386−-- @
340+-- | The zero matrix. A matrix wholly filled with zeros.
387341zeros ::
388− (FLN a b, CountableDimsN a b) =>
342+ (I.FromLists Boolean (I.Normalize a) (I.Normalize b), KnownNat (I.Count (I.Normalize a)), KnownNat (I.Count (I.Normalize b))) =>
389343 Relation a b
390−zeros = relationBuilder' (const (nat 0))
344+zeros = relationBuilder (const (nat 0))
391345
392346-- Ones Matrix
393347
394−-- | The ones relation. A relation where every element of type @a@ relates
395−-- with every element of type @b@.
396−--
397−-- Also known as T (Top) Relation or universal Relation.
348+-- | The ones matrix. A matrix wholly filled with ones.
398349--
399−-- @
400−-- ⊥ ``sse`` R && R ``sse`` T == True
401−-- @
350+-- Also known as T (Top) matrix.
402351ones ::
403− (FLN a b, CountableDimsN a b) =>
352+ (I.FromLists Boolean (I.Normalize a) (I.Normalize b), KnownNat (I.Count (I.Normalize a)), KnownNat (I.Count (I.Normalize b))) =>
404353 Relation a b
405−ones = relationBuilder' (const (nat 1))
354+ones = relationBuilder (const (nat 1))
406355
407356-- Bang Matrix
408357
409−-- | The T (Top) row vector relation.
358+-- | The T (Top) row vector matrix.
410359bang ::
411− (FLN a One, CountableN a) =>
360+ (I.FromLists Boolean (I.Normalize a) One, KnownNat (I.Count (I.Normalize a))) =>
412361 Relation a One
413362bang = ones
414363
415364-- | Point constant relation
416−point ::
365+point ::
417366 ( Bounded a,
418367 Enum a,
419368 Eq a,
420− CountableN a,
421− FLN a One
369+ KnownNat (I.Count (I.Normalize a)),
370+ I.FromLists Boolean (I.Normalize a) One
422371 ) => a -> Relation One a
423−point = fromF . const
372+point = fromF' . const
424373
425−-- iden Matrix
374+-- Identity Matrix
426375
427−-- | iden matrix
428−--
429−-- @
430−-- 'iden' `.` r == r == r `.` 'iden'
431−-- @
432−iden ::
433− (FLN a a, CountableN a) => Relation a a
434−iden = relationBuilder' (bool (nat 0) (nat 1) . uncurry (==))
376+-- | Identity matrix
377+identity ::
378+ (I.FromLists Boolean (I.Normalize a) (I.Normalize a), KnownNat (I.Count (I.Normalize a))) =>
379+ Relation a a
380+identity = relationBuilder (bool (nat 0) (nat 1) . uncurry (==))
435381
436382-- | Relational composition
437−--
438−-- @
439−-- r `.` (s `.` p) = (r `.` s) `.` p
440−-- @
441383comp :: Relation b c -> Relation a b -> Relation a c
442384comp (R a) (R b) = R (I.compRel a b)
443385
444386-- | Relational right division
445−--
446−-- @'divR' x y@ is the largest relation @z@ which,
447−-- pre-composed with @y@, approximates @x@.
448387divR :: Relation b c -> Relation b a -> Relation a c
449388divR (R x) (R y) = R (I.divR x y)
450389
451390-- | Relational left division
452−--
453−-- The dual division operator:
454−--
455−-- @
456−-- 'divL' y x == 'conv' ('divR' ('conv' x) ('conv' y)
457−-- @
458391divL :: Relation c b -> Relation a b -> Relation a c
459392divL (R x) (R y) = R (I.divL x y)
460393
461394-- | Relational symmetric division
462−--
463−-- @'pointAp' c b ('divS' s r)@ means that @b@ and @c@
464−-- are related to exactly the same outputs by @r@ and by @s@.
465395divS :: Relation c a -> Relation b a -> Relation c b
466396divS (R x) (R y) = R (I.divS x y)
467397
468398-- | Relational shrinking.
469399--
470−-- @r ``shrunkBy`` s@ is the largest part of @r@ such that,
400+-- @r `'shrunkBy'` s@ is the largest part of @r@ such that,
471401-- if it yields an output for an input @x@, it must be a maximum,
472402-- with respect to @s@, among all possible outputs of @x@ by @r@.
473403shrunkBy :: Relation b a -> Relation a a -> Relation b a
@@ -475,52 +405,51 @@ shrunkBy r s = r `intersection` divR s (conv r)
475405
476406-- | Relational overriding.
477407--
478−-- @r ``overriddenBy`` s@ yields the relation which contains the
408+-- @r `'overriddenBy'` s@ yields the relation which contains the
479409-- whole of @s@ and that part of @r@ where @s@ is undefined.
480410--
481411-- @
482−-- 'zeros' ``overriddenBy`` s == s
483−-- r ``overriddenBy`` 'zeros' == r
484−-- r ``overriddenBy`` r == r
412+-- 'zeros' `'overriddenBy'` s == s
413+-- r `'overriddenBy'` 'zeros' == r
414+-- r `'overriddenBy'` r == r
485415-- @
486416overriddenBy ::
487− ( FLN b b,
488− CountableN b
417+ ( I.FromLists Boolean (I.Normalize b) (I.Normalize b),
418+ KnownNat (I.Count (I.Normalize b))
489419 ) => Relation a b -> Relation a b -> Relation a b
490420overriddenBy r s = s `union` r `intersection` divR zeros (conv s)
491421
492−-- | Relational application.
493−--
494−-- If @a@ and @b@ are related by 'Relation' @r@
495−-- then @'pointAp' a b r == 'one' ('nat' 1)@
422+-- | Relational application
496423pointAp ::
497− ( Liftable a b,
424+ ( Bounded a,
425+ Bounded b,
426+ Enum a,
427+ Enum b,
498428 Eq a,
499− CountableDimsN a b,
500− FLN a One,
501− FLN b One
429+ Eq b,
430+ KnownNat (I.Count (I.Normalize a)),
431+ KnownNat (I.Count (I.Normalize b)),
432+ I.FromLists Boolean (I.Normalize a) One,
433+ I.FromLists Boolean (I.Normalize b) One
502434 ) => a -> b -> Relation a b -> Relation One One
503−pointAp a b r = conv (point b) . r . point a
435+pointAp a b r = conv (point b) `comp` r `comp` point a
504436
505437-- | Relational application
506−--
507−-- The same as 'pointAp' but converts 'Boolean' to 'Bool'
508438pointApBool ::
509− ( Liftable a b,
439+ ( Bounded a,
440+ Bounded b,
441+ Enum a,
442+ Enum b,
510443 Eq a,
511− CountableDimsN a b,
512− FLN a One,
513− FLN b One
444+ Eq b,
445+ KnownNat (I.Count (I.Normalize a)),
446+ KnownNat (I.Count (I.Normalize b)),
447+ I.FromLists Boolean (I.Normalize a) One,
448+ I.FromLists Boolean (I.Normalize b) One
514449 ) => a -> b -> Relation a b -> Bool
515−pointApBool a b r = toBool $ conv (point b) . r . point a
450+pointApBool a b r = toBool $ conv (point b) `comp` r `comp` point a
516451
517452-- | Relational converse
518−--
519−-- Given binary 'Relation' r, writing @'pointAp' a b r@
520−-- (read: “@b@ is related to @a@ by @r@”) means the same as
521−-- @'pointAp' b a ('conv' r)@, where @'conv' r@ is said to be
522−-- the converse of @r@.
523−-- In terms of grammar, @'conv' r@ corresponds to the passive voice
524453conv :: Relation a b -> Relation b a
525454conv (R a) = R (I.tr a)
526455
@@ -538,187 +467,165 @@ iff r s = r == s
538467
539468-- | Relational intersection
540469--
541−-- Lifts pointwise conjointion.
542−--
543−-- @
544−-- (r ``intersection`` s) ``intersection`` t == r ``intersection`` (s ``intersection`` t)
545−-- x ``sse`` r ``intersection`` s == x ``intersection`` r && x ``intersection`` s
546−-- @
470+-- Lifts pointwise conjunction.
547471intersection :: Relation a b -> Relation a b -> Relation a b
548472intersection a b = a * b
549473
550474-- | Relational union
551475--
552−-- Lifts pointwise disjointion.
553−--
554−-- @
555−-- (r ``union`` s) ``union`` t == r `'union' (s ``union`` t)
556−-- r ``union`` s ``sse`` x == r ``sse`` x && s ``sse`` x
557−-- r `.` (s ``union`` t) == (r `.` s) ``union`` (r `.` t)
558−-- (s ``union`` t) `.` r == (s `.` r) ``union`` (t `.` r)
559−-- @
476+-- Lifts pointwise disjunction.
560477union :: Relation a b -> Relation a b -> Relation a b
561478union a b = a + b
562479
563480-- | Relation Kernel
564−--
565−-- @
566−-- 'ker' r == 'conv' r `.` r
567−-- 'ker' r == 'img' ('conv' r)
568−-- @
569481ker :: Relation a b -> Relation a a
570−ker r = conv r . r
482+ker r = conv r `comp` r
571483
572484-- | Relation Image
573−--
574−-- @
575−-- 'img' r == r `.` conv r
576−-- 'img' r == 'ker' ('conv' r)
577−-- @
578485img :: Relation a b -> Relation b b
579−img r = r . conv r
486+img r = r `comp` conv r
580487
581−-- | Function division. Special case of 'divS'.
488+-- | Function division.
582489--
583490-- NOTE: _This is only valid_ if @f@ and @g@ are 'function's, i.e. 'simple' and
584491-- 'entire'.
585492--
586−-- @'divisionF' f g == 'conv' g `.` f@
493+-- @division f g == conv g `'comp'` f@
587494divisionF :: Relation a c -> Relation b c -> Relation a b
588−divisionF f g = conv g . f
495+divisionF f g = conv g `comp` f
589496
590497-- Taxonomy of binary relations
591498
592−-- | A 'Relation' @r@ is 'simple' 'iff' @'coreflexive' ('img' r)@
593−simple :: (CountableN b, FLN b b) => Relation a b -> Bool
499+-- | A 'Relation' @r@ is simple iff @'coreflexive' ('img' r)@
500+simple :: (KnownNat (I.Count (I.Normalize b)), I.FromLists Boolean (I.Normalize b) (I.Normalize b)) => Relation a b -> Bool
594501simple = coreflexive . img
595502
596−-- | A 'Relation' @r@ is 'injective' 'iff' @'coreflexive' ('ker' r)@
597−injective :: (CountableN a, FLN a a) => Relation a b -> Bool
503+-- | A 'Relation' @r@ is injective iff @'coreflexive' ('ker' r)@
504+injective :: (KnownNat (I.Count (I.Normalize a)), I.FromLists Boolean (I.Normalize a) (I.Normalize a)) => Relation a b -> Bool
598505injective = coreflexive . ker
599506
600−-- | A 'Relation' @r@ is 'entire' 'iff' @'reflexive' ('ker' r)@
601−entire :: (CountableN a, FLN a a) => Relation a b -> Bool
507+-- | A 'Relation' @r@ is entire iff @'reflexive' ('ker' r)@
508+entire :: (KnownNat (I.Count (I.Normalize a)), I.FromLists Boolean (I.Normalize a) (I.Normalize a)) => Relation a b -> Bool
602509entire = reflexive . ker
603510
604−-- | A 'Relation' @r@ is 'surjective' 'iff' @'reflexive' ('img' r)@
605−surjective :: (CountableN b, FLN b b) => Relation a b -> Bool
511+-- | A 'Relation' @r@ is surjective iff @'reflexive' ('img' r)@
512+surjective :: (KnownNat (I.Count (I.Normalize b)), I.FromLists Boolean (I.Normalize b) (I.Normalize b)) => Relation a b -> Bool
606513surjective = reflexive . img
607514
608−-- | A 'Relation' @r@ is a 'function' 'iff' @'simple' r && 'entire' r@
515+-- | A 'Relation' @r@ is a function iff @'simple' r && 'entire' r@
609516--
610517-- A 'function' @f@ enjoys the following properties, where @r@ and @s@ are binary
611518-- relations:
612519--
613520-- @
614−-- f `.` r ``sse`` s == r ``sse`` f `.` s
615−-- r `.` f ``sse`` s == r ``sse`` s `.` f
521+-- f `'comp'` r `'sse'` s == r `'sse'` f `'comp'` s
522+-- r `'comp'` f `'sse'` s == r `'sse'` s `'comp'` f
616523-- @
617524function ::
618− ( CountableDimsN a b,
619− FLN a a,
620− FLN b b
525+ ( KnownNat (I.Count (I.Normalize b)),
526+ KnownNat (I.Count (I.Normalize a)),
527+ I.FromLists Boolean (I.Normalize a) (I.Normalize a),
528+ I.FromLists Boolean (I.Normalize b) (I.Normalize b)
621529 )
622530 => Relation a b -> Bool
623531function r = simple r && entire r
624532
625−-- | A 'Relation' @r@ is a 'representation' 'iff' @'injective' r && 'entire' r@
533+-- | A 'Relation' @r@ is a representation iff @'injective' r && 'entire' r@
626534representation ::
627− ( CountableN a,
628− FLN a a
535+ ( KnownNat (I.Count (I.Normalize a)),
536+ I.FromLists Boolean (I.Normalize a) (I.Normalize a)
629537 )
630538 => Relation a b -> Bool
631539representation r = injective r && entire r
632540
633−-- | A 'Relation' @r@ is an 'abstraction' 'iff' @'surjective' r && 'simple' r@
541+-- | A 'Relation' @r@ is an abstraction iff @'surjective' r && 'simple' r@
634542abstraction ::
635− ( CountableN b,
636− FLN b b
543+ ( KnownNat (I.Count (I.Normalize b)),
544+ I.FromLists Boolean (I.Normalize b) (I.Normalize b)
637545 )
638546 => Relation a b -> Bool
639547abstraction r = surjective r && simple r
640548
641−-- | A 'Relation' @r@ is a 'surjection' 'iff' @'function' r && 'abstraction' r@
549+-- | A 'Relation' @r@ is a surjection iff @'function' r && 'abstraction' r@
642550surjection ::
643− ( CountableDimsN a b,
644− FLN a a,
645− FLN b b
551+ ( KnownNat (I.Count (I.Normalize b)),
552+ KnownNat (I.Count (I.Normalize a)),
553+ I.FromLists Boolean (I.Normalize a) (I.Normalize a),
554+ I.FromLists Boolean (I.Normalize b) (I.Normalize b)
646555 )
647556 => Relation a b -> Bool
648557surjection r = function r && abstraction r
649558
650−-- | A 'Relation' @r@ is a 'injection' 'iff' @'function' r && 'representation' r@
559+-- | A 'Relation' @r@ is a injection iff @'function' r && 'representation' r@
651560injection ::
652− ( CountableDimsN a b,
653− FLN a a,
654− FLN b b
561+ ( KnownNat (I.Count (I.Normalize b)),
562+ KnownNat (I.Count (I.Normalize a)),
563+ I.FromLists Boolean (I.Normalize a) (I.Normalize a),
564+ I.FromLists Boolean (I.Normalize b) (I.Normalize b)
655565 )
656566 => Relation a b -> Bool
657567injection r = function r && representation r
658568
659−-- | A 'Relation' @r@ is an 'bijection' 'iff' @'injection' r && 'surjection' r@
569+-- | A 'Relation' @r@ is an bijection iff @'injection' r && 'surjection' r@
660570bijection ::
661− ( CountableDimsN a b,
662− FLN b b,
663− FLN a a
571+ ( KnownNat (I.Count (I.Normalize b)),
572+ KnownNat (I.Count (I.Normalize a)),
573+ I.FromLists Boolean (I.Normalize b) (I.Normalize b),
574+ I.FromLists Boolean (I.Normalize a) (I.Normalize a)
664575 ) => Relation a b -> Bool
665576bijection r = injection r && surjection r
666577
578+
667579-- Properties of relations
668580
669−-- | A 'Relation' @r@ is 'reflexive' 'iff' @'id' ``sse`` r@
670−reflexive :: (CountableN a, FLN a a) => Relation a a -> Bool
671−reflexive r = id <= r
581+-- | A 'Relation' @r@ is reflexive iff @'identity' `'sse'` r@
582+reflexive :: (KnownNat (I.Count (I.Normalize a)), I.FromLists Boolean (I.Normalize a) (I.Normalize a)) => Relation a a -> Bool
583+reflexive r = identity <= r
672584
673−-- | A 'Relation' @r@ is 'coreflexive' 'iff' @r ``sse`` 'id'@
674−coreflexive :: (CountableN a, FLN a a) => Relation a a -> Bool
675−coreflexive r = r <= id
585+-- | A 'Relation' @r@ is coreflexive iff @r `'sse'` 'identity'@
586+coreflexive :: (KnownNat (I.Count (I.Normalize a)), I.FromLists Boolean (I.Normalize a) (I.Normalize a)) => Relation a a -> Bool
587+coreflexive r = r <= identity
676588
677−-- | A 'Relation' @r@ is 'transitive' 'iff' @(r `.` r) ``sse`` r@
589+-- | A 'Relation' @r@ is transitive iff @(r `'comp'` r) `'sse'` r@
678590transitive :: Relation a a -> Bool
679−transitive r = (r . r) `sse` r
591+transitive r = (r `comp` r) `sse` r
680592
681−-- | A 'Relation' @r@ is 'symmetric' 'iff' @r == 'conv' r@
593+-- | A 'Relation' @r@ is symmetric iff @r == conv r@
682594symmetric :: Relation a a -> Bool
683595symmetric r = r == conv r
684596
685−-- | A 'Relation' @r@ is anti-symmetric 'iff' @(r ``intersection`` 'conv' r) ``sse`` 'id'@
686−antiSymmetric :: (CountableN a, FLN a a) => Relation a a -> Bool
687−antiSymmetric r = (r `intersection` conv r) `sse` id
597+-- | A 'Relation' @r@ is anti-symmetric iff @(r `'intersection'` 'conv' r) `'sse'` 'identity'@
598+antiSymmetric :: (KnownNat (I.Count (I.Normalize a)), I.FromLists Boolean (I.Normalize a) (I.Normalize a)) => Relation a a -> Bool
599+antiSymmetric r = (r `intersection` conv r) `sse` identity
688600
689−-- | A 'Relation' @r@ is 'irreflexive' 'iff' @(r ``intersection`` 'id') == 'zeros'@
690−irreflexive :: (CountableN a, FLN a a) => Relation a a -> Bool
691−irreflexive r = (r `intersection` id) == zeros
601+-- | A 'Relation' @r@ is irreflexive iff @(r `'intersection'` identity) == 'zeros'@
602+irreflexive :: (KnownNat (I.Count (I.Normalize a)), I.FromLists Boolean (I.Normalize a) (I.Normalize a)) => Relation a a -> Bool
603+irreflexive r = (r `intersection` identity) == zeros
692604
693−-- | A 'Relation' @r@ is 'connected' 'iff' @(r ``union`` 'conv' r) == 'ones'@
694−connected :: (CountableN a, FLN a a) => Relation a a -> Bool
605+-- | A 'Relation' @r@ is connected iff @(r `'union'` 'conv' r) == 'ones'@
606+connected :: (KnownNat (I.Count (I.Normalize a)), I.FromLists Boolean (I.Normalize a) (I.Normalize a)) => Relation a a -> Bool
695607connected r = (r `union` conv r) == ones
696608
697−-- | A 'Relation' @r@ is a 'preorder' 'iff' @'reflexive' r && 'transitive' r@
698−preorder :: (CountableN a, FLN a a) => Relation a a -> Bool
609+-- | A 'Relation @r@ is a preorder iff @'reflexive' r && 'transitive' r@
610+preorder :: (KnownNat (I.Count (I.Normalize a)), I.FromLists Boolean (I.Normalize a) (I.Normalize a)) => Relation a a -> Bool
699611preorder r = reflexive r && transitive r
700612
701−-- | A 'Relation' @r@ is a partial-order 'iff' @'antiSymmetric' r && 'preorder' r@
702−partialOrder :: (CountableN a, FLN a a) => Relation a a -> Bool
613+-- | A 'Relation @r@ is a partial order iff @'antiSymmetric' r && 'preorder' r@
614+partialOrder :: (KnownNat (I.Count (I.Normalize a)), I.FromLists Boolean (I.Normalize a) (I.Normalize a)) => Relation a a -> Bool
703615partialOrder r = antiSymmetric r && preorder r
704616
705−-- | A 'Relation' @r@ is a linear-order 'iff' @'connected' r && 'partialOrder' r@
706−linearOrder :: (CountableN a, FLN a a) => Relation a a -> Bool
617+-- | A 'Relation @r@ is a linear order iff @'connected' r && 'partialOrder' r@
618+linearOrder :: (KnownNat (I.Count (I.Normalize a)), I.FromLists Boolean (I.Normalize a) (I.Normalize a)) => Relation a a -> Bool
707619linearOrder r = connected r && partialOrder r
708620
709−-- | A 'Relation' @r@ is an 'equivalence' 'iff' @'symmetric' r && 'preorder' r@
710−equivalence :: (CountableN a, FLN a a) => Relation a a -> Bool
621+-- | A 'Relation @r@ is an equivalence iff @'symmetric' r && 'preorder' r@
622+equivalence :: (KnownNat (I.Count (I.Normalize a)), I.FromLists Boolean (I.Normalize a) (I.Normalize a)) => Relation a a -> Bool
711623equivalence r = symmetric r && preorder r
712624
713−-- | A 'Relation' @r@ is a partial-equivalence 'iff' @'partialOrder' r && 'equivalence' r@
714−partialEquivalence :: (CountableN a, FLN a a) => Relation a a -> Bool
625+-- | A 'Relation @r@ is a partial equivalence iff @'partialOrder' r && 'equivalence' r@
626+partialEquivalence :: (KnownNat (I.Count (I.Normalize a)), I.FromLists Boolean (I.Normalize a) (I.Normalize a)) => Relation a a -> Bool
715627partialEquivalence r = partialOrder r && equivalence r
716628
717−-- | A 'Relation' @r@ is 'difunctional' or regular wherever
718−-- @r `.` 'conv' r `.` r == r@
719−difunctional :: Relation a b -> Bool
720−difunctional r = r . conv r . r == r
721−
722629-- Relational pairing
723630
724631-- | Relational pairing.
@@ -726,81 +633,64 @@ difunctional r = r . conv r . r == r
726633-- NOTE: That this is not a true categorical product, see for instance:
727634--
728635-- @
729−-- | 'fstR' `.` 'splitR' a b ``sse`` a
730−-- 'splitR' a b <=> |
731−-- | 'sndR' `.` 'splitR' a b ``sse`` b
636+-- | 'p1' `'comp'` 'splitR' a b `'sse'` a
637+-- 'splitR' a b <=> |
638+-- | 'p2' `'comp'` 'splitR' a b `'sse'` b
732639-- @
733640--
734641-- __Emphasis__ on the 'sse'.
735−--
736−-- @
737−-- 'splitR' r s `.` f == 'splitR' (r `.` f) (s `.` f)
738−-- (R '><' S) `.` 'splitR' p q == 'splitR' (r `.` p) (s `.` q)
739−-- 'conv' ('splitR' r s) `.` 'splitR' x y == ('conv' r `.` x) ``intersection`` ('conv' s `.` y)
740−-- @
741−--
742−-- @
743−-- 'eitherR' ('splitR' r s) ('splitR' t v) == 'splitR' ('eitherR' r t) ('eitherR' s v)
744−-- @
745642splitR ::
746− ( CountableDimsN a b,
747− CountableN (a, b),
748− FLN (a, b) a,
749− FLN (a, b) b,
750− TrivialP a b
643+ ( KnownNat (I.Count (I.Normalize a)),
644+ KnownNat (I.Count (I.Normalize b)),
645+ KnownNat (I.Count (I.Normalize (a, b))),
646+ I.FromLists Boolean (I.Normalize (a, b)) (I.Normalize a),
647+ I.FromLists Boolean (I.Normalize (a, b)) (I.Normalize b),
648+ I.Normalize (a, b) ~ I.Normalize (I.Normalize a, I.Normalize b)
751649 )
752650 => Relation c a -> Relation c b -> Relation c (a, b)
753−splitR (R f) (R g) = R (I.kr f g)
651+splitR (R f) (R g) = R (I.khatri f g)
754652
755653-- | Relational pairing first component projection
756−--
757−-- @
758−-- 'fstR' `.` 'splitR' r s ``sse`` r
759−-- @
760−fstR ::
654+p1 ::
761655 forall a b .
762− ( CountableDimsN a b,
763− CountableN (a, b),
764− FLN (a, b) a,
765− TrivialP a b
656+ ( KnownNat (I.Count (I.Normalize a)),
657+ KnownNat (I.Count (I.Normalize b)),
658+ KnownNat (I.Count (I.Normalize (a, b))),
659+ I.FromLists Boolean (I.Normalize (a, b)) (I.Normalize a),
660+ I.Normalize (a, b) ~ I.Normalize (I.Normalize a, I.Normalize b)
766661 )
767662 => Relation (a, b) a
768−fstR = R (I.fstM @Boolean @(I.Normalize a) @(I.Normalize b))
663+p1 = R (I.kp1 @Boolean @(I.Normalize a) @(I.Normalize b))
769664
770665-- | Relational pairing second component projection
771−--
772−-- @
773−-- 'sndR' `.` 'splitR' r s ``sse`` s
774−-- @
775−sndR ::
666+p2 ::
776667 forall a b .
777− ( CountableDimsN a b,
778− CountableN (a, b),
779− FLN (a, b) b,
780− TrivialP a b
668+ ( KnownNat (I.Count (I.Normalize b)),
669+ KnownNat (I.Count (I.Normalize a)),
670+ KnownNat (I.Count (I.Normalize (a, b))),
671+ I.FromLists Boolean (I.Normalize (a, b)) (I.Normalize b),
672+ I.Normalize (a, b) ~ I.Normalize (I.Normalize a, I.Normalize b)
781673 )
782674 => Relation (a, b) b
783−sndR = R (I.sndM @Boolean @(I.Normalize a) @(I.Normalize b))
675+p2 = R (I.kp2 @Boolean @(I.Normalize a) @(I.Normalize b))
784676
785677-- Relational pairing functor
786678
787679infixl 4 ><
788680-- | Relational pairing functor
789−--
790−-- @
791−-- r '><' s == 'splitR' (r `.` fstR) (s `.` sndR)
792−-- (r '><' s) `.` (p '><' q) == (r `.` p) '><' (s `.` q)
793−-- @
794681(><) ::
795− ( CountableDimsN a b,
796− CountableDimsN c d,
797− CountableDimsN (a, c) (b, d),
798− FLN (a, c) a,
799− FLN (a, c) c,
800− FLN (b, d) b,
801− FLN (b, d) d,
802− TrivialP a c,
803− TrivialP b d
682+ ( KnownNat (I.Count (I.Normalize a)),
683+ KnownNat (I.Count (I.Normalize b)),
684+ KnownNat (I.Count (I.Normalize c)),
685+ KnownNat (I.Count (I.Normalize d)),
686+ KnownNat (I.Count (I.Normalize (a, c))),
687+ KnownNat (I.Count (I.Normalize (b, d))),
688+ I.FromLists Boolean (I.Normalize (a, c)) (I.Normalize a),
689+ I.FromLists Boolean (I.Normalize (a, c)) (I.Normalize c),
690+ I.FromLists Boolean (I.Normalize (b, d)) (I.Normalize b),
691+ I.FromLists Boolean (I.Normalize (b, d)) (I.Normalize d),
692+ I.Normalize (a, c) ~ I.Normalize (I.Normalize a, I.Normalize c),
693+ I.Normalize (b, d) ~ I.Normalize (I.Normalize b, I.Normalize d)
804694 )
805695 => Relation a b -> Relation c d -> Relation (a, c) (b, d)
806696(><) (R a) (R b) = R ((I.><) a b)
@@ -808,47 +698,28 @@ infixl 4 ><
808698-- Relational co-products
809699
810700-- | Relational coproduct.
811−--
812−-- @
813−-- | 'eitherR' a b `.` 'i1' == a
814−-- 'eitherR' a b <=> |
815−-- | 'eitherR' a b `.` 'i2' == b
816−-- @
817−--
818−-- @
819−-- 'eitherR' r s `.` 'conv' ('eitherR' t u) == (r `.` 'conv' t) ``union`` (s `.` 'conv' u)
820−-- @
821−--
822−-- @
823−-- 'eitherR' ('splitR' r s) ('splitR' t v) == 'splitR' ('eitherR' r t) ('eitherR' s v)
824−-- @
825−eitherR :: Relation a c -> Relation b c -> Relation (Either a b) c
826−eitherR = join
701+eitherR :: (I.Normalize (Either a b) ~ Either (I.Normalize a) (I.Normalize b))
702+ => Relation a c -> Relation b c -> Relation (Either a b) c
703+eitherR = junc
827704
828705-- | Relational coproduct first component injection
829−--
830−-- @
831−-- 'img' 'i1' ``union`` 'img' 'i2' == 'id'
832−-- 'i1' `.` 'i2' = 'zeros'
833−-- @
834706i1 ::
835− ( CountableDimsN a b,
836− FLN b a,
837− FLN a a
707+ ( KnownNat (I.Count (I.Normalize b)),
708+ KnownNat (I.Count (I.Normalize a)),
709+ I.FromLists Boolean (I.Normalize b) (I.Normalize a),
710+ I.FromLists Boolean (I.Normalize a) (I.Normalize a),
711+ I.Normalize (Either a b) ~ Either (I.Normalize a) (I.Normalize b)
838712 )
839713 => Relation a (Either a b)
840714i1 = R I.i1
841715
842716-- | Relational coproduct second component injection
843−--
844−-- @
845−-- 'img' 'i1' ``union`` 'img' 'i2' == 'id'
846−-- 'i1' `.` 'i2' = 'zeros'
847−-- @
848717i2 ::
849− ( CountableDimsN a b,
850− FLN a b,
851− FLN b b
718+ ( KnownNat (I.Count (I.Normalize b)),
719+ KnownNat (I.Count (I.Normalize a)),
720+ I.FromLists Boolean (I.Normalize a) (I.Normalize b),
721+ I.FromLists Boolean (I.Normalize b) (I.Normalize b),
722+ I.Normalize (Either a b) ~ Either (I.Normalize a) (I.Normalize b)
852723 )
853724 => Relation b (Either a b)
854725i2 = R I.i2
@@ -856,16 +727,15 @@ i2 = R I.i2
856727infixl 5 -|-
857728
858729-- | Relational coproduct functor.
859−--
860−-- @
861−-- r '-|-' s == 'eitherR' ('i1' `.` r) ('i2' `.` s)
862−-- @
863730(-|-) ::
864− ( CountableDimsN b d,
865− FLN b b,
866− FLN d b,
867− FLN b d,
868− FLN d d
731+ ( KnownNat (I.Count (I.Normalize d)),
732+ KnownNat (I.Count (I.Normalize b)),
733+ I.FromLists Boolean (I.Normalize b) (I.Normalize b),
734+ I.FromLists Boolean (I.Normalize d) (I.Normalize b),
735+ I.FromLists Boolean (I.Normalize b) (I.Normalize d),
736+ I.FromLists Boolean (I.Normalize d) (I.Normalize d),
737+ I.Normalize (Either a c) ~ Either (I.Normalize a) (I.Normalize c),
738+ I.Normalize (Either b d) ~ Either (I.Normalize b) (I.Normalize d)
869739 )
870740 => Relation a b -> Relation c d -> Relation (Either a c) (Either b d)
871741(-|-) (R a) (R b) = R ((I.-|-) a b)
@@ -873,136 +743,97 @@ infixl 5 -|-
873743-- Relational "Currying"
874744
875745-- | Relational 'trans'
876−--
877−-- Every n-ary relation can be expressed as a binary relation through
878−-- 'trans'/'untrans';
879−-- more-over, where each particular attribute is placed (input/output) is irrelevant.
880746trans ::
881− ( CountableDimsN a b,
882− CountableN c,
883− CountableDimsN (a, b) (c, b),
884− FLN (c, b) c,
885− FLN (c, b) b,
886− FLN (a, b) a,
887− FLN (a, b) b,
888− Trivial (a, b),
889− Trivial (c, b),
890− TrivialP a b,
891− TrivialP c b
747+ ( KnownNat (I.Count (I.Normalize (a, b))),
748+ KnownNat (I.Count (I.Normalize a)),
749+ KnownNat (I.Count (I.Normalize (c, b))),
750+ KnownNat (I.Count (I.Normalize b)),
751+ KnownNat (I.Count (I.Normalize c)),
752+ I.FromLists Boolean (I.Normalize (c, b)) (I.FromNat (I.Count c)),
753+ I.FromLists Boolean (I.Normalize (c, b)) (I.FromNat (I.Count b)),
754+ I.FromLists Boolean (I.Normalize (a, b)) (I.FromNat (I.Count b)),
755+ I.FromLists Boolean (I.Normalize (a, b)) (I.FromNat (I.Count a)),
756+ I.Normalize (a, b) ~ I.Normalize (I.Normalize (a, b)),
757+ I.Normalize (c, b) ~ I.Normalize (I.Normalize (c, b)),
758+ I.Normalize (I.Normalize a, I.Normalize b) ~ I.FromNat (I.Count (I.Normalize (a, b))),
759+ I.Normalize (I.Normalize c, I.Normalize b) ~ I.FromNat (I.Count (I.Normalize (c, b)))
892760 )
893761 => Relation (a, b) c -> Relation a (c, b)
894−trans r = splitR r sndR . conv fstR
762+trans r = splitR r p2 `comp` conv p1
895763
896764-- | Relational 'untrans'
897−--
898−-- Every n-ary relation can be expressed as a binary relation through
899−-- 'trans'/'untrans';
900−-- more-over, where each particular attribute is placed (input/output) is irrelevant.
901765untrans ::
902− ( CountableDimsN a b,
903− CountableN c,
904− CountableDimsN (a, b) (c, b),
905− FLN (c, b) c,
906− FLN (c, b) b,
907− FLN (a, b) b,
908− FLN (a, b) a,
909− Trivial (a, b),
910− Trivial (c, b),
911− TrivialP a b,
912− TrivialP c b
766+ ( KnownNat (I.Count (I.Normalize (a, b))),
767+ KnownNat (I.Count (I.Normalize a)),
768+ KnownNat (I.Count (I.Normalize (c, b))),
769+ KnownNat (I.Count (I.Normalize b)),
770+ KnownNat (I.Count (I.Normalize c)),
771+ I.FromLists Boolean (I.Normalize (c, b)) (I.FromNat (I.Count c)),
772+ I.FromLists Boolean (I.Normalize (c, b)) (I.FromNat (I.Count b)),
773+ I.FromLists Boolean (I.Normalize (a, b)) (I.FromNat (I.Count b)),
774+ I.FromLists Boolean (I.Normalize (a, b)) (I.FromNat (I.Count a)),
775+ I.Normalize (a, b) ~ I.Normalize (I.Normalize (a, b)),
776+ I.Normalize (c, b) ~ I.Normalize (I.Normalize (c, b)),
777+ I.Normalize (I.Normalize a, I.Normalize b) ~ I.FromNat (I.Count (I.Normalize (a, b))),
778+ I.Normalize (I.Normalize c, I.Normalize b) ~ I.FromNat (I.Count (I.Normalize (c, b)))
913779 )
914780 => Relation a (c, b) -> Relation (a, b) c
915−untrans s = fstR . conv (splitR (conv s) sndR)
781+untrans s = p1 `comp` conv (splitR (conv s) p2)
916782
917783-- | Transforms predicate @p@ into a correflexive relation.
918−--
919−-- @
920−-- 'predR' ('const' True) == 'id'
921−-- 'predR' ('const' False) == 'zeros'
922−-- @
923−--
924−-- @
925−-- 'predR' q `.` 'predR' p == 'predR' q ``union`` 'predR' p
926−-- @
927784predR ::
928785 ( Bounded a,
929786 Enum a,
930− Countable a,
931− CountableN a,
932− FLN a a,
933− FLN Bool a
787+ KnownNat (I.Count (I.Normalize a)),
788+ I.FromLists Boolean (I.Normalize a) (I.Normalize a),
789+ I.FromLists Boolean (I.Normalize Bool) (I.Normalize a)
934790 )
935− => Relation a Bool -> Relation a a
936−predR p = id `intersection` divisionF (fromF (const True)) p
791+ => (a -> Bool) -> Relation a a
792+predR p = identity `intersection` divisionF (fromF' (const True)) (fromF' p)
937793
938−-- | Equalizes functions @f@ and @g@.
794+-- | Equalizes functions @f@ and @g@.
939795-- That is, @'equalizer' f g@ is the largest coreflexive
940796-- that restricts @g@ so that @f@ and @g@ yield the same outputs.
941−--
942−-- @
943−-- 'equalizer' r r == 'id'
944−-- 'equalizer' ('point' True) ('point' False) == 'zeros'
945−-- @
946797equalizer ::
947− ( CountableN a,
948− FLN a a
798+ ( KnownNat (I.Count (I.Normalize a)),
799+ I.FromLists Boolean (I.Normalize a) (I.Normalize a)
949800 )
950801 => Relation a b -> Relation a b -> Relation a a
951−equalizer f g = id `intersection` divisionF f g
802+equalizer f g = identity `intersection` divisionF f g
952803
953804-- | Relational conditional guard.
954805--
955806-- @
956−-- 'guard' p = 'i2' ``overriddenBy`` 'i1' `.` 'predR' p
807+-- 'guard' p = 'i2' `'overriddenBy'` 'i1' `'comp'` 'predR' p
957808-- @
958−guard ::
809+guard ::
959810 ( Bounded b,
960811 Enum b,
961− CountableN b,
962− Countable b,
963− FLN b b,
964− FLN Bool b
965− ) => Relation b Bool -> Relation b (Either b b)
966−guard p = conv (eitherR (predR p) (predR (negate p)))
812+ KnownNat (I.Count (I.Normalize b)),
813+ I.FromLists Boolean (I.Normalize b) (I.Normalize b),
814+ I.FromLists Boolean (I.Normalize Bool) (I.Normalize b),
815+ I.Normalize (Either b b) ~ Either (I.Normalize b) (I.Normalize b)
816+ ) => (b -> Bool) -> Relation b (Either b b)
817+guard p = conv (eitherR (predR p) (predR (not . p)))
967818
968819-- | Relational McCarthy's conditional.
969−cond ::
820+cond ::
970821 ( Bounded b,
971822 Enum b,
972− Countable b,
973− CountableN b,
974− FLN b b,
975− FLN Bool b
976− )
977− => Relation b Bool -> Relation b c -> Relation b c -> Relation b c
978−cond p r s = eitherR r s . guard p
979−
980−-- | Relational domain.
981−--
982−-- For injective relations, 'domain' and 'ker'nel coincide,
983−-- since @'ker' r ``sse`` 'id'@ in such situations.
984−domain ::
985− ( CountableN a,
986− FLN a a
987− ) => Relation a b -> Relation a a
988−domain r = ker r `intersection` id
989−
990−-- | Relational range.
991−--
992−-- For functions, 'range' and 'img' (image) coincide,
993−-- since @'img' f ``sse`` id@ for any @f@.
994−range ::
995− ( CountableN b,
996− FLN b b
997− ) => Relation a b -> Relation b b
998−range r = img r `intersection` id
823+ KnownNat (I.Count (I.Normalize b)),
824+ I.FromLists Boolean (I.Normalize b) (I.Normalize b),
825+ I.FromLists Boolean (I.Normalize Bool) (I.Normalize b),
826+ I.Normalize (Either b b) ~ Either (I.Normalize b) (I.Normalize b)
827+ )
828+ => (b -> Bool) -> Relation b c -> Relation b c -> Relation b c
829+cond p r s = eitherR r s `comp` guard p
999830
1000831-- Relation pretty print
1001832
1002833-- | Relation pretty printing
1003−pretty :: (CountableDimsN a b) => Relation a b -> String
834+pretty :: (KnownNat (I.Count (I.Normalize a))) => Relation a b -> String
1004835pretty (R a) = I.pretty a
1005836
1006837-- | Relation pretty printing
1007−prettyPrint :: (CountableDimsN a b) => Relation a b -> IO ()
838+prettyPrint :: (KnownNat (I.Count (I.Normalize a))) => Relation a b -> IO ()
1008839prettyPrint (R a) = I.prettyPrint a
src/LAoP/Utils.hs−6
@@ -94,12 +94,6 @@ module LAoP.Utils
9494 coerceNat,
9595 coerceNat2,
9696 coerceNat3,
97−
98− -- * List data type
99− List (..),
100−
101− -- * Category type-class
102− Category(..)
10397 )
10498where
10599
src/LAoP/Utils/Internal.hs+73−70
@@ -1,13 +1,82 @@
1−{-# LANGUAGE TypeFamilies #-}
2−{-# LANGUAGE DeriveGeneric #-}
31{-# LANGUAGE TypeApplications #-}
42{-# LANGUAGE DataKinds #-}
53{-# LANGUAGE FlexibleInstances #-}
64{-# LANGUAGE GeneralizedNewtypeDeriving #-}
5+{-# LANGUAGE KindSignatures #-}
76{-# LANGUAGE ScopedTypeVariables #-}
87
98module LAoP.Utils.Internal
10− (
9+ ( -- | This is an internal module and it is not meant to be imported.
10+ --
11+ -- Utility module that provides the 'Natural' data type.
12+ -- The semantic associated with this data type is that
13+ -- it's meant to be a restricted 'Int' value. For example
14+ -- the type @Natural 6@ can only be instanciated with @Nat n@
15+ -- where @0 <= n <= 6@. Why, You might ask, because with normal
16+ -- 'Int's it is not possible to have a decent @Enum (Int, Int)@
17+ -- instance. See the following probabilistic programming model as and
18+ -- example:
19+ --
20+ -- We want to calculate the probability of the sum of two dice throws.
21+ -- To do this we start by defining the sample space:
22+ --
23+ -- @
24+ -- type SampleSpace = Int -- We think 'Int' are enough
25+ --
26+ -- die :: Dist Int 6
27+ -- die = unifrom [1..6]
28+ --
29+ -- -- Promote 'Int' addition to a matrix
30+ -- addM = fromF (uncurry (+)) -- Impossible
31+ -- @
32+ --
33+ -- The last line is impossible because @(Int, Int)@ does not have
34+ -- a good 'Enum' instance: @[(0, 1), (0, 2), .. (0, maxBound), (1, 0),
35+ -- ..]@. And we'd like the addition matrix to be of 36 columns by 12
36+ -- rows but limited to integers up to @6@!
37+ --
38+ -- One way to solve this issue is by defining and auxilary data type to
39+ -- represent the sample space:
40+ --
41+ -- @
42+ -- data SampleSpace = S1 | S2 | S3 | S4 | S5 | S6
43+ -- deriving (Show, Eq, Enum, Bounded) -- Enum and Bounded are
44+ -- important
45+ -- @
46+ --
47+ -- And write the sample space addition function:
48+ --
49+ -- @
50+ -- ssAdd :: SampleSpace -> SampleSpace -> Int
51+ -- ssAdd a b = (fromEnum a + 1) + (fromEnum b + 1)
52+ -- @
53+ --
54+ -- And then promote that function to matrix and everything is alright:
55+ --
56+ -- @
57+ -- ssAddM = fromF' (uncurry ssAdd)
58+ --
59+ -- dieSumProb = ssAddM `comp` (khatri die die)
60+ -- @
61+ --
62+ -- This is a nice solution for small sample spaces. But for larger ones
63+ -- it is not feasible to write a data type with hundreds of constructors
64+ -- and then write manipulation functions that need to deal with them.
65+ -- To mitigate this limitation the 'Natural' type comes a long way and
66+ -- allows one to model the sample in an easier way. See for instance:
67+ --
68+ -- @
69+ -- ssAdd :: Natural 6 -> Natural 6 -> Natural 12
70+ -- ssAdd = coerceNat (+)
71+ --
72+ -- ssAddM = fromF' (uncurry sumSS)
73+ --
74+ -- die :: Dist (Natural 6) 6
75+ -- die = uniform [nat @6 1 .. nat 6]
76+ --
77+ -- dieSumProb = ssAddM `comp` (khatri die die)
78+ -- @
79+ --
1180 -- * 'Natural' data type
1281 Natural(..),
1382 nat,
@@ -17,31 +86,19 @@ module LAoP.Utils.Internal
1786 coerceNat,
1887 coerceNat2,
1988 coerceNat3,
20−
21− -- * 'List' data type
22− List (..),
23−
24− -- * Category type class
25− Category(..)
2689 )
2790where
2891
2992import Data.Coerce
3093import Data.Proxy
31−import Data.List
32−import Data.Maybe
3394import GHC.TypeLits
3495import Control.DeepSeq
35−import GHC.Generics
36−import Data.Kind
37−import Prelude hiding (id, (.))
38−import qualified Prelude
3996
4097-- | Wrapper around 'Int's that have a restrictive semantic associated.
4198-- A value of type @'Natural' n m@ can only be instanciated with some 'Int'
4299-- @i@ that's @n <= i <= m@.
43100newtype Natural (start :: Nat) (end :: Nat) = Nat Int
44− deriving (Show, Read, Eq, Ord, NFData, Generic)
101+ deriving (Show, Read, Eq, Ord, NFData)
45102
46103-- | Throws a runtime error if any of the operations overflows or
47104-- underflows.
@@ -140,57 +197,3 @@ instance
140197
141198 fromEnum (Left a) = fromEnum a
142199 fromEnum (Right b) = fromEnum (maxBound :: a) + fromEnum b + 1
143−
144−-- | Powerset data type.
145−--
146−-- This data type is a newtype wrapper around '[]'. This exists in order to
147−-- implement an 'Enum' and 'Bounded' instance that cannot be harmful for the outside.
148−newtype List a = L [a]
149− deriving (Eq, Show, Read)
150−
151−powerset :: [a] -> [[a]]
152−powerset [] = [[]]
153−powerset (x:xs) = powerset xs ++ [x:ps | ps <- powerset xs]
154−
155−instance
156− ( Enum a,
157− Bounded a
158− ) => Bounded (List a)
159− where
160− minBound = L []
161− maxBound = L [minBound .. maxBound]
162−
163−instance
164− ( Bounded a,
165− Enum a,
166− Eq a
167− ) => Enum (List a)
168− where
169− toEnum i =
170− let as = [minBound .. maxBound]
171− in L (powerset as !! i)
172−
173− fromEnum (L []) = 0
174− fromEnum (L x) =
175− let as = [minBound .. maxBound]
176− in fromMaybe (error "Does not exist") $ elemIndex x (powerset as)
177−
178−-- | Constrained category instance
179−class Category k where
180− type Object k o :: Constraint
181− type Object k o = ()
182− id :: Object k a => k a a
183− (.) :: k b c -> k a b -> k a c
184−
185−{-# RULES
186−"identity/left" forall p .
187− id . p = p
188−"identity/right" forall p .
189− p . id = p
190−"association" forall p q r .
191− (p . q) . r = p . (q . r)
192− #-}
193−
194−instance Category (->) where
195− id = Prelude.id
196− (.) = (Prelude..)
stack-8.8.3.yamldeleted−1
@@ -1 +0,0 @@
1−resolver: lts-15.5
stack.yaml+66−1
@@ -1 +1,66 @@
1−resolver: lts-14.3
1+# This file was automatically generated by 'stack init'
2+#
3+# Some commonly used options have been documented as comments in this file.
4+# For advanced use and comprehensive documentation of the format, please see:
5+# https://docs.haskellstack.org/en/stable/yaml_configuration/
6+
7+# Resolver to choose a 'specific' stackage snapshot or a compiler version.
8+# A snapshot resolver dictates the compiler version and the set of packages
9+# to be used for project dependencies. For example:
10+#
11+# resolver: lts-3.5
12+# resolver: nightly-2015-09-21
13+# resolver: ghc-7.10.2
14+#
15+# The location of a snapshot can be provided as a file or url. Stack assumes
16+# a snapshot provided as a file might change, whereas a url resource does not.
17+#
18+# resolver: ./custom-snapshot.yaml
19+# resolver: https://example.com/snapshots/2018-01-01.yaml
20+resolver: lts-14.18
21+
22+# User packages to be built.
23+# Various formats can be used as shown in the example below.
24+#
25+# packages:
26+# - some-directory
27+# - https://example.com/foo/bar/baz-0.0.2.tar.gz
28+# subdirs:
29+# - auto-update
30+# - wai
31+packages:
32+- .
33+# Dependency packages to be pulled from upstream that are not in the resolver.
34+# These entries can reference officially published versions as well as
35+# forks / in-progress versions pinned to a git hash. For example:
36+#
37+# extra-deps:
38+# - acme-missiles-0.3
39+# - git: https://github.com/commercialhaskell/stack.git
40+# commit: e7b331f14bcffb8367cd58fbfc8b40ec7642100a
41+#
42+# extra-deps: []
43+
44+# Override default flag values for local packages and extra-deps
45+# flags: {}
46+
47+# Extra package databases containing global packages
48+# extra-package-dbs: []
49+
50+# Control whether we use the GHC we find on the path
51+# system-ghc: true
52+#
53+# Require a specific version of stack, using version ranges
54+# require-stack-version: -any # Default
55+# require-stack-version: ">=2.1"
56+#
57+# Override the architecture used by stack, especially useful on Windows
58+# arch: i386
59+# arch: x86_64
60+#
61+# Extra directories used by stack for building
62+# extra-include-dirs: [/path/to/dir]
63+# extra-lib-dirs: [/path/to/dir]
64+#
65+# Allow a newer minor version of GHC than the snapshot specifies
66+# compiler-check: newer-minor
stack.yaml.lock+4−4
@@ -6,7 +6,7 @@
66packages: []
77snapshots:
88- completed:
9− size: 523878
10− url: https://raw.githubusercontent.com/commercialhaskell/stackage-snapshots/master/lts/14/3.yaml
11− sha256: 470c46c27746a48c7c50f829efc0cf00112787a7804ee4ac7a27754658f6d92c
12− original: lts-14.3
9+ size: 524789
10+ url: https://raw.githubusercontent.com/commercialhaskell/stackage-snapshots/master/lts/14/18.yaml
11+ sha256: 646be71223e08234131c6989912e6011e01b9767bc447b6d466a35e14360bdf2
12+ original: lts-14.18
test/Examples/Quantum.hsdeleted−31
@@ -1,31 +0,0 @@
1−{-# LANGUAGE StandaloneDeriving #-}
2−module Examples.Quantum where
3−
4−import LAoP.Utils
5−import LAoP.Matrix.Type
6−import Data.Complex
7−import Prelude hiding (id, (.))
8−
9−deriving instance Ord a => Ord (Complex a)
10−
11−xor :: (Bool, Bool) -> Bool
12−xor (False, b) = b
13−xor (True, b) = not b
14−
15−ker :: Num e => Matrix e a b -> Matrix e a a
16−ker m = tr m . m
17−
18−cnot :: Matrix (Complex Double) (Bool, Bool) (Bool, Bool)
19−cnot = kr fstM (fromF xor)
20−
21−ccnot :: (Num e, Ord e) => Matrix e ((Bool, Bool), Bool) ((Bool, Bool), Bool)
22−ccnot = kr fstM (fromF f)
23− where
24− f = xor . tp (uncurry (&&)) id
25− tp f g (a,b) = (f a, g b)
26−
27−had :: Matrix (Complex Double) Bool Bool
28−had = (1/sqrt 2) .| fromLists [[1, 1], [1, -1]]
29−
30−bell :: Matrix (Complex Double) (Bool, Bool) (Bool, Bool)
31−bell = cnot . (had >< iden)
test/Examples/Spreadsheets.hsdeleted−47
@@ -1,47 +0,0 @@
1−{-# LANGUAGE DeriveGeneric #-}
2−
3−module Examples.Spreadsheets
4−
5−import LAoP.Utils
6−import LAoP.Matrix.Type
7−import GHC.Generics
8−import Prelude hiding (id, (.))
9−
10−data Student = Student1 | Student2 | Student3 | Student4
11− deriving (Eq, Show, Enum, Bounded, Generic)
12−
13−data Question = Question1 | Question2 | Question3 | Question4
14− deriving (Eq, Show, Enum, Bounded, Generic)
15−
16−data Results = Exam | Test | Final
17− deriving (Eq, Show, Enum, Bounded, Generic)
18−
19−test :: Matrix Float One Results
20−test = point Test
21−
22−exam :: Matrix Float One Results
23−exam = point Exam
24−
25−final :: Matrix Float One Results
26−final = point Final
27−
28−m :: Matrix Float Question Student
29−m = fromLists [[95, 90, 100, 40], [20, 90, 90, 0], [30, 20, 95, 0], [50, 80, 100, 30]]
30−
31−w :: Matrix Float Question One
32−w = fromLists [[0.2, 0.3, 0.2, 0.3]]
33−
34−xls :: Matrix Float Question One
35− -> Matrix Float Question Student
36− -> Matrix Float Student One
37− -> Matrix Float (Either Question Results) (Either One Student)
38−xls w m t = join (fork w m) (fork zeros r)
39− where
40− rExam = m . tr w
41− rTest = tr t
42− rFinal = rTest `maxPW` rExam
43− r = (rExam . tr exam) + (rTest . tr test) + (rFinal . tr final)
44−
45−-- | Overloaded, point-wise 'max' function
46−maxPW :: Ord e => Matrix e a b -> Matrix e a b -> Matrix e a b
47−maxPW = zipWithM max
test/Spec.hs+1−7
@@ -1,8 +1,2 @@
1−module Main (main) where
2−
3−import qualified Examples.Readme as RD
4−
51main :: IO ()
6−main = do
7− putStrLn ("Testing if README works" :: String)
8− RD.exec
2+main = putStrLn "Test suite not yet implemented"