on master help sign in
93 files changed+2350−5957
since splitsnapshots
unifiedsplit
.ghc.environment.x86_64-linux-8.6.5−17 .github/workflows/ci.yml+43 .gitignore+54−2 .travis.yml+47 CHANGELOG.md+17 ChangeLog.md−3 LICENSE+17−26 README.md+107−24 Setup.hs−2 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+87−36 src/LAoP/Matrix/Internal.hs+445−436 src/LAoP/Matrix/Nat.hs+194−187 src/LAoP/Matrix/Type.hs+283−240 src/LAoP/Relation.hs+34−7 src/LAoP/Relation/Internal.hs+486−317 src/LAoP/Utils.hs+6 src/LAoP/Utils/Internal.hs+70−73 stack-8.8.3.yaml+1 stack.yaml+1−66 stack.yaml.lock+4−4 test/Examples/Quantum.hs+31 app/Main.hs → test/Examples/Readme.hs+61−33 test/Examples/Spreadsheets.hs+47 test/Spec.hs+7−1
.ghc.environment.x86_64-linux-8.6.5deleted−17
@@ -1,17 +0,0 @@
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.ymlnew file+43
@@ -0,0 +1,43 @@
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+54−2
@@ -1,3 +1,55 @@
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
125.stack-work/
2−laop.cabal
3−*~
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
.travis.ymlnew file+47
@@ -0,0 +1,47 @@
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.mdnew file+17
@@ -0,0 +1,17 @@
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.mddeleted−3
@@ -1,3 +0,0 @@
1−# Changelog for laop
2−
3−## Unreleased changes
LICENSE+17−26
@@ -1,30 +1,21 @@
1−Copyright Armando Santos (c) 2019
1+MIT License
22
3−All rights reserved.
3+Copyright (c) 2020 Armando Santos
44
5−Redistribution and use in source and binary forms, with or without
6−modification, are permitted provided that the following conditions are met:
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:
711
8− * Redistributions of source code must retain the above copyright
9− notice, this list of conditions and the following disclaimer.
12+The above copyright notice and this permission notice shall be included in all
13+copies or substantial portions of the Software.
1014
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.
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.
README.md+107−24
@@ -1,5 +1,11 @@
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+
39The LAoP discipline generalises relations and functions treating them as
410Boolean matrices and in turn consider these as arrows.
511
@@ -10,33 +16,38 @@ motivation behind the library, the underlying theory, and implementation details
1016This module offers many of the combinators mentioned in the work of
1117[Macedo (2012)](https://repositorium.sdum.uminho.pt/handle/1822/22894) and [Oliveira (2012)](https://pdfs.semanticscholar.org/ccf5/27fa9179081223bffe8067edd81948644fc0.pdf).
1218
13−See the candidate package in hackage [here](https://hackage.haskell.org/package/laop-0.1.0.0/candidate)
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.
1422
1523## Features
1624
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.
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).
4051
4152## Notes
4253
@@ -118,6 +129,73 @@ grass_wet = row [0,1] . kp1
118129rainning :: Matrix Double (Bool, (Bool, Bool)) One
119130rainning = row [0,1] . kp2 . kp2
120131
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+
121199main :: IO ()
122200main = do
123201 putStrLn "Monty Hall Problem solution:"
@@ -132,6 +210,8 @@ main = do
132210 prettyPrint (grass_wet . state)
133211 putStrLn "\n Probability of rain:"
134212 prettyPrint (rainning . state)
213+ putStrLn "\n Is the arbitrary state a valid state? (Alcuin Puzzle)"
214+ print (inv bankStateR)
135215```
136216
137217```Shell
@@ -190,4 +270,7 @@ Monty Hall Problem solution:
190270┌ ┐
191271│ 0.2 │
192272└ ┘
273+
274+Is the arbitrary state a valid state? (Alcuin Puzzle)
275+False
193276```
Setup.hsdeleted−2
@@ -1,2 +0,0 @@
1−import Distribution.Simple
2−main = defaultMain
appveyor.ymlnew file+34
@@ -0,0 +1,34 @@
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.hsnew file+175
@@ -0,0 +1,175 @@
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.hsdeleted−50
@@ -1,50 +0,0 @@
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.hdeleted−143
@@ -1,143 +0,0 @@
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/configdeleted

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.htmldeleted−15
@@ -1,15 +0,0 @@
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.htmldeleted−22
@@ -1,22 +0,0 @@
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.htmldeleted−36
@@ -1,36 +0,0 @@
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.htmldeleted−52
@@ -1,52 +0,0 @@
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.htmldeleted−1
@@ -1 +0,0 @@
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.jsondeleted−1
@@ -1 +0,0 @@
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.jsdeleted−2
@@ -1,2 +0,0 @@
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.pngdeleted

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.haddockdeleted

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.txtdeleted−429
@@ -1,429 +0,0 @@
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.jsondeleted−1
@@ -1 +0,0 @@
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.gifdeleted

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.cssdeleted−647
@@ -1,647 +0,0 @@
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.gifdeleted

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.cssdeleted−164
@@ -1,164 +0,0 @@
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.jsdeleted−2
@@ -1,2 +0,0 @@
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.htmldeleted−174
@@ -1,174 +0,0 @@
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.htmldeleted−70
@@ -1,70 +0,0 @@
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.htmldeleted−903
@@ -1,903 +0,0 @@
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.htmldeleted−484
@@ -1,484 +0,0 @@
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.htmldeleted−648
@@ -1,648 +0,0 @@
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.htmldeleted−51
@@ -1,51 +0,0 @@
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.htmldeleted−177
@@ -1,177 +0,0 @@
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.htmldeleted−101
@@ -1,101 +0,0 @@
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.jsdeleted−27
@@ -1,27 +0,0 @@
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.cssdeleted−55
@@ -1,55 +0,0 @@
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.pngdeleted

Binary file not shown.

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

Binary file not shown.

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

No changes to the content.

build/x86_64-linux/ghc-8.6.5/laop-0.1.0.0/setup-configdeleted

Binary file not shown.

cache/compilerdeleted

Binary file not shown.

cache/configdeleted

Binary file not shown.

cache/elaborated-plandeleted

Binary file not shown.

cache/improved-plandeleted

Binary file not shown.

cache/plan.jsondeleted−1
@@ -1 +0,0 @@
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-plandeleted

Binary file not shown.

cache/source-hashesdeleted

Binary file not shown.

cache/up-to-datedeleted

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.hsdeleted−50
@@ -1,50 +0,0 @@
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.hdeleted−118
@@ -1,118 +0,0 @@
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/configdeleted

Binary file not shown.

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

Binary file not shown.

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

No changes to the content.

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

Binary file not shown.

dist-newstyle/cache/compilerdeleted

Binary file not shown.

dist-newstyle/cache/configdeleted

Binary file not shown.

dist-newstyle/cache/elaborated-plandeleted

Binary file not shown.

dist-newstyle/cache/improved-plandeleted

Binary file not shown.

dist-newstyle/cache/plan.jsondeleted−1
@@ -1 +0,0 @@
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-plandeleted

Binary file not shown.

dist-newstyle/cache/source-hashesdeleted

Binary file not shown.

dist-newstyle/cache/up-to-datedeleted

Binary file not shown.

dist-newstyle/packagedb/ghc-8.6.5/package.cachedeleted

Binary file not shown.

dist-newstyle/packagedb/ghc-8.6.5/package.cache.lockdeleted

No changes to the content.

dist/cabal-config-flagsdeleted

Binary file not shown.

dist/laop-0.1.0.0.tar.gzdeleted

Binary file not shown.

dist/setup-configdeleted

Binary file not shown.

hackage.shdeleted−10
@@ -1,10 +0,0 @@
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.gzdeleted

Binary file not shown.

laop.cabalnew file+89
@@ -0,0 +1,89 @@
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.yamldeleted−48
@@ -1,48 +0,0 @@
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.cachedeleted

Binary file not shown.

packagedb/ghc-8.6.5/package.cache.lockdeleted

No changes to the content.

src/LAoP/Dist.hs+10
@@ -36,6 +36,14 @@ 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+
3947 -- * Functor instance equivalent functions
4048 fmapD,
4149
@@ -45,6 +53,8 @@ module LAoP.Dist
4553
4654 -- * Selective equivalent functions
4755 selectD,
56+ branchD,
57+ ifD,
4858
4959 -- * Monad equivalent functions
5060 returnD,
src/LAoP/Dist/Internal.hs+87−36
@@ -1,3 +1,5 @@
1+{-# LANGUAGE DerivingVia #-}
2+{-# LANGUAGE ConstraintKinds #-}
13{-# LANGUAGE GADTs #-}
24{-# LANGUAGE AllowAmbiguousTypes #-}
35{-# LANGUAGE TypeApplications #-}
@@ -8,18 +10,27 @@
810{-# LANGUAGE RankNTypes #-}
911
1012module LAoP.Dist.Internal
11− (
13+ (
1214 Dist(..),
1315 Prob,
1416
17+ Countable,
18+ CountableN,
19+ CountableDimsN,
20+ FLN,
21+ Liftable,
22+ TrivialP,
23+
1524 fmapD,
1625 unitD,
1726 multD,
1827 selectD,
28+ branchD,
29+ ifD,
1930 returnD,
2031 bindD,
2132 (??),
22−
33+
2334 choose,
2435 shape,
2536 linear,
@@ -32,11 +43,15 @@ module LAoP.Dist.Internal
3243 )
3344 where
3445
35−import LAoP.Matrix.Type
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
3649import LAoP.Utils
3750import GHC.TypeLits
3851import Data.Proxy
3952import Data.List (sortBy)
53+import Control.DeepSeq
54+import Data.Bool
4055
4156-- | Type synonym for probability value
4257type Prob = Double
@@ -44,17 +59,21 @@ type Prob = Double
4459-- | Type synonym for column vector matrices. This represents a probability
4560-- distribution.
4661newtype 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)
4771
4872-- | Functor instance
4973fmapD ::
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)
74+ ( Liftable a b,
75+ CountableDimsN a b,
76+ FLN b a
5877 )
5978 =>
6079 (a -> b) -> Dist a -> Dist b
@@ -66,26 +85,58 @@ unitD = D (one 1)
6685
6786-- | Applicative/Monoidal instance 'mult' function
6887multD ::
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)
88+ ( CountableDimsN a b,
89+ CountableN (a, b),
90+ FLN (a, b) a,
91+ FLN (a, b) b,
92+ TrivialP a b
7593 ) => Dist a -> Dist b -> Dist (a, b)
76−multD (D a) (D b) = D (khatri a b)
94+multD (D a) (D b) = D (kr a b)
7795
7896-- | Selective instance function
7997selectD ::
80− ( Normalize (Either a b) ~ Either (Normalize a) (Normalize b),
81− FromLists Prob (Normalize b) (Normalize b),
82− KnownNat (Count (Normalize b))
98+ ( FLN b b,
99+ CountableN b
83100 ) => Dist (Either a b) -> Matrix Prob a b -> Dist b
84−selectD (D d) m = D (junc m identity `comp` d)
85−
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
86137
87138-- | Monad instance 'return' function
88−returnD :: forall a . (Enum a, FromLists Prob () (Normalize a), KnownNat (Count a)) => a -> Dist a
139+returnD :: forall a . (Enum a, FLN () a, Countable a) => a -> Dist a
89140returnD a = D (col l)
90141 where
91142 i = fromInteger $ natVal (Proxy :: Proxy (Count a))
@@ -99,8 +150,8 @@ bindD (D d) m = D (m `comp` d)
99150-- | Extract probabilities given an Event.
100151(??) ::
101152 ( Enum a,
102− KnownNat (Count a),
103− FromLists Prob () (Normalize a)
153+ Countable a,
154+ FLN () a
104155 ) => (a -> Bool) -> Dist a -> Prob
105156(??) p d =
106157 let l = toValues d
@@ -110,11 +161,11 @@ bindD (D d) m = D (m `comp` d)
110161-- Distribution Construction
111162
112163-- | Constructs a Bernoulli distribution
113−choose :: (FromLists Prob () (Normalize a)) => Prob -> Dist a
164+choose :: (FLN () a) => Prob -> Dist a
114165choose prob = D (col [prob, 1 - prob])
115166
116167-- | Creates a distribution given a shape function
117−shape :: (FromLists Prob () (Normalize a)) => (Prob -> Prob) -> [a] -> Dist a
168+shape :: (FLN () a) => (Prob -> Prob) -> [a] -> Dist a
118169shape _ [] = error "Probability.shape: empty list"
119170shape f xs =
120171 let incr = 1 / fromIntegral (length xs - 1)
@@ -122,23 +173,23 @@ shape f xs =
122173 in fromFreqs (zip xs ps)
123174
124175-- | Constructs a Linear distribution
125−linear :: (FromLists Prob () (Normalize a)) => [a] -> Dist a
176+linear :: (FLN () a) => [a] -> Dist a
126177linear = shape id
127178
128179-- | Constructs an Uniform distribution
129−uniform :: (FromLists Prob () (Normalize a)) => [a] -> Dist a
180+uniform :: (FLN () a) => [a] -> Dist a
130181uniform = shape (const 1)
131182
132183-- | Constructs an Negative Exponential distribution
133−negExp :: (FromLists Prob () (Normalize a)) => [a] -> Dist a
184+negExp :: (FLN () a) => [a] -> Dist a
134185negExp = shape (\x -> exp (-x))
135186
136187-- | Constructs an Normal distribution
137−normal :: (FromLists Prob () (Normalize a)) => [a] -> Dist a
188+normal :: (FLN () a) => [a] -> Dist a
138189normal = shape (normalCurve 0.5 0.5)
139190
140191-- | Transforms a 'Dist' into a list of pairs.
141−toValues :: forall a . (Enum a, KnownNat (Count a), FromLists Prob () (Normalize a)) => Dist a -> [(a, Prob)]
192+toValues :: forall a . (Enum a, Countable a, FLN () a) => Dist a -> [(a, Prob)]
142193toValues (D d) =
143194 let rows = fromInteger (natVal (Proxy :: Proxy (Count a)))
144195 probs = toList d
@@ -146,7 +197,7 @@ toValues (D d) =
146197 in res
147198
148199-- | Pretty a distribution
149−prettyDist :: forall a. (Show a, Enum a, KnownNat (Count a), FromLists Prob () (Normalize a)) => Dist a -> String
200+prettyDist :: forall a. (Show a, Enum a, Countable a, FLN () a) => Dist a -> String
150201prettyDist d =
151202 let values = sortBy (\(a, p1) (b, p2) -> compare p2 p1) (toValues @a d)
152203 w = maximum (map (length . show . fst) values)
@@ -158,12 +209,12 @@ prettyDist d =
158209 showR n x = show x ++ " "
159210
160211-- | Pretty Print a distribution
161−prettyPrintDist :: forall a . (Show a, Enum a, KnownNat (Count a), FromLists Prob () (Normalize a)) => Dist a -> IO ()
212+prettyPrintDist :: forall a . (Show a, Enum a, Countable a, FLN () a) => Dist a -> IO ()
162213prettyPrintDist = putStrLn . prettyDist @a
163214
164215-- Auxiliary functions
165216
166−fromFreqs :: (FromLists Prob () (Normalize a)) => [(a,Prob)] -> Dist a
217+fromFreqs :: (FLN () a) => [(a,Prob)] -> Dist a
167218fromFreqs xs = D (col (map (\(x,p) -> p/q) xs))
168219 where q = sum $ map snd xs
169220
src/LAoP/Matrix/Internal.hs+445−436
@@ -1,4 +1,6 @@
1+{-# LANGUAGE StrictData #-}
12{-# LANGUAGE TypeFamilyDependencies #-}
3+{-# LANGUAGE ConstraintKinds #-}
24{-# LANGUAGE AllowAmbiguousTypes #-}
35{-# LANGUAGE DataKinds #-}
46{-# LANGUAGE FlexibleContexts #-}
@@ -28,7 +30,7 @@
2830-- motivation behind the library, the underlying theory, and implementation details.
2931--
3032-- This module offers many of the combinators mentioned in the work of
31−-- Macedo (2012) and Oliveira (2012).
33+-- Macedo (2012) and Oliveira (2012).
3234--
3335-- This is an Internal module and it is no supposed to be imported.
3436--
@@ -41,17 +43,26 @@ module LAoP.Matrix.Internal
4143 --
4244 -- There exists two type families that make it easier to write
4345 -- matrix dimensions: 'FromNat' and 'Count'. This approach
44− -- leads to a very straightforward implementation
45− -- of LAoP combinators.
46+ -- leads to a very straightforward implementation
47+ -- of LAoP combinators.
4648
4749 -- * Type safe matrix representation
4850 Matrix (..),
4951
52+ -- * Constraint type aliases
53+ Countable,
54+ CountableDims,
55+ CountableN,
56+ CountableDimsN,
57+ FL,
58+ FLN,
59+ Liftable,
60+ Trivial,
61+
5062 -- * Primitives
51− empty,
5263 one,
53− junc,
54− split,
64+ join,
65+ fork,
5566
5667 -- * Auxiliary type families
5768 FromNat,
@@ -64,6 +75,7 @@ module LAoP.Matrix.Internal
6475 toLists,
6576 toList,
6677 matrixBuilder,
78+ matrixBuilder',
6779 row,
6880 col,
6981 zeros,
@@ -74,28 +86,38 @@ module LAoP.Matrix.Internal
7486 -- * Misc
7587 -- ** Get dimensions
7688 columns,
89+ columns',
7790 rows,
91+ rows',
7892
7993 -- ** Matrix Transposition
8094 tr,
8195
96+ -- ** Scalar multiplication/division of matrices
97+ (.|),
98+ (./),
99+
82100 -- ** Selective operator
83− select,
101+ select,
102+ branch,
84103
85104 -- ** McCarthy's Conditional
86105 cond,
87106
88107 -- ** Matrix "abiding"
89− abideJS,
90− abideSJ,
108+ abideJF,
109+ abideFJ,
110+
111+ -- ** Zip matrices
112+ zipWithM,
91113
92114 -- * Biproduct approach
93− -- ** Split
115+ -- ** Fork
94116 (===),
95117 -- *** Projections
96118 p1,
97119 p2,
98− -- ** Junc
120+ -- ** Join
99121 (|||),
100122 -- *** Injections
101123 i1,
@@ -108,12 +130,13 @@ module LAoP.Matrix.Internal
108130
109131 -- | Note that given the restrictions imposed it is not possible to
110132 -- implement the standard type classes present in standard Haskell.
133+
111134 -- *** Matrix pairing projections
112− kp1,
113− kp2,
135+ fstM,
136+ sndM,
114137
115138 -- *** Matrix pairing
116− khatri,
139+ kr,
117140
118141 -- * Matrix composition and lifting
119142
@@ -121,10 +144,10 @@ module LAoP.Matrix.Internal
121144
122145 -- | Note that given the restrictions imposed it is not possible to
123146 -- implement the standard type classes present in standard Haskell.
124− identity,
147+ iden,
125148 comp,
126− fromF,
127149 fromF',
150+ fromF,
128151
129152 -- * Matrix printing
130153 pretty,
@@ -151,21 +174,22 @@ import LAoP.Utils.Internal
151174import Data.Bool
152175import Data.Kind
153176import Data.List
177+import Data.Maybe
154178import Data.Proxy
179+import Data.Typeable
155180import Data.Void
156181import GHC.TypeLits
157182import Data.Type.Equality
158183import GHC.Generics
159184import Control.DeepSeq
160−import Control.Category
161−import Prelude hiding ((.))
185+import Prelude hiding (id, (.))
186+import qualified Prelude (id, (.))
162187
163188-- | LAoP (Linear Algebra of Programming) Inductive Matrix definition.
164189data Matrix e cols rows where
165− Empty :: Matrix e Void Void
166190 One :: e -> Matrix e () ()
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)
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)
169193
170194deriving instance (Show e) => Show (Matrix e cols rows)
171195
@@ -175,221 +199,214 @@ deriving instance (Show e) => Show (Matrix e cols rows)
175199-- 'Generic' instance.
176200type family Count (d :: Type) :: Nat where
177201 Count (Natural n m) = (m - n) + 1
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)
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)
181206 -- Generics
182− Count (M1 _ _ f p) = Count (f p)
183− Count (K1 _ _ _) = 1
184− Count (V1 _) = 0
185− Count (U1 _) = 1
207+ Count (M1 _ _ f p) = Count (f p)
208+ Count (K1 _ _ _) = 1
209+ Count (V1 _) = 0
210+ Count (U1 _) = 1
186211 Count ((:*:) a b p) = Count (a p) * Count (b p)
187212 Count ((:+:) a b p) = Count (a p) + Count (b p)
188− Count d = Count (Rep d R)
213+ Count d = Count (Rep d R)
189214
190215-- | Type family that computes of a given type dimension from a given natural
191216--
192217-- Thanks to Li-Yao Xia this type family is super fast.
193218type family FromNat (n :: Nat) :: Type where
194− FromNat 0 = Void
195219 FromNat 1 = ()
196220 FromNat n = FromNat' (Mod n 2 == 0) (FromNat (Div n 2))
197221
198222type family FromNat' (b :: Bool) (m :: Type) :: Type where
199− FromNat' 'True m = Either m m
223+ FromNat' 'True m = Either m m
200224 FromNat' 'False m = Either () (Either m m)
201225
202226-- | Type family that normalizes the representation of a given data
203227-- structure
204228type family Normalize (d :: Type) :: Type where
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.
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.
212244instance (Num e) => Category (Matrix e) where
213− id = undefined
214− (.) = comp
245+ type Object (Matrix e) a = (FL a a, Countable a)
246+ id = iden
247+ (.) = comp
215248
216249instance NFData e => NFData (Matrix e cols rows) where
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
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
221253
222254instance Eq e => Eq (Matrix e cols rows) where
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
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
229260
230261instance 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)
231271
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)
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)
262275
263276instance Ord e => Ord (Matrix e cols rows) where
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
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
270282
271283-- Primitives
272284
273−-- | Empty matrix constructor
274−empty :: Matrix e Void Void
275−empty = Empty
276−
277285-- | Unit matrix constructor
278286one :: e -> Matrix e () ()
279287one = One
280288
281−-- | Matrix 'Junc' constructor
282−junc :: Matrix e a rows -> Matrix e b rows -> Matrix e (Either a b) rows
283−junc = Junc
289+-- | Matrix 'Join' constructor
290+join :: Matrix e a rows -> Matrix e b rows -> Matrix e (Either a b) rows
291+join = Join
284292
285293infixl 3 |||
286294
287−-- | Matrix 'Junc' constructor
295+-- | Matrix 'Join' constructor
288296(|||) :: Matrix e a rows -> Matrix e b rows -> Matrix e (Either a b) rows
289−(|||) = Junc
297+(|||) = Join
290298
291−-- | Matrix 'Split' constructor
292−split :: Matrix e cols a -> Matrix e cols b -> Matrix e cols (Either a b)
293−split = Split
299+-- | Matrix 'Fork' constructor
300+fork :: Matrix e cols a -> Matrix e cols b -> Matrix e cols (Either a b)
301+fork = Fork
294302
295303infixl 2 ===
296304
297−-- | Matrix 'Split' constructor
305+-- | Matrix 'Fork' constructor
298306(===) :: Matrix e cols a -> Matrix e cols b -> Matrix e cols (Either a b)
299−(===) = Split
307+(===) = Fork
300308
301309-- Construction
302310
303311-- | Type class for defining the 'fromList' conversion function.
304312--
305313-- Given that it is not possible to branch on types at the term level type
306−-- classes are needed bery much like an inductive definition but on types.
307−class FromLists e cols rows where
314+-- classes are needed very much like an inductive definition but on types.
315+class FromLists cols rows where
308316 -- | Build a matrix out of a list of list of elements. Throws a runtime
309317 -- error if the dimensions do not match.
310318 fromLists :: [[e]] -> Matrix e cols rows
311319
312−instance FromLists e Void Void where
313− fromLists [] = Empty
314− fromLists _ = error "Wrong dimensions"
315−
316−instance {-# OVERLAPPING #-} FromLists e () () where
320+instance FromLists () () where
317321 fromLists [[e]] = One e
318322 fromLists _ = error "Wrong dimensions"
319323
320−instance {-# OVERLAPPING #-} (FromLists e cols ()) => FromLists e (Either () cols) () where
321− fromLists [h : t] = Junc (One h) (fromLists [t])
324+instance (FromLists cols ()) => FromLists (Either () cols) () where
325+ fromLists [h : t] = Join (One h) (fromLists [t])
322326 fromLists _ = error "Wrong dimensions"
323327
324−instance {-# OVERLAPPABLE #-} (FromLists e a (), FromLists e b (), KnownNat (Count a)) => FromLists e (Either a b) () where
325− fromLists [l] =
328+instance {-# OVERLAPPABLE #-}
329+ (FromLists a (), FromLists b (), Countable a) => FromLists (Either a b) () where
330+ fromLists [l] =
326331 let rowsA = fromInteger (natVal (Proxy :: Proxy (Count a)))
327− in Junc (fromLists [take rowsA l]) (fromLists [drop rowsA l])
332+ in Join (fromLists [take rowsA l]) (fromLists [drop rowsA l])
328333 fromLists _ = error "Wrong dimensions"
329334
330−instance {-# OVERLAPPING #-} (FromLists e () rows) => FromLists e () (Either () rows) where
331− fromLists ([h] : t) = Split (One h) (fromLists t)
335+instance (FromLists () rows) => FromLists () (Either () rows) where
336+ fromLists ([h] : t) = Fork (One h) (fromLists t)
332337 fromLists _ = error "Wrong dimensions"
333338
334−instance {-# OVERLAPPABLE #-} (FromLists e () a, FromLists e () b, KnownNat (Count a)) => FromLists e () (Either a b) where
335− fromLists l@([_] : _) =
339+instance {-# OVERLAPPABLE #-}
340+ (FromLists () a, FromLists () b, Countable a) => FromLists () (Either a b) where
341+ fromLists l@([_] : _) =
336342 let rowsA = fromInteger (natVal (Proxy :: Proxy (Count a)))
337− in Split (fromLists (take rowsA l)) (fromLists (drop rowsA l))
343+ in Fork (fromLists (take rowsA l)) (fromLists (drop rowsA l))
338344 fromLists _ = error "Wrong dimensions"
339345
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
346+instance (FromLists (Either a b) c, FromLists (Either a b) d, Countable c)
347+ => FromLists (Either a b) (Either c d) where
341348 fromLists l@(h : t) =
342349 let lh = length h
343350 rowsC = fromInteger (natVal (Proxy :: Proxy (Count c)))
344− condition = all (== lh) (map length t)
351+ condition = all ((== lh) . length) t
345352 in if lh > 0 && condition
346− then Split (fromLists (take rowsC l)) (fromLists (drop rowsC l))
353+ then Fork (fromLists (take rowsC l)) (fromLists (drop rowsC l))
347354 else error "Not all rows have the same length"
348355
349356-- | Matrix builder function. Constructs a matrix provided with
350−-- a construction function.
351−matrixBuilder ::
357+-- a construction function that operates with indices.
358+matrixBuilder' ::
352359 forall e cols rows.
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 =
360+ ( FL cols rows,
361+ CountableDims cols rows
362+ ) => ((Int, Int) -> e) -> Matrix e cols rows
363+matrixBuilder' f =
360364 let c = fromInteger $ natVal (Proxy :: Proxy (Count cols))
361365 r = fromInteger $ natVal (Proxy :: Proxy (Count rows))
362366 positions = [(a, b) | a <- [0 .. (r - 1)], b <- [0 .. (c - 1)]]
363367 in fromLists . map (map f) . groupBy (\(x, _) (w, _) -> x == w) $ positions
364368
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+
365389-- | Constructs a column vector matrix
366−col :: (FromLists e () rows) => [e] -> Matrix e () rows
390+col :: (FL () rows) => [e] -> Matrix e () rows
367391col = fromLists . map (: [])
368392
369393-- | Constructs a row vector matrix
370−row :: (FromLists e cols ()) => [e] -> Matrix e cols ()
394+row :: (FL cols ()) => [e] -> Matrix e cols ()
371395row = fromLists . (: [])
372396
373397-- | Lifts functions to matrices with arbitrary dimensions.
374398--
375399-- NOTE: Be careful to not ask for a matrix bigger than the cardinality of
376400-- types @a@ or @b@ allows.
377−fromF ::
401+fromF' ::
378402 forall a b cols rows e.
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
403+ ( Liftable e a b,
404+ CountableDims cols rows,
405+ FL rows cols
389406 ) =>
390407 (a -> b) ->
391408 Matrix e cols rows
392−fromF f =
409+fromF' f =
393410 let minA = minBound @a
394411 maxA = maxBound @a
395412 minB = minBound @b
@@ -399,8 +416,8 @@ fromF f =
399416 elementsA = take ccols [minA .. maxA]
400417 elementsB = take rrows [minB .. maxB]
401418 combinations = (,) <$> elementsA <*> elementsB
402− combAp = map snd . sort . map (\(a, b) -> if f a == b
403− then ((fromEnum a, fromEnum b), 1)
419+ combAp = map snd . sort . map (\(a, b) -> if f a == b
420+ then ((fromEnum a, fromEnum b), 1)
404421 else ((fromEnum a, fromEnum b), 0)) $ combinations
405422 mList = buildList combAp rrows
406423 in tr $ fromLists mList
@@ -410,48 +427,23 @@ fromF f =
410427
411428-- | Lifts functions to matrices with dimensions matching @a@ and @b@
412429-- cardinality's.
413−fromF' ::
430+fromF ::
414431 forall a b e.
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)
432+ ( Liftable e a b,
433+ CountableDimsN a b,
434+ FLN b a
425435 ) =>
426436 (a -> b) ->
427437 Matrix e (Normalize a) (Normalize b)
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
438+fromF = fromF'
446439
447440-- Conversion
448441
449442-- | Converts a matrix to a list of lists of elements.
450443toLists :: Matrix e cols rows -> [[e]]
451−toLists Empty = []
452444toLists (One e) = [[e]]
453−toLists (Split l r) = toLists l ++ toLists r
454−toLists (Junc l r) = zipWith (++) (toLists l) (toLists r)
445+toLists (Fork l r) = toLists l ++ toLists r
446+toLists (Join l r) = zipWith (++) (toLists l) (toLists r)
455447
456448-- | Converts a matrix to a list of elements.
457449toList :: Matrix e cols rows -> [e]
@@ -460,37 +452,38 @@ toList = concat . toLists
460452-- Zeros Matrix
461453
462454-- | The zero matrix. A matrix wholly filled with zeros.
463−zeros :: (Num e, FromLists e cols rows, KnownNat (Count cols), KnownNat (Count rows)) => Matrix e cols rows
464−zeros = matrixBuilder (const 0)
455+zeros :: (Num e, FL cols rows, CountableDims cols rows) => Matrix e cols rows
456+zeros = matrixBuilder' (const 0)
465457
466458-- Ones Matrix
467459
468460-- | The ones matrix. A matrix wholly filled with ones.
469461--
470462-- Also known as T (Top) matrix.
471−ones :: (Num e, FromLists e cols rows, KnownNat (Count cols), KnownNat (Count rows)) => Matrix e cols rows
472−ones = matrixBuilder (const 1)
463+ones :: (Num e, FL cols rows, CountableDims cols rows) => Matrix e cols rows
464+ones = matrixBuilder' (const 1)
473465
474466-- Const Matrix
475467
476468-- | The constant matrix constructor. A matrix wholly filled with a given
477469-- value.
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)
470+constant :: (Num e, FL cols rows, CountableDims cols rows) => e -> Matrix e cols rows
471+constant e = matrixBuilder' (const e)
480472
481473-- Bang Matrix
482474
483475-- | The T (Top) row vector matrix.
484−bang :: forall e cols. (Num e, Enum e, FromLists e cols (), KnownNat (Count cols)) => Matrix e cols ()
476+bang :: forall e cols. (Num e, Enum e, FL cols (), Countable cols) => Matrix e cols ()
485477bang =
486478 let c = fromInteger $ natVal (Proxy :: Proxy (Count cols))
487479 in fromLists [take c [1, 1 ..]]
488480
489−-- Identity Matrix
481+-- iden Matrix
490482
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 (==))
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 #-}
494487
495488-- Matrix composition (MMM)
496489
@@ -499,60 +492,90 @@ identity = matrixBuilder (bool 0 1 . uncurry (==))
499492-- This definition takes advantage of divide-and-conquer and fusion laws
500493-- from LAoP.
501494comp :: (Num e) => Matrix e cr rows -> Matrix e cols cr -> Matrix e cols rows
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
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)
507522
508523-- Projections
509524
510525-- | Biproduct first component projection
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
526+p1 :: (Num e, CountableDims n m, FL n m, FL m m) => Matrix e (Either m n) m
527+p1 = join id zeros
516528
517529-- | Biproduct second component projection
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
530+p2 :: (Num e, CountableDims n m, FL m n, FL n n) => Matrix e (Either m n) n
531+p2 = join zeros id
523532
524533-- Injections
525534
526535-- | Biproduct first component injection
527−i1 :: (Num e, KnownNat (Count n), KnownNat (Count m), FromLists e n m, FromLists e m m) => Matrix e m (Either m n)
536+i1 :: (Num e, CountableDims n m, FL n m, FL m m) => Matrix e m (Either m n)
528537i1 = tr p1
529538
530539-- | Biproduct second component injection
531−i2 :: (Num e, KnownNat (Count n), KnownNat (Count m), FromLists e m n, FromLists e n n) => Matrix e n (Either m n)
540+i2 :: (Num e, CountableDims n m, FL m n, FL n n) => Matrix e n (Either m n)
532541i2 = tr p2
533542
534543-- Dimensions
535544
536545-- | Obtain the number of rows.
537546--
538−-- NOTE: The 'KnownNat' constaint is needed in order to obtain the
539−-- dimensions in constant time.
540−--
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
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
544551rows _ = fromInteger $ natVal (Proxy :: Proxy (Count rows))
545552
553+-- | Obtain the number of rows in an inefficient manner, but without any
554+-- constraints.
555+--
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
561+
546562-- | Obtain the number of columns.
547−--
548−-- NOTE: The 'KnownNat' constaint is needed in order to obtain the
549−-- dimensions in constant time.
550563--
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
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
554568columns _ = fromInteger $ natVal (Proxy :: Proxy (Count cols))
555569
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+
556579-- Coproduct Bifunctor
557580
558581infixl 5 -|-
@@ -561,157 +584,172 @@ infixl 5 -|-
561584(-|-) ::
562585 forall e n k m j.
563586 ( Num e,
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
587+ CountableDims j k,
588+ FL k k,
589+ FL j k,
590+ FL k j,
591+ FL j j
570592 ) =>
571593 Matrix e n k ->
572594 Matrix e m j ->
573595 Matrix e (Either n m) (Either k j)
574−(-|-) a b = Junc (i1 . a) (i2 . b)
596+(-|-) a b = Join (i1 . a) (i2 . b)
575597
576598-- Khatri Rao Product and projections
577599
578600-- | Khatri Rao product first component projection matrix.
579−kp1 ::
601+fstM ::
580602 forall e m k .
581603 ( Num e,
582− KnownNat (Count k),
583− FromLists e (FromNat (Count m * Count k)) m,
584− KnownNat (Count m),
585− KnownNat (Count (Normalize (m, k)))
604+ CountableDims k m,
605+ FL (Normalize (m, k)) m,
606+ CountableN (m, k)
586607 ) => Matrix e (Normalize (m, k)) m
587−kp1 = matrixBuilder f
608+fstM = matrixBuilder' f
588609 where
589610 offset = fromInteger (natVal (Proxy :: Proxy (Count k)))
590611 f (x, y)
591612 | y >= (x * offset) && y <= (x * offset + offset - 1) = 1
592− | otherwise = 0
613+ | otherwise = 0
593614
594615-- | Khatri Rao product second component projection matrix.
595−kp2 ::
616+sndM ::
596617 forall e m k .
597618 ( Num e,
598− KnownNat (Count k),
599− FromLists e (FromNat (Count m * Count k)) k,
600− KnownNat (Count m),
601− KnownNat (Count (Normalize (m, k)))
619+ CountableDims k m,
620+ FL (Normalize (m, k)) k,
621+ CountableN (m, k)
602622 ) => Matrix e (Normalize (m, k)) k
603−kp2 = matrixBuilder f
623+sndM = matrixBuilder' f
604624 where
605625 offset = fromInteger (natVal (Proxy :: Proxy (Count k)))
606626 f (x, y)
607627 | x == y || mod (y - x) offset == 0 = 1
608− | otherwise = 0
628+ | otherwise = 0
609629
610630-- | Khatri Rao Matrix product also known as matrix pairing.
611631--
612632-- NOTE: That this is not a true categorical product, see for instance:
613−--
633+--
614634-- @
615−-- | kp1 . khatri a b == a
616−-- khatri a b ==> |
617−-- | kp2 . khatri a b == b
635+-- | fstM . kr a b == a
636+-- kr a b ==> |
637+-- | sndM . kr a b == b
618638-- @
619639--
620640-- __Emphasis__ on the implication symbol.
621−khatri ::
622− forall e cols a b.
641+kr ::
642+ forall e cols a b.
623643 ( Num e,
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
644+ CountableDims a b,
645+ CountableN (a, b),
646+ FL (Normalize (a, b)) a,
647+ FL (Normalize (a, b)) b
629648 ) => Matrix e cols a -> Matrix e cols b -> Matrix e cols (Normalize (a, 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
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)
634653
635654-- Product Bifunctor (Kronecker)
636655
637656infixl 4 ><
638657
639658-- | Matrix product functor also known as kronecker product
640−(><) ::
641− forall e m p n q.
659+(><) ::
660+ forall e m p n q.
642661 ( Num e,
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− )
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+ )
654670 => Matrix e m p -> Matrix e n q -> Matrix e (Normalize (m, n)) (Normalize (p, q))
655671(><) a b =
656− let kp1' = kp1 @e @m @n
657− kp2' = kp2 @e @m @n
658− in khatri (a . kp1') (b . kp2')
672+ let fstM' = fstM @e @m @n
673+ sndM' = sndM @e @m @n
674+ in kr (a . fstM') (b . sndM')
659675
660−-- Matrix abide Junc Split
676+-- Matrix abide Join Fork
661677
662−-- | Matrix "abiding" followin the 'Junc'-'Split' abide law.
663−--
678+-- | Matrix "abiding" following the 'Join'-'Fork' exchange law.
679+--
664680-- Law:
665681--
666682-- @
667−-- 'Junc' ('Split' a c) ('Split' b d) == 'Split' ('Junc' a b) ('Junc' c d)
683+-- 'Join' ('Fork' a c) ('Fork' b d) == 'Fork' ('Join' a b) ('Join' c d)
668684-- @
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)
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)
675690
676−-- Matrix abide Split Junc
691+-- Matrix abide Fork Join
677692
678−-- | Matrix "abiding" followin the 'Split'-'Junc' abide law.
679−--
693+-- | Matrix "abiding" followin the 'Fork'-'Join' abide law.
694+--
680695-- @
681−-- 'Split' ('Junc' a b) ('Junc' c d) == 'Junc' ('Split' a c) ('Split' b d)
696+-- 'Fork' ('Join' a b) ('Join' c d) == 'Join' ('Fork' a c) ('Fork' b d)
682697-- @
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)
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)
689703
690704-- Matrix transposition
691705
692706-- | Matrix transposition.
693707tr :: Matrix e cols rows -> Matrix e rows cols
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)
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)
698711
699712-- Selective 'select' operator
700713
701714-- | Selective functors 'select' operator equivalent inspired by the
702715-- ArrowMonad solution presented in the paper.
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
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
705743
706744-- McCarthy's Conditional
707745
708746-- | McCarthy's Conditional expresses probabilistic choice.
709747cond ::
710− ( cols ~ FromNat (Count cols),
711− KnownNat (Count cols),
712− FromLists e () cols,
713− FromLists e cols (),
714− FromLists e cols cols,
748+ ( Trivial cols,
749+ Countable cols,
750+ FL () cols,
751+ FL cols (),
752+ FL cols cols,
715753 Bounded a,
716754 Enum a,
717755 Num e,
@@ -719,14 +757,14 @@ cond ::
719757 )
720758 =>
721759 (a -> Bool) -> Matrix e cols rows -> Matrix e cols rows -> Matrix e cols rows
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,
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,
730768 Bounded a,
731769 Enum a,
732770 Num e,
@@ -734,63 +772,86 @@ grd ::
734772 )
735773 =>
736774 (a -> Bool) -> Matrix e q (Either q q)
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− )
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+ )
751786 => (a -> Bool) -> Matrix e q q
752−corr p = let f = fromF p :: Matrix e q ()
753− in khatri f (identity :: Matrix e q q)
787+corr p = let f = fromF' p :: Matrix e q ()
788+ in kr f (id :: Matrix e q q)
754789
755790-- Pretty print
756791
757792prettyAux :: Show e => [[e]] -> [[e]] -> String
758793prettyAux [] _ = ""
759−prettyAux [[e]] m = "│ " ++ fill (show e) ++ " │\n"
794+prettyAux [[e]] m = "│ " ++ fill (show e) ++ " │\n"
760795 where
761796 v = fmap show m
762797 widest = maximum $ fmap length v
763798 fill str = replicate (widest - length str - 2) ' ' ++ str
764−prettyAux [h] m = "│ " ++ fill (unwords $ map show h) ++ " │\n"
799+prettyAux [h] m = "│ " ++ fill (unwords $ map show h) ++ " │\n"
765800 where
766− v = fmap show m
767− widest = maximum $ fmap length v
801+ v = fmap show m
802+ widest = maximum $ fmap length v
768803 fill str = replicate (widest - length str - 2) ' ' ++ str
769−prettyAux (h : t) l = "│ " ++ fill (unwords $ map show h) ++ " │\n" ++
804+prettyAux (h : t) l = "│ " ++ fill (unwords $ map show h) ++ " │\n" ++
770805 prettyAux t l
771806 where
772− v = fmap show l
773− widest = maximum $ fmap length v
807+ v = fmap show l
808+ widest = maximum $ fmap length v
774809 fill str = replicate (widest - length str - 2) ' ' ++ str
775810
776811-- | Matrix pretty printer
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
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
784822 fill str = replicate (widest - length str) ' ' ++ str
785− blank = fill ""
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)
786839
787840-- | Matrix pretty printer
788−prettyPrint :: (KnownNat (Count cols), Show e) => Matrix e cols rows -> IO ()
841+prettyPrint :: (CountableDims cols rows, Show e) => Matrix e cols rows -> IO ()
789842prettyPrint = putStrLn . pretty
790843
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+
791852-- Relational operators functions
792853
793−type Boolean = Natural 0 1
854+type Boolean = Natural 0 1
794855type Relation a b = Matrix Boolean a b
795856
796857-- | Helper conversion function
@@ -806,54 +867,47 @@ fromBool False = nat 0
806867
807868-- | Relational negation
808869negateM :: Relation cols rows -> Relation cols rows
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)
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)
814873
815874-- | Relational addition
816875orM :: Relation cols rows -> Relation cols rows -> Relation cols rows
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
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
823881
824882-- | Relational multiplication
825883andM :: Relation cols rows -> Relation cols rows -> Relation cols rows
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
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
832889
833890-- | Relational subtraction
834891subM :: Relation cols rows -> Relation cols rows -> Relation cols rows
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
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
841897
842898-- | Matrix relational composition.
843899compRel :: Relation cr rows -> Relation cols cr -> Relation cols rows
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
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
849904
850905-- | Matrix relational right division
851906divR :: Relation b c -> Relation b a -> Relation a c
852−divR Empty Empty = Empty
853907divR (One a) (One b) = One (fromBool (not (toBool b) || toBool a)) -- b implies a
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)
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)
857911
858912-- | Matrix relational left division
859913divL :: Relation c b -> Relation a b -> Relation a c
@@ -869,97 +923,52 @@ divS s r = divL r s `intersection` divR (tr r) (tr s)
869923--
870924-- NOTE: Be careful to not ask for a relation bigger than the cardinality of
871925-- types @a@ or @b@ allows.
872−fromFRel ::
926+fromFRel' ::
873927 forall a b cols rows.
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
928+ ( Liftable Boolean a b,
929+ CountableDims cols rows,
930+ FL rows cols
882931 ) =>
883932 (a -> b) ->
884933 Relation cols rows
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
934+fromFRel' = fromF'
903935
904936-- | Lifts functions to relations with dimensions matching @a@ and @b@
905937-- cardinality's.
906−fromFRel' ::
938+fromFRel ::
907939 forall a b.
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)
940+ ( Liftable Boolean a b,
941+ CountableDimsN a b,
942+ FLN b a
916943 ) =>
917944 (a -> b) ->
918945 Relation (Normalize a) (Normalize b)
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
946+fromFRel = fromFRel'
937947
938948-- | Lifts a relation function to a Boolean Matrix
939−toRel ::
949+toRel ::
940950 forall a b.
941951 ( Bounded a,
942952 Bounded b,
943953 Enum a,
944954 Enum b,
945955 Eq b,
946− KnownNat (Count (Normalize a)),
947− KnownNat (Count (Normalize b)),
948− FromLists (Natural 0 1) (Normalize b) (Normalize a)
949− )
956+ CountableDims a b,
957+ FLN b a
958+ )
950959 => (a -> b -> Bool) -> Relation (Normalize a) (Normalize b)
951960toRel f =
952961 let minA = minBound @a
953962 maxA = maxBound @a
954963 minB = minBound @b
955964 maxB = maxBound @b
956− ccols = fromInteger $ natVal (Proxy :: Proxy (Count (Normalize a)))
957− rrows = fromInteger $ natVal (Proxy :: Proxy (Count (Normalize b)))
965+ ccols = fromInteger $ natVal (Proxy :: Proxy (Count a))
966+ rrows = fromInteger $ natVal (Proxy :: Proxy (Count b))
958967 elementsA = take ccols [minA .. maxA]
959968 elementsB = take rrows [minB .. maxB]
960969 combinations = (,) <$> elementsA <*> elementsB
961− combAp = map snd . sort . map (\(a, b) -> if uncurry f (a, b)
962− then ((fromEnum a, fromEnum b), nat 1)
970+ combAp = map snd . sort . map (\(a, b) -> if uncurry f (a, b)
971+ then ((fromEnum a, fromEnum b), nat 1)
963972 else ((fromEnum a, fromEnum b), nat 0)) $ combinations
964973 mList = buildList combAp rrows
965974 in tr $ fromLists mList
src/LAoP/Matrix/Nat.hs+194−187
@@ -1,3 +1,4 @@
1+{-# LANGUAGE ConstraintKinds #-}
12{-# LANGUAGE AllowAmbiguousTypes #-}
23{-# LANGUAGE DataKinds #-}
34{-# LANGUAGE DerivingVia #-}
@@ -53,11 +54,22 @@ module LAoP.Matrix.Nat
5354 -- * Type safe matrix representation
5455 Matrix (..),
5556
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+
5669 -- * Primitives
57− empty,
5870 one,
59− junc,
60− split,
71+ join,
72+ fork,
6173
6274 -- * Auxiliary type families
6375 I.FromNat,
@@ -65,11 +77,11 @@ module LAoP.Matrix.Nat
6577 I.Normalize,
6678
6779 -- * Matrix construction and conversion
68− I.FromLists,
80+ I.FL,
6981 fromLists,
7082 toLists,
7183 toList,
72− matrixBuilder,
84+ matrixBuilder',
7385 row,
7486 col,
7587 zeros,
@@ -85,6 +97,10 @@ module LAoP.Matrix.Nat
8597 -- ** Matrix Transposition
8698 tr,
8799
100+ -- ** Scalar multiplication/division of matrices
101+ (.|),
102+ (./),
103+
88104 -- ** Selective operator
89105 select,
90106
@@ -92,16 +108,19 @@ module LAoP.Matrix.Nat
92108 cond,
93109
94110 -- ** Matrix "abiding"
95− abideJS,
96− abideSJ,
111+ abideJF,
112+ abideFJ,
113+
114+ -- ** Zip Matrices
115+ zipWithM,
97116
98117 -- * Biproduct approach
99− -- ** Split
118+ -- ** Fork
100119 (===),
101120 -- *** Projections
102121 p1,
103122 p2,
104− -- ** Junc
123+ -- ** Join
105124 (|||),
106125 -- *** Injections
107126 i1,
@@ -115,11 +134,11 @@ module LAoP.Matrix.Nat
115134 -- | Note that given the restrictions imposed it is not possible to
116135 -- implement the standard type classes present in standard Haskell.
117136 -- *** Matrix pairing projections
118− kp1,
119− kp2,
137+ fstM,
138+ sndM,
120139
121140 -- *** Matrix pairing
122− khatri,
141+ kr,
123142
124143 -- * Matrix composition and lifting
125144
@@ -127,10 +146,10 @@ module LAoP.Matrix.Nat
127146
128147 -- | Note that given the restrictions imposed it is not possible to
129148 -- implement the standard type classes present in standard Haskell.
130− identity,
149+ iden,
131150 comp,
132− fromF,
133151 fromF',
152+ fromF,
134153
135154 -- * Matrix printing
136155 pretty,
@@ -141,107 +160,95 @@ where
141160import Data.Proxy
142161import GHC.TypeLits
143162import Control.DeepSeq
144−import qualified Control.Category as C
145163import qualified LAoP.Matrix.Internal as I
146164
147165newtype Matrix e (cols :: Nat) (rows :: Nat) = M (I.Matrix e (I.FromNat cols) (I.FromNat rows))
148166 deriving (Show, Num, Eq, Ord, NFData) via (I.Matrix e (I.FromNat cols) (I.FromNat rows))
149167
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
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))
158179
159180-- Primitives
160181
161−empty :: Matrix e 0 0
162−empty = M I.Empty
163−
164182one :: e -> Matrix e 1 1
165183one = M . I.One
166184
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)
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)
173191
174192infixl 3 |||
175193(|||) ::
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)
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)
188206
189207infixl 2 ===
190208(===) ::
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
209+ (TrivialE a b) =>
210+ Matrix e cols a ->
211+ Matrix e cols b ->
212+ Matrix e cols (a + b)
213+(===) = fork
196214
197215-- Construction
198216
199−fromLists :: (I.FromLists e (I.FromNat cols) (I.FromNat rows)) => [[e]] -> Matrix e cols rows
217+fromLists :: (FLN e cols rows) => [[e]] -> Matrix e cols rows
200218fromLists = M . I.fromLists
201219
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
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'
207226
208−col :: (I.FromLists e () (I.FromNat rows)) => [e] -> Matrix e 1 rows
227+col :: (I.FL () (I.FromNat rows)) => [e] -> Matrix e 1 rows
209228col = M . I.col
210229
211−row :: (I.FromLists e (I.FromNat cols) ()) => [e] -> Matrix e cols 1
230+row :: (I.FL (I.FromNat cols) ()) => [e] -> Matrix e cols 1
212231row = M . I.row
213232
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)
233+fromF' ::
234+ ( Liftable e a b,
235+ CountableN cols,
236+ CountableN rows,
237+ FLN e rows cols
225238 ) =>
226239 (a -> b) ->
227240 Matrix e cols rows
228−fromF = M . I.fromF
241+fromF' = M . I.fromF'
229242
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)
243+fromF ::
244+ ( Liftable e a b,
245+ CountableNz a,
246+ CountableNz b,
247+ FLNz e b a
241248 ) =>
242249 (a -> b) ->
243250 Matrix e (I.Count a) (I.Count b)
244−fromF' = M . I.fromF'
251+fromF = undefined -- M . I.fromF
245252
246253-- Conversion
247254
@@ -254,21 +261,21 @@ toList (M m) = I.toList m
254261-- Zeros Matrix
255262
256263zeros ::
257− (Num e, I.FromLists e (I.FromNat cols) (I.FromNat rows), KnownNat (I.Count (I.FromNat cols)), KnownNat (I.Count (I.FromNat rows))) =>
264+ (Num e, FLN e cols rows, CountableN cols, CountableN rows) =>
258265 Matrix e cols rows
259266zeros = M I.zeros
260267
261268-- Ones Matrix
262269
263270ones ::
264− (Num e, I.FromLists e (I.FromNat cols) (I.FromNat rows), KnownNat (I.Count (I.FromNat cols)), KnownNat (I.Count (I.FromNat rows))) =>
271+ (Num e, FLN e cols rows, CountableN cols, CountableN rows) =>
265272 Matrix e cols rows
266273ones = M I.ones
267274
268275-- Const Matrix
269276
270277constant ::
271− (Num e, I.FromLists e (I.FromNat cols) (I.FromNat rows), KnownNat (I.Count (I.FromNat cols)), KnownNat (I.Count (I.FromNat rows))) =>
278+ (Num e, FLN e cols rows, CountableN cols, CountableN rows) =>
272279 e ->
273280 Matrix e cols rows
274281constant = M . I.constant
@@ -277,40 +284,52 @@ constant = M . I.constant
277284
278285bang ::
279286 forall e cols.
280− (Num e, Enum e, I.FromLists e (I.FromNat cols) (), KnownNat (I.Count (I.FromNat cols))) =>
287+ (Num e, Enum e, I.FL (I.FromNat cols) (), CountableN cols) =>
281288 Matrix e cols 1
282289bang = M I.bang
283290
284−-- Identity Matrix
291+-- iden Matrix
285292
286−identity ::
287− (Num e, I.FromLists e (I.FromNat cols) (I.FromNat cols), KnownNat (I.Count (I.FromNat cols))) =>
293+iden ::
294+ (Num e, FLN e cols cols, CountableN cols) =>
288295 Matrix e cols cols
289−identity = M I.identity
296+iden = M I.iden
290297
291298-- Matrix composition (MMM)
292299
293300comp :: (Num e) => Matrix e cr rows -> Matrix e cols cr -> Matrix e cols rows
294301comp (M a) (M b) = M (I.comp a b)
295302
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+
296317p1 ::
297318 ( Num e,
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)
319+ CountableDimsN n m,
320+ FLN e n m,
321+ FLN e m m,
322+ TrivialE m n
303323 ) =>
304324 Matrix e (m + n) m
305325p1 = M I.p1
306326
307327p2 ::
308328 ( Num e,
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)
329+ CountableDimsN n m,
330+ FLN e m n,
331+ FLN e n n,
332+ TrivialE m n
314333 ) =>
315334 Matrix e (m + n) n
316335p2 = M I.p2
@@ -319,138 +338,125 @@ p2 = M I.p2
319338
320339i1 ::
321340 ( Num e,
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)
341+ CountableDimsN n rows,
342+ FLN e n rows,
343+ FLN e rows rows,
344+ TrivialE rows n
327345 ) =>
328346 Matrix e rows (rows + n)
329347i1 = tr p1
330348
331349i2 ::
332350 ( Num e,
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)
351+ CountableDimsN rows m,
352+ FLN e m rows,
353+ FLN e rows rows,
354+ TrivialE m rows
338355 ) =>
339356 Matrix e rows (m + rows)
340357i2 = tr p2
341358
342359-- Dimensions
343360
344−rows :: (KnownNat (I.Count (I.FromNat rows))) => Matrix e cols rows -> Int
361+rows :: (CountableN rows) => Matrix e cols rows -> Int
345362rows (M m) = I.rows m
346363
347−columns :: (KnownNat (I.Count (I.FromNat cols))) => Matrix e cols rows -> Int
364+columns :: (CountableN cols) => Matrix e cols rows -> Int
348365columns (M m) = I.columns m
349366
350−-- Coproduct Bifunctor
351−
352367infixl 5 -|-
353368
369+-- | Coproduct Bifunctor (Direct sum)
354370(-|-) ::
355371 ( Num e,
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)
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
364379 ) =>
365380 Matrix e n k ->
366381 Matrix e m j ->
367382 Matrix e (n + m) (k + j)
368383(-|-) (M a) (M b) = M ((I.-|-) a b)
369384
370−-- Khatri Rao Product and projections
371−
372−kp1 ::
385+-- | Khatri Rao Product first projection
386+fstM ::
373387 forall e m k .
374388 ( Num e,
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))
389+ CountableDimsN m k,
390+ CountableN (m * k),
391+ FLN e (m * k) m,
392+ TrivialP m k
380393 ) => Matrix e (m * k) m
381−kp1 = M (I.kp1 @e @(I.FromNat m) @(I.FromNat k))
394+fstM = M (I.fstM @e @(I.FromNat m) @(I.FromNat k))
382395
383−kp2 ::
396+-- | Khatri Rao Product second projection
397+sndM ::
384398 forall e m k.
385399 ( Num e,
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))
400+ CountableDimsN k m,
401+ FLN e (m * k) k,
402+ CountableN (m * k),
403+ TrivialP m k
391404 ) => Matrix e (m * k) k
392−kp2 = M (I.kp2 @e @(I.FromNat m) @(I.FromNat k))
405+sndM = M (I.sndM @e @(I.FromNat m) @(I.FromNat k))
393406
394−khatri ::
407+-- | Khatri Rao Product
408+kr ::
395409 forall e cols a b.
396410 ( Num e,
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))
411+ CountableDimsN a b,
412+ CountableN (a * b),
413+ FLN e (a * b) a,
414+ FLN e (a * b) b,
415+ TrivialP a b
403416 ) => Matrix e cols a -> Matrix e cols b -> Matrix e cols (a * 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)
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
410421
422+-- | Product Bifunctor (Kronecker)
411423infixl 4 ><
412424
413425(><) ::
414426 forall e m p n q.
415427 ( Num e,
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))
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
428437 ) => Matrix e m p -> Matrix e n q -> Matrix e (m * n) (p * q)
429438(><) a b =
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
439+ let fstM' = fstM @e @m @n
440+ sndM' = sndM @e @m @n
441+ in kr (comp a fstM') (comp b sndM')
435442
436−abideJS :: Matrix e cols rows -> Matrix e cols rows
437−abideJS (M m) = M (I.abideJS m)
443+-- | Matrix abide Join Fork
444+abideJF :: Matrix e cols rows -> Matrix e cols rows
445+abideJF (M m) = M (I.abideJF m)
438446
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
447+-- | Matrix abide Fork Join
448+abideFJ :: Matrix e cols rows -> Matrix e cols rows
449+abideFJ (M m) = M (I.abideFJ m)
445450
451+-- | Matrix transposition
446452tr :: Matrix e cols rows -> Matrix e rows cols
447453tr (M m) = M (I.tr m)
448454
449455-- Selective 'select' operator
450456select ::
451457 ( Num e,
452− I.FromLists e (I.FromNat rows1) (I.FromNat rows1),
453− KnownNat (I.Count (I.FromNat rows1)),
458+ FLN e rows1 rows1,
459+ CountableN rows1,
454460 I.FromNat rows2 ~ I.FromNat rows1,
455461 I.FromNat cols1 ~ I.FromNat cols2,
456462 I.FromNat rows3 ~ Either (I.FromNat cols3) (I.FromNat rows1)
@@ -461,14 +467,11 @@ select (M m) (M y) = M (I.select m y)
461467
462468cond ::
463469 ( I.FromNat (I.Count (I.FromNat cols)) ~ I.FromNat cols,
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
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
472475 )
473476 =>
474477 (a -> Bool) -> Matrix e cols rows -> Matrix e cols rows -> Matrix e cols rows
@@ -476,8 +479,12 @@ cond p (M a) (M b) = M (I.cond p a b)
476479
477480-- Pretty print
478481
479−pretty :: (KnownNat (I.Count (I.FromNat cols)), Show e) => Matrix e cols rows -> String
482+pretty :: (CountableDimsN cols rows, Show e) => Matrix e cols rows -> String
480483pretty (M m) = I.pretty m
481484
482−prettyPrint :: (KnownNat (I.Count (I.FromNat cols)), Show e) => Matrix e cols rows -> IO ()
485+prettyPrint :: (CountableDimsN cols rows, Show e) => Matrix e cols rows -> IO ()
483486prettyPrint (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+283−240
@@ -1,10 +1,11 @@
1+{-# LANGUAGE ConstraintKinds #-}
2+{-# LANGUAGE TypeFamilies #-}
13{-# LANGUAGE AllowAmbiguousTypes #-}
24{-# LANGUAGE DataKinds #-}
35{-# LANGUAGE DerivingVia #-}
46{-# LANGUAGE FlexibleContexts #-}
57{-# LANGUAGE FlexibleInstances #-}
68{-# LANGUAGE GADTs #-}
7−{-# LANGUAGE KindSignatures #-}
89{-# LANGUAGE MultiParamTypeClasses #-}
910{-# LANGUAGE NoStarIsType #-}
1011{-# LANGUAGE RankNTypes #-}
@@ -55,15 +56,24 @@ module LAoP.Matrix.Type
5556 -- * Type safe matrix representation
5657 Matrix (..),
5758
59+ -- * Constraint type aliases
60+ Countable,
61+ CountableDims,
62+ CountableN,
63+ CountableDimsN,
64+ FLN,
65+ Liftable,
66+ Trivial,
67+ TrivialP,
68+
5869 -- * Type aliases
5970 Zero,
6071 One,
6172
6273 -- * Primitives
63− empty,
6474 one,
65− junc,
66− split,
75+ join,
76+ fork,
6777
6878 -- * Auxiliary type families
6979 I.FromNat,
@@ -75,24 +85,27 @@ module LAoP.Matrix.Type
7585 fromLists,
7686 toLists,
7787 toList,
88+ matrixBuilder',
7889 matrixBuilder,
7990 row,
8091 col,
8192 zeros,
8293 ones,
8394 bang,
95+ point,
8496 constant,
8597
8698 -- * Functor instance equivalent function
8799 fmapM,
100+ bimapM,
88101
89102 -- * Applicative/Monoidal instance equivalent functions
90103 unitM,
91104 multM,
92105
93106 -- * Selective equivalent instance function
94− selectM,
95−
107+ selectM,
108+
96109 -- * Monad equivalent instance function
97110 returnM,
98111 bindM,
@@ -100,25 +113,34 @@ module LAoP.Matrix.Type
100113 -- * Misc
101114 -- ** Get dimensions
102115 columns,
116+ columns',
103117 rows,
118+ rows',
104119
105120 -- ** Matrix Transposition
106121 tr,
107122
123+ -- ** Scalar multiplication/division of matrices
124+ (.|),
125+ (./),
126+
108127 -- ** McCarthy's Conditional
109128 cond,
110129
111130 -- ** Matrix "abiding"
112− abideJS,
113− abideSJ,
131+ abideJF,
132+ abideFJ,
133+
134+ -- ** Zip Matrices
135+ zipWithM,
114136
115137 -- * Biproduct approach
116− -- ** Split
138+ -- ** Fork
117139 (===),
118140 -- *** Projections
119141 p1,
120142 p2,
121− -- ** Junc
143+ -- ** Join
122144 (|||),
123145 -- *** Injections
124146 i1,
@@ -132,11 +154,11 @@ module LAoP.Matrix.Type
132154 -- | Note that given the restrictions imposed it is not possible to
133155 -- implement the standard type classes present in standard Haskell.
134156 -- *** Matrix pairing projections
135− kp1,
136− kp2,
157+ fstM,
158+ sndM,
137159
138160 -- *** Matrix pairing
139− khatri,
161+ kr,
140162
141163 -- * Matrix composition and lifting
142164
@@ -144,10 +166,10 @@ module LAoP.Matrix.Type
144166
145167 -- | Note that given the restrictions imposed it is not possible to
146168 -- implement the standard type classes present in standard Haskell.
147− identity,
169+ iden,
148170 comp,
149− fromF,
150171 fromF',
172+ fromF,
151173
152174 -- * Relation
153175 toRel,
@@ -161,23 +183,44 @@ where
161183import Data.Void
162184import Data.Proxy
163185import Data.Kind
164−import GHC.TypeLits
186+import GHC.TypeLits
165187import Control.DeepSeq
166188import LAoP.Utils
167−import qualified Control.Category as C
168189import qualified LAoP.Matrix.Internal as I
190+import Prelude hiding (id, (.))
169191
170192newtype Matrix e (cols :: Type) (rows :: Type) = M (I.Matrix e (I.Normalize cols) (I.Normalize rows))
171193 deriving (Show, Num, Eq, Ord, NFData) via (I.Matrix e (I.Normalize cols) (I.Normalize rows))
172194
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
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)
181224
182225-- | Zero type alias
183226type Zero = Void
@@ -187,92 +230,75 @@ type One = ()
187230
188231-- Primitives
189232
190−-- | Empty matrix constructor
191−empty :: Matrix e Zero Zero
192−empty = M I.Empty
193−
194233-- | Unit matrix constructor
195234one :: e -> Matrix e One One
196235one = M . I.One
197236
198−-- | Matrix 'Junc' constructor
199−junc ::
200− (I.Normalize (Either a b) ~ Either (I.Normalize a) (I.Normalize b)) =>
237+-- | Matrix 'Join' constructor
238+join ::
201239 Matrix e a rows ->
202240 Matrix e b rows ->
203241 Matrix e (Either a b) rows
204−junc (M a) (M b) = M (I.Junc a b)
242+join (M a) (M b) = M (I.Join a b)
205243
206244infixl 3 |||
207−-- | Matrix 'Junc' constructor
245+-- | Matrix 'Join' constructor
208246(|||) ::
209− (I.Normalize (Either a b) ~ Either (I.Normalize a) (I.Normalize b)) =>
210247 Matrix e a rows ->
211248 Matrix e b rows ->
212249 Matrix e (Either a b) rows
213−(|||) = junc
250+(|||) = join
214251
215−-- | Matrix 'Split' constructor
216−split ::
217− (I.Normalize (Either a b) ~ Either (I.Normalize a) (I.Normalize b)) =>
252+-- | Matrix 'Fork' constructor
253+fork ::
218254 Matrix e cols a ->
219255 Matrix e cols b ->
220256 Matrix e cols (Either a b)
221−split (M a) (M b) = M (I.Split a b)
257+fork (M a) (M b) = M (I.Fork a b)
222258
223259infixl 2 ===
224−-- | Matrix 'Split' constructor
260+-- | Matrix 'Fork' constructor
225261(===) ::
226− (I.Normalize (Either a b) ~ Either (I.Normalize a) (I.Normalize b)) =>
227262 Matrix e cols a ->
228263 Matrix e cols b ->
229264 Matrix e cols (Either a b)
230−(===) = split
265+(===) = fork
231266
232267-- Functor hierarchy
233268
234269-- | Functor instance equivalent function
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)
270+fmapM ::
271+ ( Liftable e a b,
272+ CountableDimsN a b,
273+ FLN b a
246274 )
247275 =>
248276 (a -> b) -> Matrix e c a -> Matrix e c b
249−fmapM f m = fromF' f `comp` m
277+fmapM f m = fromF f . m
250278
251279-- | Applicative instance equivalent 'unit' function,
252280unitM :: (Num e) => Matrix e () ()
253281unitM = one 1
254282
255283-- | Applicative instance equivalent 'unit' function,
256−multM ::
257− ( KnownNat (I.Count (I.Normalize a)),
258− KnownNat (I.Count (I.Normalize b)),
259− KnownNat (I.Count (I.Normalize (a, b))),
284+multM ::
285+ ( CountableDimsN a b,
286+ CountableN (a, b),
260287 Num e,
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)
288+ FLN (a, b) a,
289+ FLN (a, b) b,
290+ TrivialP a b
264291 ) => Matrix e c a -> Matrix e c b -> Matrix e c (a, b)
265−multM a b = khatri a b
266−
292+multM = kr
267293
268294-- | Monad instance equivalent 'return' function,
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)
295+returnM ::
296+ forall e a .
297+ ( Num e,
298+ Enum e,
299+ Enum a,
300+ FLN () a,
301+ Countable a
276302 ) => a -> Matrix e One a
277303returnM a = col l
278304 where
@@ -288,73 +314,64 @@ bindM = flip comp
288314
289315-- | Build a matrix out of a list of list of elements. Throws a runtime
290316-- error if the dimensions do not match.
291−fromLists :: (I.FromLists e (I.Normalize cols) (I.Normalize rows)) => [[e]] -> Matrix e cols rows
317+fromLists :: (FLN cols rows) => [[e]] -> Matrix e cols rows
292318fromLists = M . I.fromLists
293319
294320-- | Matrix builder function. Constructs a matrix provided with
295−-- a construction function.
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.
296329matrixBuilder ::
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
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)
301339
302340-- | Constructs a column vector matrix
303−col :: (I.FromLists e () (I.Normalize rows)) => [e] -> Matrix e One rows
341+col :: (FLN () rows) => [e] -> Matrix e One rows
304342col = M . I.col
305343
306344-- | Constructs a row vector matrix
307−row :: (I.FromLists e (I.Normalize cols) ()) => [e] -> Matrix e cols One
345+row :: (FLN cols ()) => [e] -> Matrix e cols One
308346row = M . I.row
309347
310348-- | Lifts functions to matrices with arbitrary dimensions.
311349--
312350-- NOTE: Be careful to not ask for a matrix bigger than the cardinality of
313351-- types @a@ or @b@ allows.
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)
352+fromF' ::
353+ ( Liftable e a b,
354+ CountableDimsN cols rows,
355+ FLN rows cols
325356 ) =>
326− (a -> b) ->
327− Matrix e cols rows
328−fromF = M . I.fromF
357+ (a -> b) -> Matrix e cols rows
358+fromF' = M . I.fromF'
329359
330360-- | Lifts functions to matrices with dimensions matching @a@ and @b@
331361-- cardinality's.
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)
362+fromF ::
363+ ( Liftable e a b,
364+ CountableDimsN a b,
365+ FLN b a
343366 ) =>
344− (a -> b) ->
345− Matrix e a b
346−fromF' = M . I.fromF'
367+ (a -> b) -> Matrix e a b
368+fromF = M . I.fromF
347369
348370-- | Lifts relation functions to Boolean Matrix
349371toRel ::
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)
372+ ( Liftable (Natural 0 1) a b,
373+ CountableDims a b,
374+ FLN b a
358375 ) => (a -> b -> Bool) -> Matrix (Natural 0 1) a b
359376toRel = M . I.toRel
360377
@@ -372,8 +389,8 @@ toList (M m) = I.toList m
372389
373390-- | The zero matrix. A matrix wholly filled with zeros.
374391zeros ::
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
392+ (Num e, FLN cols rows, CountableDimsN cols rows)
393+ => Matrix e cols rows
377394zeros = M I.zeros
378395
379396-- Ones Matrix
@@ -382,8 +399,8 @@ zeros = M I.zeros
382399--
383400-- Also known as T (Top) matrix.
384401ones ::
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
402+ (Num e, FLN cols rows, CountableDimsN cols rows)
403+ => Matrix e cols rows
387404ones = M I.ones
388405
389406-- Const Matrix
@@ -391,9 +408,8 @@ ones = M I.ones
391408-- | The constant matrix constructor. A matrix wholly filled with a given
392409-- value.
393410constant ::
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
411+ (Num e, FLN cols rows, CountableDimsN cols rows)
412+ => e -> Matrix e cols rows
397413constant = M . I.constant
398414
399415-- Bang Matrix
@@ -401,17 +417,30 @@ constant = M . I.constant
401417-- | The T (Top) row vector matrix.
402418bang ::
403419 forall e cols.
404− (Num e, Enum e, I.FromLists e (I.Normalize cols) (), KnownNat (I.Count (I.Normalize cols))) =>
420+ (Num e, Enum e, FLN cols (), CountableN cols) =>
405421 Matrix e cols One
406422bang = M I.bang
407423
408−-- Identity Matrix
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
409437
410−-- | Identity matrix
411−identity ::
412− (Num e, I.FromLists e (I.Normalize a) (I.Normalize a), KnownNat (I.Count (I.Normalize a))) =>
438+-- | iden matrix
439+iden ::
440+ (Num e, FLN a a, CountableN a) =>
413441 Matrix e a a
414−identity = M I.identity
442+iden = M I.iden
443+{-# NOINLINE iden #-}
415444
416445-- Matrix composition (MMM)
417446
@@ -421,15 +450,32 @@ identity = M I.identity
421450-- from LAoP.
422451comp :: (Num e) => Matrix e cr rows -> Matrix e cols cr -> Matrix e cols rows
423452comp (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)
424472
425473-- | Biproduct first component projection
426474p1 ::
427475 ( Num e,
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)
476+ CountableDimsN n m,
477+ FLN n m,
478+ FLN m m
433479 ) =>
434480 Matrix e (Either m n) m
435481p1 = M I.p1
@@ -437,11 +483,9 @@ p1 = M I.p1
437483-- | Biproduct second component projection
438484p2 ::
439485 ( Num e,
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)
486+ CountableDimsN n m,
487+ FLN m n,
488+ FLN n n
445489 ) =>
446490 Matrix e (Either m n) n
447491p2 = M I.p2
@@ -451,11 +495,9 @@ p2 = M I.p2
451495-- | Biproduct first component injection
452496i1 ::
453497 ( Num e,
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)
498+ CountableDimsN n m,
499+ FLN n m,
500+ FLN m m
459501 ) =>
460502 Matrix e m (Either m n)
461503i1 = tr p1
@@ -463,11 +505,9 @@ i1 = tr p1
463505-- | Biproduct second component injection
464506i2 ::
465507 ( Num e,
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)
508+ CountableDimsN n m,
509+ FLN m n,
510+ FLN n n
471511 ) =>
472512 Matrix e n (Either m n)
473513i2 = tr p2
@@ -476,24 +516,34 @@ i2 = tr p2
476516
477517-- | Obtain the number of rows.
478518--
479−-- NOTE: The 'KnownNat' constaint is needed in order to obtain the
480−-- dimensions in constant time.
481−--
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
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
485523rows (M m) = I.rows m
486524
525+-- | Obtain the number of rows in an inefficient manner, but without any
526+-- constraints.
527+--
528+-- For a more efficient version see 'rows'.
529+rows' :: Matrix e cols rows -> Int
530+rows' (M m) = I.rows' m
531+
487532-- | Obtain the number of columns.
488−--
489−-- NOTE: The 'KnownNat' constaint is needed in order to obtain the
490−-- dimensions in constant time.
491533--
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
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
495538columns (M m) = I.columns m
496539
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+
497547-- Coproduct Bifunctor
498548
499549infixl 5 -|-
@@ -501,14 +551,11 @@ infixl 5 -|-
501551-- | Matrix coproduct functor also known as matrix direct sum.
502552(-|-) ::
503553 ( Num e,
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)
554+ CountableDimsN j k,
555+ FLN k k,
556+ FLN j k,
557+ FLN k j,
558+ FLN j j
512559 ) =>
513560 Matrix e n k ->
514561 Matrix e m j ->
@@ -518,104 +565,98 @@ infixl 5 -|-
518565-- Khatri Rao Product and projections
519566
520567-- | Khatri Rao product first component projection matrix.
521−kp1 ::
568+fstM ::
522569 forall e m k .
523570 ( Num e,
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)
571+ CountableDimsN m k,
572+ CountableN (m, k),
573+ FLN (m, k) m,
574+ TrivialP m k
529575 ) => Matrix e (m, k) m
530−kp1 = M (I.kp1 @e @(I.Normalize m) @(I.Normalize k))
576+fstM = M (I.fstM @e @(I.Normalize m) @(I.Normalize k))
531577
532578-- | Khatri Rao product second component projection matrix.
533−kp2 ::
579+sndM ::
534580 forall e m k.
535581 ( Num e,
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)
582+ CountableDimsN k m,
583+ CountableN (m, k),
584+ FLN (m, k) k,
585+ TrivialP m k
541586 ) => Matrix e (m, k) k
542−kp2 = M (I.kp2 @e @(I.Normalize m) @(I.Normalize k))
587+sndM = M (I.sndM @e @(I.Normalize m) @(I.Normalize k))
543588
544589-- | Khatri Rao Matrix product also known as matrix pairing.
545590--
546591-- NOTE: That this is not a true categorical product, see for instance:
547−--
592+--
548593-- @
549−-- | kp1 `comp` khatri a b == a
550−-- khatri a b ==> |
551−-- | kp2 `comp` khatri a b == b
594+-- | fstM . kr a b == a
595+-- kr a b ==> |
596+-- | sndM . kr a b == b
552597-- @
553598--
554599-- __Emphasis__ on the implication symbol.
555−khatri ::
600+kr ::
556601 forall e cols a b.
557602 ( Num e,
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)
603+ CountableDimsN a b,
604+ CountableN (a, b),
605+ FLN (a, b) a,
606+ FLN (a, b) b,
607+ TrivialP a b
564608 ) => Matrix e cols a -> Matrix e cols b -> Matrix e cols (a, 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
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
569613
570614-- Product Bifunctor (Kronecker)
571615
572616infixl 4 ><
573617
574−-- | Matrix product functor also known as kronecker product
618+-- | Matrix product functor also known as Kronecker product
575619(><) ::
576620 forall e m p n q.
577621 ( Num e,
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)
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
590631 ) => Matrix e m p -> Matrix e n q -> Matrix e (m, n) (p, q)
591632(><) a b =
592− let kp1' = kp1 @e @m @n
593− kp2' = kp2 @e @m @n
594− in khatri (comp a kp1') (comp b kp2')
633+ let fstM' = fstM @e @m @n
634+ sndM' = sndM @e @m @n
635+ in kr (comp a fstM') (comp b sndM')
595636
596−-- Matrix abide Junc Split
637+-- Matrix abide Join Fork
597638
598−-- | Matrix "abiding" followin the 'Junc'-'Split' abide law.
599−--
639+-- | Matrix "abiding" followin the 'Join'-'Fork' abide law.
640+--
600641-- Law:
601642--
602643-- @
603−-- 'Junc' ('Split' a c) ('Split' b d) == 'Split' ('Junc' a b) ('Junc' c d)
644+-- 'Join' ('Fork' a c) ('Fork' b d) == 'Fork' ('Join' a b) ('Join' c d)
604645-- @
605−abideJS :: Matrix e cols rows -> Matrix e cols rows
606−abideJS (M m) = M (I.abideJS m)
646+abideJF :: Matrix e cols rows -> Matrix e cols rows
647+abideJF (M m) = M (I.abideJF m)
607648
608−-- Matrix abide Split Junc
649+-- Matrix abide Fork Join
609650
610−-- | Matrix "abiding" followin the 'Split'-'Junc' abide law.
611−--
651+-- | Matrix "abiding" followin the 'Fork'-'Join' abide law.
652+--
612653-- Law:
613654--
614655-- @
615−-- 'Split' ('Junc' a b) ('Junc' c d) == 'Junc' ('Split' a c) ('Split' b d)
656+-- 'Fork' ('Join' a b) ('Join' c d) == 'Join' ('Fork' a c) ('Fork' b d)
616657-- @
617−abideSJ :: Matrix e cols rows -> Matrix e cols rows
618−abideSJ (M m) = M (I.abideSJ m)
658+abideFJ :: Matrix e cols rows -> Matrix e cols rows
659+abideFJ (M m) = M (I.abideFJ m)
619660
620661-- Matrix transposition
621662
@@ -627,11 +668,10 @@ tr (M m) = M (I.tr m)
627668
628669-- | Selective functors 'select' operator equivalent inspired by the
629670-- ArrowMonad solution presented in the paper.
630−selectM ::
671+selectM ::
631672 ( Num e,
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)
673+ FLN b b,
674+ CountableN b
635675 ) => Matrix e cols (Either a b) -> Matrix e a b -> Matrix e cols b
636676selectM (M m) (M y) = M (I.select m y)
637677
@@ -639,15 +679,14 @@ selectM (M m) (M y) = M (I.select m y)
639679
640680-- | McCarthy's Conditional expresses probabilistic choice.
641681cond ::
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
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
651690 )
652691 =>
653692 (a -> Bool) -> Matrix e a b -> Matrix e a b -> Matrix e a b
@@ -656,9 +695,13 @@ cond p (M a) (M b) = M (I.cond p a b)
656695-- Pretty print
657696
658697-- | Matrix pretty printer
659−pretty :: (KnownNat (I.Count (I.Normalize cols)), Show e) => Matrix e cols rows -> String
698+pretty :: (CountableDimsN cols rows, Show e) => Matrix e cols rows -> String
660699pretty (M m) = I.pretty m
661700
662701-- | Matrix pretty printer
663−prettyPrint :: (KnownNat (I.Count (I.Normalize cols)), Show e) => Matrix e cols rows -> IO ()
702+prettyPrint :: (CountableDimsN cols rows, Show e) => Matrix e cols rows -> IO ()
664703prettyPrint (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+34−7
@@ -30,12 +30,21 @@ 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+
3343 -- * Primitives
34− empty,
3544 one,
36− junc,
45+ join,
3746 (|||),
38− split,
47+ fork,
3948 (===),
4049
4150 -- * Auxiliary type families
@@ -53,6 +62,7 @@ module LAoP.Relation
5362 toList,
5463 toBool,
5564 pt,
65+ belongs,
5666 relationBuilder,
5767 zeros,
5868 ones,
@@ -80,15 +90,25 @@ module LAoP.Relation
8090 injection,
8191 surjection,
8292 bijection,
93+ domain,
94+ range,
8395
8496 -- * Function division
8597 divisionF,
8698
99+ -- * Relation division
100+ divR,
101+ divL,
102+ divS,
103+ shrunkBy,
104+ overriddenBy,
105+
87106 -- * Relational pairing
88107 splitR,
108+
89109 -- ** Projections
90− p1,
91− p2,
110+ fstR,
111+ sndR,
92112 -- ** Bifunctor
93113 (><),
94114 -- * Relational coproduct
@@ -116,18 +136,25 @@ module LAoP.Relation
116136 linearOrder,
117137 equivalence,
118138 partialEquivalence,
139+ difunctional,
140+
141+ -- * Conditionals
142+ equalizer,
119143
120144 -- ** McCarthy's Conditional
121− -- cond,
145+ predR,
146+ guard,
147+ cond,
122148
123149 -- * Relational composition and lifting
124− identity,
150+ iden,
125151 comp,
126152 fromF,
127153 fromF',
128154
129155 -- ** Relational application
130156 pointAp,
157+ pointApBool,
131158
132159 -- * Matrix printing
133160 pretty,
src/LAoP/Relation/Internal.hs+486−317
@@ -1,3 +1,5 @@
1+{-# LANGUAGE TypeFamilies #-}
2+{-# LANGUAGE ConstraintKinds #-}
13{-# LANGUAGE GADTs #-}
24{-# LANGUAGE UndecidableInstances #-}
35{-# LANGUAGE FlexibleContexts #-}
@@ -39,12 +41,21 @@ module LAoP.Relation.Internal
3941 Relation (..),
4042 Boolean,
4143
44+ -- * Constraint type synonyms
45+ Countable,
46+ CountableDims,
47+ CountableN,
48+ CountableDimsN,
49+ FLN,
50+ Liftable,
51+ Trivial,
52+ TrivialP,
53+
4254 -- * Primitives
43− empty,
4455 one,
45− junc,
56+ join,
4657 (|||),
47− split,
58+ fork,
4859 (===),
4960
5061 -- * Auxiliary type families
@@ -55,13 +66,15 @@ module LAoP.Relation.Internal
5566 -- * Matrix construction and conversion
5667 I.FromLists,
5768 fromLists,
58− fromF,
5969 fromF',
70+ fromF,
6071 toRel,
6172 toLists,
6273 toList,
6374 toBool,
6475 pt,
76+ belongs,
77+ relationBuilder',
6578 relationBuilder,
6679 zeros,
6780 ones,
@@ -89,6 +102,8 @@ module LAoP.Relation.Internal
89102 injection,
90103 surjection,
91104 bijection,
105+ domain,
106+ range,
92107
93108 -- * Function division
94109 divisionF,
@@ -104,8 +119,8 @@ module LAoP.Relation.Internal
104119 splitR,
105120
106121 -- ** Projections
107− p1,
108− p2,
122+ fstR,
123+ sndR,
109124 -- ** Bifunctor
110125 (><),
111126 -- * Relational coproduct
@@ -133,6 +148,7 @@ module LAoP.Relation.Internal
133148 linearOrder,
134149 equivalence,
135150 partialEquivalence,
151+ difunctional,
136152
137153 -- * Conditionals
138154 equalizer,
@@ -143,10 +159,10 @@ module LAoP.Relation.Internal
143159 cond,
144160
145161 -- * Relational composition and lifting
146− identity,
162+ iden,
147163 comp,
148− fromF,
149164 fromF',
165+ fromF,
150166
151167 -- ** Relational application
152168 pointAp,
@@ -162,12 +178,13 @@ import Data.Void
162178import qualified LAoP.Matrix.Internal as I
163179import LAoP.Utils.Internal
164180import Control.DeepSeq
165−import qualified Control.Category as C
166181import Data.Bool
167182import GHC.TypeLits
183+import Prelude hiding (id, (.))
168184
169185-- | Boolean type synonym for working with boolean matrices
170186type Boolean = Natural 0 1
187+type Powerset a = List (List a)
171188
172189-- | Relation data type.
173190newtype Relation a b = R (I.Matrix Boolean (I.Normalize a) (I.Normalize b))
@@ -175,25 +192,34 @@ newtype Relation a b = R (I.Matrix Boolean (I.Normalize a) (I.Normalize b))
175192
176193deriving instance (Read (I.Matrix Boolean (I.Normalize a) (I.Normalize b))) => Read (Relation a b)
177194
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
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
186211
187212instance Num (Relation a b) where
188− -- | Matrix addition becomes Boolean matrix disjunction
213+ -- | Matrix addition becomes Boolean matrix disjointion
189214 (R a) + (R b) = R (I.orM a b)
190215
191216 -- | Matrix subtraction becomes Relational subtraction
192217 (R a) - (R b) = R (I.subM a b)
193218
194− -- | Matrix multiplication becomes Boolean matrix conjunction
219+ -- | Matrix multiplication becomes Boolean matrix conjointion
195220 (R a) * (R b) = R (I.andM a b)
196221
222+ -- | Matrix negation becomes Boolean matrix negation
197223 negate (R a) = R (I.negateM a)
198224
199225-- Type alias
@@ -202,105 +228,107 @@ type One = ()
202228
203229-- Primitives
204230
205−-- | Empty matrix constructor
206−empty :: Relation Zero Zero
207−empty = R I.Empty
208−
209231-- | Unit matrix constructor
210232one :: Boolean -> Relation One One
211233one = R . I.One
212234
213−-- | Boolean Matrix 'Junc' constructor, also known as relational coproduct.
235+-- | Boolean Matrix 'Join' constructor, also known as relational coproduct.
214236--
215237-- See 'eitherR'.
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)
238+join :: Relation a c -> Relation b c -> Relation (Either a b) c
239+join (R a) (R b) = R (I.Join a b)
219240
220241infixl 3 |||
221−-- | Boolean Matrix 'Junc' constructor
242+-- | Boolean Matrix 'Join' constructor
243+--
244+-- See 'eitherR'.
222245(|||) ::
223− (I.Normalize (Either a b) ~ Either (I.Normalize a) (I.Normalize b)) =>
224246 Relation a c ->
225247 Relation b c ->
226248 Relation (Either a b) c
227−(|||) = junc
249+(|||) = join
228250
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)
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)
233254
234255infixl 2 ===
235−-- | Boolean Matrix 'Split' constructor
256+-- | Boolean Matrix 'Fork' constructor
236257(===) ::
237− (I.Normalize (Either a b) ~ Either (I.Normalize a) (I.Normalize b)) =>
238258 Relation c a ->
239259 Relation c b ->
240260 Relation c (Either a b)
241−(===) = split
261+(===) = fork
242262
243263-- Construction
244264
245265-- | Build a matrix out of a list of list of elements. Throws a runtime
246266-- error if the dimensions do not match.
247−fromLists :: (I.FromLists Boolean (I.Normalize a) (I.Normalize b)) => [[Boolean]] -> Relation a b
267+fromLists :: (FLN a b) => [[Boolean]] -> Relation a b
248268fromLists = R . I.fromLists
249269
250−-- | Matrix builder function. Constructs a matrix provided with
251−-- a construction function.
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.
252279relationBuilder ::
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
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
256288relationBuilder = R . I.matrixBuilder
257289
258290-- | Lifts functions to matrices with arbitrary dimensions.
259291--
260292-- NOTE: Be careful to not ask for a matrix bigger than the cardinality of
261293-- types @a@ or @b@ allows.
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)
294+fromF' ::
295+ ( Liftable a b,
296+ CountableDimsN c d,
297+ FLN d c
271298 )
272299 => (a -> b) -> Relation c d
273−fromF f = R (I.fromFRel f)
300+fromF' f = R (I.fromFRel' f)
274301
275302-- | Lifts functions to matrices with dimensions matching @a@ and @b@
276303-- cardinality's.
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)
304+fromF ::
305+ ( Liftable a b,
306+ CountableDimsN a b,
307+ FLN b a
286308 )
287309 => (a -> b) -> Relation a b
288−fromF' f = R (I.fromFRel' f)
310+fromF f = R (I.fromFRel f)
289311
290312-- | Lifts relation functions to 'Relation'
291313toRel ::
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)
314+ ( Liftable a b,
315+ CountableDims a b,
316+ FLN b a
300317 )
301− => (a -> b -> Bool) -> Relation a b
318+ => (a -> b -> Bool) -> Relation a b
302319toRel = R . I.toRel
303320
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+
304332-- Conversion
305333
306334-- | Converts a matrix to a list of lists of elements.
@@ -311,93 +339,135 @@ toLists (R m) = I.toLists m
311339toList :: Relation a b -> [Boolean]
312340toList (R m) = I.toList m
313341
314−-- | Converts a well typed @'Relation'@ to @'Bool'@.
342+-- | Converts a well typed 'Relation' to 'Bool'.
315343toBool :: Relation One One -> Bool
316344toBool r = case toList r of
317345 [Nat 0] -> False
318346 _ -> True
319347
320−-- | Power transpose
321−pt ::
322− ( Bounded a,
323− Bounded b,
324− Enum a,
325− Enum b,
348+-- | Power transpose.
349+--
350+-- Maps a relation to a set valued function.
351+pt ::
352+ ( Liftable a b,
326353 Eq a,
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
354+ CountableDimsN a b,
355+ FLN a One,
356+ FLN b One
332357 )
333− => Relation a b -> (a -> [b])
358+ => Relation a b -> (a -> List b)
334359pt r a =
335− let lb = [minBound .. maxBound]
336− in [ b | b <- lb, toBool (pointAp a b r) ]
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
337375
338376-- Zeros Matrix
339377
340−-- | The zero matrix. A matrix wholly filled with zeros.
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+-- @
341387zeros ::
342− (I.FromLists Boolean (I.Normalize a) (I.Normalize b), KnownNat (I.Count (I.Normalize a)), KnownNat (I.Count (I.Normalize b))) =>
388+ (FLN a b, CountableDimsN a b) =>
343389 Relation a b
344−zeros = relationBuilder (const (nat 0))
390+zeros = relationBuilder' (const (nat 0))
345391
346392-- Ones Matrix
347393
348−-- | The ones matrix. A matrix wholly filled with ones.
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.
349398--
350−-- Also known as T (Top) matrix.
399+-- @
400+-- ⊥ ``sse`` R && R ``sse`` T == True
401+-- @
351402ones ::
352− (I.FromLists Boolean (I.Normalize a) (I.Normalize b), KnownNat (I.Count (I.Normalize a)), KnownNat (I.Count (I.Normalize b))) =>
403+ (FLN a b, CountableDimsN a b) =>
353404 Relation a b
354−ones = relationBuilder (const (nat 1))
405+ones = relationBuilder' (const (nat 1))
355406
356407-- Bang Matrix
357408
358−-- | The T (Top) row vector matrix.
409+-- | The T (Top) row vector relation.
359410bang ::
360− (I.FromLists Boolean (I.Normalize a) One, KnownNat (I.Count (I.Normalize a))) =>
411+ (FLN a One, CountableN a) =>
361412 Relation a One
362413bang = ones
363414
364415-- | Point constant relation
365−point ::
416+point ::
366417 ( Bounded a,
367418 Enum a,
368419 Eq a,
369− KnownNat (I.Count (I.Normalize a)),
370− I.FromLists Boolean (I.Normalize a) One
420+ CountableN a,
421+ FLN a One
371422 ) => a -> Relation One a
372−point = fromF' . const
423+point = fromF . const
373424
374−-- Identity Matrix
425+-- iden Matrix
375426
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 (==))
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 (==))
381435
382436-- | Relational composition
437+--
438+-- @
439+-- r `.` (s `.` p) = (r `.` s) `.` p
440+-- @
383441comp :: Relation b c -> Relation a b -> Relation a c
384442comp (R a) (R b) = R (I.compRel a b)
385443
386444-- | Relational right division
445+--
446+-- @'divR' x y@ is the largest relation @z@ which,
447+-- pre-composed with @y@, approximates @x@.
387448divR :: Relation b c -> Relation b a -> Relation a c
388449divR (R x) (R y) = R (I.divR x y)
389450
390451-- | Relational left division
452+--
453+-- The dual division operator:
454+--
455+-- @
456+-- 'divL' y x == 'conv' ('divR' ('conv' x) ('conv' y)
457+-- @
391458divL :: Relation c b -> Relation a b -> Relation a c
392459divL (R x) (R y) = R (I.divL x y)
393460
394461-- | 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@.
395465divS :: Relation c a -> Relation b a -> Relation c b
396466divS (R x) (R y) = R (I.divS x y)
397467
398468-- | Relational shrinking.
399469--
400−-- @r `'shrunkBy'` s@ is the largest part of @r@ such that,
470+-- @r ``shrunkBy`` s@ is the largest part of @r@ such that,
401471-- if it yields an output for an input @x@, it must be a maximum,
402472-- with respect to @s@, among all possible outputs of @x@ by @r@.
403473shrunkBy :: Relation b a -> Relation a a -> Relation b a
@@ -405,51 +475,52 @@ shrunkBy r s = r `intersection` divR s (conv r)
405475
406476-- | Relational overriding.
407477--
408−-- @r `'overriddenBy'` s@ yields the relation which contains the
478+-- @r ``overriddenBy`` s@ yields the relation which contains the
409479-- whole of @s@ and that part of @r@ where @s@ is undefined.
410480--
411481-- @
412−-- 'zeros' `'overriddenBy'` s == s
413−-- r `'overriddenBy'` 'zeros' == r
414−-- r `'overriddenBy'` r == r
482+-- 'zeros' ``overriddenBy`` s == s
483+-- r ``overriddenBy`` 'zeros' == r
484+-- r ``overriddenBy`` r == r
415485-- @
416486overriddenBy ::
417− ( I.FromLists Boolean (I.Normalize b) (I.Normalize b),
418− KnownNat (I.Count (I.Normalize b))
487+ ( FLN b b,
488+ CountableN b
419489 ) => Relation a b -> Relation a b -> Relation a b
420490overriddenBy r s = s `union` r `intersection` divR zeros (conv s)
421491
422−-- | Relational application
492+-- | Relational application.
493+--
494+-- If @a@ and @b@ are related by 'Relation' @r@
495+-- then @'pointAp' a b r == 'one' ('nat' 1)@
423496pointAp ::
424− ( Bounded a,
425− Bounded b,
426− Enum a,
427− Enum b,
497+ ( Liftable a b,
428498 Eq a,
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
499+ CountableDimsN a b,
500+ FLN a One,
501+ FLN b One
434502 ) => a -> b -> Relation a b -> Relation One One
435−pointAp a b r = conv (point b) `comp` r `comp` point a
503+pointAp a b r = conv (point b) . r . point a
436504
437505-- | Relational application
506+--
507+-- The same as 'pointAp' but converts 'Boolean' to 'Bool'
438508pointApBool ::
439− ( Bounded a,
440− Bounded b,
441− Enum a,
442− Enum b,
509+ ( Liftable a b,
443510 Eq a,
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
511+ CountableDimsN a b,
512+ FLN a One,
513+ FLN b One
449514 ) => a -> b -> Relation a b -> Bool
450−pointApBool a b r = toBool $ conv (point b) `comp` r `comp` point a
515+pointApBool a b r = toBool $ conv (point b) . r . point a
451516
452517-- | 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
453524conv :: Relation a b -> Relation b a
454525conv (R a) = R (I.tr a)
455526
@@ -467,165 +538,187 @@ iff r s = r == s
467538
468539-- | Relational intersection
469540--
470−-- Lifts pointwise conjunction.
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+-- @
471547intersection :: Relation a b -> Relation a b -> Relation a b
472548intersection a b = a * b
473549
474550-- | Relational union
475551--
476−-- Lifts pointwise disjunction.
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+-- @
477560union :: Relation a b -> Relation a b -> Relation a b
478561union a b = a + b
479562
480563-- | Relation Kernel
564+--
565+-- @
566+-- 'ker' r == 'conv' r `.` r
567+-- 'ker' r == 'img' ('conv' r)
568+-- @
481569ker :: Relation a b -> Relation a a
482−ker r = conv r `comp` r
570+ker r = conv r . r
483571
484572-- | Relation Image
573+--
574+-- @
575+-- 'img' r == r `.` conv r
576+-- 'img' r == 'ker' ('conv' r)
577+-- @
485578img :: Relation a b -> Relation b b
486−img r = r `comp` conv r
579+img r = r . conv r
487580
488−-- | Function division.
581+-- | Function division. Special case of 'divS'.
489582--
490583-- NOTE: _This is only valid_ if @f@ and @g@ are 'function's, i.e. 'simple' and
491584-- 'entire'.
492585--
493−-- @division f g == conv g `'comp'` f@
586+-- @'divisionF' f g == 'conv' g `.` f@
494587divisionF :: Relation a c -> Relation b c -> Relation a b
495−divisionF f g = conv g `comp` f
588+divisionF f g = conv g . f
496589
497590-- Taxonomy of binary relations
498591
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
592+-- | A 'Relation' @r@ is 'simple' 'iff' @'coreflexive' ('img' r)@
593+simple :: (CountableN b, FLN b b) => Relation a b -> Bool
501594simple = coreflexive . img
502595
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
596+-- | A 'Relation' @r@ is 'injective' 'iff' @'coreflexive' ('ker' r)@
597+injective :: (CountableN a, FLN a a) => Relation a b -> Bool
505598injective = coreflexive . ker
506599
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
600+-- | A 'Relation' @r@ is 'entire' 'iff' @'reflexive' ('ker' r)@
601+entire :: (CountableN a, FLN a a) => Relation a b -> Bool
509602entire = reflexive . ker
510603
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
604+-- | A 'Relation' @r@ is 'surjective' 'iff' @'reflexive' ('img' r)@
605+surjective :: (CountableN b, FLN b b) => Relation a b -> Bool
513606surjective = reflexive . img
514607
515−-- | A 'Relation' @r@ is a function iff @'simple' r && 'entire' r@
608+-- | A 'Relation' @r@ is a 'function' 'iff' @'simple' r && 'entire' r@
516609--
517610-- A 'function' @f@ enjoys the following properties, where @r@ and @s@ are binary
518611-- relations:
519612--
520613-- @
521−-- f `'comp'` r `'sse'` s == r `'sse'` f `'comp'` s
522−-- r `'comp'` f `'sse'` s == r `'sse'` s `'comp'` f
614+-- f `.` r ``sse`` s == r ``sse`` f `.` s
615+-- r `.` f ``sse`` s == r ``sse`` s `.` f
523616-- @
524617function ::
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)
618+ ( CountableDimsN a b,
619+ FLN a a,
620+ FLN b b
529621 )
530622 => Relation a b -> Bool
531623function r = simple r && entire r
532624
533−-- | A 'Relation' @r@ is a representation iff @'injective' r && 'entire' r@
625+-- | A 'Relation' @r@ is a 'representation' 'iff' @'injective' r && 'entire' r@
534626representation ::
535− ( KnownNat (I.Count (I.Normalize a)),
536− I.FromLists Boolean (I.Normalize a) (I.Normalize a)
627+ ( CountableN a,
628+ FLN a a
537629 )
538630 => Relation a b -> Bool
539631representation r = injective r && entire r
540632
541−-- | A 'Relation' @r@ is an abstraction iff @'surjective' r && 'simple' r@
633+-- | A 'Relation' @r@ is an 'abstraction' 'iff' @'surjective' r && 'simple' r@
542634abstraction ::
543− ( KnownNat (I.Count (I.Normalize b)),
544− I.FromLists Boolean (I.Normalize b) (I.Normalize b)
635+ ( CountableN b,
636+ FLN b b
545637 )
546638 => Relation a b -> Bool
547639abstraction r = surjective r && simple r
548640
549−-- | A 'Relation' @r@ is a surjection iff @'function' r && 'abstraction' r@
641+-- | A 'Relation' @r@ is a 'surjection' 'iff' @'function' r && 'abstraction' r@
550642surjection ::
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)
643+ ( CountableDimsN a b,
644+ FLN a a,
645+ FLN b b
555646 )
556647 => Relation a b -> Bool
557648surjection r = function r && abstraction r
558649
559−-- | A 'Relation' @r@ is a injection iff @'function' r && 'representation' r@
650+-- | A 'Relation' @r@ is a 'injection' 'iff' @'function' r && 'representation' r@
560651injection ::
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)
652+ ( CountableDimsN a b,
653+ FLN a a,
654+ FLN b b
565655 )
566656 => Relation a b -> Bool
567657injection r = function r && representation r
568658
569−-- | A 'Relation' @r@ is an bijection iff @'injection' r && 'surjection' r@
659+-- | A 'Relation' @r@ is an 'bijection' 'iff' @'injection' r && 'surjection' r@
570660bijection ::
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)
661+ ( CountableDimsN a b,
662+ FLN b b,
663+ FLN a a
575664 ) => Relation a b -> Bool
576665bijection r = injection r && surjection r
577666
578−
579667-- Properties of relations
580668
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
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
584672
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
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
588676
589−-- | A 'Relation' @r@ is transitive iff @(r `'comp'` r) `'sse'` r@
677+-- | A 'Relation' @r@ is 'transitive' 'iff' @(r `.` r) ``sse`` r@
590678transitive :: Relation a a -> Bool
591−transitive r = (r `comp` r) `sse` r
679+transitive r = (r . r) `sse` r
592680
593−-- | A 'Relation' @r@ is symmetric iff @r == conv r@
681+-- | A 'Relation' @r@ is 'symmetric' 'iff' @r == 'conv' r@
594682symmetric :: Relation a a -> Bool
595683symmetric r = r == conv r
596684
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
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
600688
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
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
604692
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
693+-- | A 'Relation' @r@ is 'connected' 'iff' @(r ``union`` 'conv' r) == 'ones'@
694+connected :: (CountableN a, FLN a a) => Relation a a -> Bool
607695connected r = (r `union` conv r) == ones
608696
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
697+-- | A 'Relation' @r@ is a 'preorder' 'iff' @'reflexive' r && 'transitive' r@
698+preorder :: (CountableN a, FLN a a) => Relation a a -> Bool
611699preorder r = reflexive r && transitive r
612700
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
701+-- | A 'Relation' @r@ is a partial-order 'iff' @'antiSymmetric' r && 'preorder' r@
702+partialOrder :: (CountableN a, FLN a a) => Relation a a -> Bool
615703partialOrder r = antiSymmetric r && preorder r
616704
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
705+-- | A 'Relation' @r@ is a linear-order 'iff' @'connected' r && 'partialOrder' r@
706+linearOrder :: (CountableN a, FLN a a) => Relation a a -> Bool
619707linearOrder r = connected r && partialOrder r
620708
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
709+-- | A 'Relation' @r@ is an 'equivalence' 'iff' @'symmetric' r && 'preorder' r@
710+equivalence :: (CountableN a, FLN a a) => Relation a a -> Bool
623711equivalence r = symmetric r && preorder r
624712
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
713+-- | A 'Relation' @r@ is a partial-equivalence 'iff' @'partialOrder' r && 'equivalence' r@
714+partialEquivalence :: (CountableN a, FLN a a) => Relation a a -> Bool
627715partialEquivalence r = partialOrder r && equivalence r
628716
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+
629722-- Relational pairing
630723
631724-- | Relational pairing.
@@ -633,64 +726,81 @@ partialEquivalence r = partialOrder r && equivalence r
633726-- NOTE: That this is not a true categorical product, see for instance:
634727--
635728-- @
636−-- | 'p1' `'comp'` 'splitR' a b `'sse'` a
637−-- 'splitR' a b <=> |
638−-- | 'p2' `'comp'` 'splitR' a b `'sse'` b
729+-- | 'fstR' `.` 'splitR' a b ``sse`` a
730+-- 'splitR' a b <=> |
731+-- | 'sndR' `.` 'splitR' a b ``sse`` b
639732-- @
640733--
641734-- __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+-- @
642745splitR ::
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)
746+ ( CountableDimsN a b,
747+ CountableN (a, b),
748+ FLN (a, b) a,
749+ FLN (a, b) b,
750+ TrivialP a b
649751 )
650752 => Relation c a -> Relation c b -> Relation c (a, b)
651−splitR (R f) (R g) = R (I.khatri f g)
753+splitR (R f) (R g) = R (I.kr f g)
652754
653755-- | Relational pairing first component projection
654−p1 ::
756+--
757+-- @
758+-- 'fstR' `.` 'splitR' r s ``sse`` r
759+-- @
760+fstR ::
655761 forall 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)
762+ ( CountableDimsN a b,
763+ CountableN (a, b),
764+ FLN (a, b) a,
765+ TrivialP a b
661766 )
662767 => Relation (a, b) a
663−p1 = R (I.kp1 @Boolean @(I.Normalize a) @(I.Normalize b))
768+fstR = R (I.fstM @Boolean @(I.Normalize a) @(I.Normalize b))
664769
665770-- | Relational pairing second component projection
666−p2 ::
771+--
772+-- @
773+-- 'sndR' `.` 'splitR' r s ``sse`` s
774+-- @
775+sndR ::
667776 forall 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)
777+ ( CountableDimsN a b,
778+ CountableN (a, b),
779+ FLN (a, b) b,
780+ TrivialP a b
673781 )
674782 => Relation (a, b) b
675−p2 = R (I.kp2 @Boolean @(I.Normalize a) @(I.Normalize b))
783+sndR = R (I.sndM @Boolean @(I.Normalize a) @(I.Normalize b))
676784
677785-- Relational pairing functor
678786
679787infixl 4 ><
680788-- | Relational pairing functor
789+--
790+-- @
791+-- r '><' s == 'splitR' (r `.` fstR) (s `.` sndR)
792+-- (r '><' s) `.` (p '><' q) == (r `.` p) '><' (s `.` q)
793+-- @
681794(><) ::
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)
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
694804 )
695805 => Relation a b -> Relation c d -> Relation (a, c) (b, d)
696806(><) (R a) (R b) = R ((I.><) a b)
@@ -698,28 +808,47 @@ infixl 4 ><
698808-- Relational co-products
699809
700810-- | Relational coproduct.
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
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
704827
705828-- | Relational coproduct first component injection
829+--
830+-- @
831+-- 'img' 'i1' ``union`` 'img' 'i2' == 'id'
832+-- 'i1' `.` 'i2' = 'zeros'
833+-- @
706834i1 ::
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)
835+ ( CountableDimsN a b,
836+ FLN b a,
837+ FLN a a
712838 )
713839 => Relation a (Either a b)
714840i1 = R I.i1
715841
716842-- | Relational coproduct second component injection
843+--
844+-- @
845+-- 'img' 'i1' ``union`` 'img' 'i2' == 'id'
846+-- 'i1' `.` 'i2' = 'zeros'
847+-- @
717848i2 ::
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)
849+ ( CountableDimsN a b,
850+ FLN a b,
851+ FLN b b
723852 )
724853 => Relation b (Either a b)
725854i2 = R I.i2
@@ -727,15 +856,16 @@ i2 = R I.i2
727856infixl 5 -|-
728857
729858-- | Relational coproduct functor.
859+--
860+-- @
861+-- r '-|-' s == 'eitherR' ('i1' `.` r) ('i2' `.` s)
862+-- @
730863(-|-) ::
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)
864+ ( CountableDimsN b d,
865+ FLN b b,
866+ FLN d b,
867+ FLN b d,
868+ FLN d d
739869 )
740870 => Relation a b -> Relation c d -> Relation (Either a c) (Either b d)
741871(-|-) (R a) (R b) = R ((I.-|-) a b)
@@ -743,97 +873,136 @@ infixl 5 -|-
743873-- Relational "Currying"
744874
745875-- | 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.
746880trans ::
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)))
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
760892 )
761893 => Relation (a, b) c -> Relation a (c, b)
762−trans r = splitR r p2 `comp` conv p1
894+trans r = splitR r sndR . conv fstR
763895
764896-- | 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.
765901untrans ::
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)))
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
779913 )
780914 => Relation a (c, b) -> Relation (a, b) c
781−untrans s = p1 `comp` conv (splitR (conv s) p2)
915+untrans s = fstR . conv (splitR (conv s) sndR)
782916
783917-- | 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+-- @
784927predR ::
785928 ( Bounded a,
786929 Enum 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)
930+ Countable a,
931+ CountableN a,
932+ FLN a a,
933+ FLN Bool a
790934 )
791− => (a -> Bool) -> Relation a a
792−predR p = identity `intersection` divisionF (fromF' (const True)) (fromF' p)
935+ => Relation a Bool -> Relation a a
936+predR p = id `intersection` divisionF (fromF (const True)) p
793937
794−-- | Equalizes functions @f@ and @g@.
938+-- | Equalizes functions @f@ and @g@.
795939-- That is, @'equalizer' f g@ is the largest coreflexive
796940-- 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+-- @
797946equalizer ::
798− ( KnownNat (I.Count (I.Normalize a)),
799− I.FromLists Boolean (I.Normalize a) (I.Normalize a)
947+ ( CountableN a,
948+ FLN a a
800949 )
801950 => Relation a b -> Relation a b -> Relation a a
802−equalizer f g = identity `intersection` divisionF f g
951+equalizer f g = id `intersection` divisionF f g
803952
804953-- | Relational conditional guard.
805954--
806955-- @
807−-- 'guard' p = 'i2' `'overriddenBy'` 'i1' `'comp'` 'predR' p
956+-- 'guard' p = 'i2' ``overriddenBy`` 'i1' `.` 'predR' p
808957-- @
809−guard ::
958+guard ::
810959 ( Bounded b,
811960 Enum b,
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)))
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)))
818967
819968-- | Relational McCarthy's conditional.
820−cond ::
969+cond ::
821970 ( Bounded b,
822971 Enum b,
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
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
830999
8311000-- Relation pretty print
8321001
8331002-- | Relation pretty printing
834−pretty :: (KnownNat (I.Count (I.Normalize a))) => Relation a b -> String
1003+pretty :: (CountableDimsN a b) => Relation a b -> String
8351004pretty (R a) = I.pretty a
8361005
8371006-- | Relation pretty printing
838−prettyPrint :: (KnownNat (I.Count (I.Normalize a))) => Relation a b -> IO ()
1007+prettyPrint :: (CountableDimsN a b) => Relation a b -> IO ()
8391008prettyPrint (R a) = I.prettyPrint a
src/LAoP/Utils.hs+6
@@ -94,6 +94,12 @@ module LAoP.Utils
9494 coerceNat,
9595 coerceNat2,
9696 coerceNat3,
97+
98+ -- * List data type
99+ List (..),
100+
101+ -- * Category type-class
102+ Category(..)
97103 )
98104where
99105
src/LAoP/Utils/Internal.hs+70−73
@@ -1,82 +1,13 @@
1+{-# LANGUAGE TypeFamilies #-}
2+{-# LANGUAGE DeriveGeneric #-}
13{-# LANGUAGE TypeApplications #-}
24{-# LANGUAGE DataKinds #-}
35{-# LANGUAGE FlexibleInstances #-}
46{-# LANGUAGE GeneralizedNewtypeDeriving #-}
5−{-# LANGUAGE KindSignatures #-}
67{-# LANGUAGE ScopedTypeVariables #-}
78
89module LAoP.Utils.Internal
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− --
10+ (
8011 -- * 'Natural' data type
8112 Natural(..),
8213 nat,
@@ -86,19 +17,31 @@ module LAoP.Utils.Internal
8617 coerceNat,
8718 coerceNat2,
8819 coerceNat3,
20+
21+ -- * 'List' data type
22+ List (..),
23+
24+ -- * Category type class
25+ Category(..)
8926 )
9027where
9128
9229import Data.Coerce
9330import Data.Proxy
31+import Data.List
32+import Data.Maybe
9433import GHC.TypeLits
9534import Control.DeepSeq
35+import GHC.Generics
36+import Data.Kind
37+import Prelude hiding (id, (.))
38+import qualified Prelude
9639
9740-- | Wrapper around 'Int's that have a restrictive semantic associated.
9841-- A value of type @'Natural' n m@ can only be instanciated with some 'Int'
9942-- @i@ that's @n <= i <= m@.
10043newtype Natural (start :: Nat) (end :: Nat) = Nat Int
101− deriving (Show, Read, Eq, Ord, NFData)
44+ deriving (Show, Read, Eq, Ord, NFData, Generic)
10245
10346-- | Throws a runtime error if any of the operations overflows or
10447-- underflows.
@@ -197,3 +140,57 @@ instance
197140
198141 fromEnum (Left a) = fromEnum a
199142 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.yamlnew file+1
@@ -0,0 +1 @@
1+resolver: lts-15.5
stack.yaml+1−66
@@ -1,66 +1 @@
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
1+resolver: lts-14.3
stack.yaml.lock+4−4
@@ -6,7 +6,7 @@
66packages: []
77snapshots:
88- completed:
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
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
test/Examples/Quantum.hsnew file+31
@@ -0,0 +1,31 @@
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)
app/Main.hs → test/Examples/Readme.hsrenamed+61−33
@@ -1,10 +1,13 @@
1+{-# LANGUAGE GADTs #-}
12{-# LANGUAGE DeriveGeneric #-}
23{-# LANGUAGE FlexibleContexts #-}
3−{-# LANGUAGE TypeOperators #-}
44{-# LANGUAGE TypeApplications #-}
55{-# LANGUAGE DataKinds #-}
66
7−module Main where
7+module Examples.Readme
8+ ( exec
9+ )
10+ where
811
912import LAoP.Matrix.Type
1013import qualified LAoP.Relation as R
@@ -12,13 +15,12 @@ import LAoP.Utils
1215import LAoP.Dist
1316import GHC.TypeLits
1417import Data.Coerce
15−import GHC.Generics
16−import Control.Category hiding (id)
17−import Prelude hiding ((.))
18+import qualified GHC.Generics as G
19+import Prelude hiding (id, (.))
1820
1921-- Monty Hall Problem
2022data Outcome = Win | Lose
21− deriving (Bounded, Enum, Eq, Show, Generic)
23+ deriving (Bounded, Enum, Eq, Show, G.Generic)
2224
2325switch :: Outcome -> Outcome
2426switch Win = Lose
@@ -28,7 +30,7 @@ firstChoice :: Matrix Double () Outcome
2830firstChoice = col [1/3, 2/3]
2931
3032secondChoice :: Matrix Double Outcome Outcome
31−secondChoice = fromF' switch
33+secondChoice = fromF switch
3234
3335-- Dice sum
3436
@@ -37,7 +39,7 @@ type SS = Natural 1 6 -- Sample Space
3739sumSS :: SS -> SS -> Natural 2 12
3840sumSS = coerceNat (+)
3941
40−sumSSM = fromF' (uncurry sumSS)
42+sumSSM = fromF (uncurry sumSS)
4143
4244condition :: (Int, Int) -> Int -> Int
4345condition (fst, snd) thrd = if fst == snd
@@ -47,38 +49,64 @@ condition (fst, snd) thrd = if fst == snd
4749conditionSS :: (SS, SS) -> SS -> Natural 3 18
4850conditionSS = coerceNat2 condition
4951
50−conditionalThrows = fromF' (uncurry conditionSS) . khatri (khatri die die) die
52+conditionalThrows = fromF (uncurry conditionSS) . kr (kr die die) die
5153
5254die :: Matrix Double () SS
5355die = col $ map (const (1/6)) [nat @1 @6 1 .. nat 6]
5456
5557-- 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)
5663
57−rain :: Matrix Double () Bool
58−rain = col [0.8, 0.2]
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
5972
60−sprinkler :: Matrix Double Bool Bool
61−sprinkler = fromLists [[0.6, 0.99], [0.4, 0.01]]
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
6292
63−grass :: Matrix Double (Bool, Bool) Bool
64−grass = fromLists [[1, 0.2, 0.1, 0.01], [0, 0.8, 0.9, 0.99]]
93+tag f = kr f id
6594
66−state :: Matrix Double () (Bool, (Bool, Bool))
67−state = khatri grass identity . khatri sprinkler identity . rain
95+state g s r = tag g . tag s . r
6896
69−grass_wet :: Matrix Double (Bool, (Bool, Bool)) One
70−grass_wet = row [0,1] . kp1
97+grass_wet :: Matrix Double () (G, (S, R)) -> Matrix Double One One
98+grass_wet state = row [0,1] . fstM . state
7199
72−rainning :: Matrix Double (Bool, (Bool, Bool)) One
73−rainning = row [0,1] . kp2 . kp2
100+rainning :: Matrix Double (G, (S, R)) One
101+rainning = row [0,1] . sndM . sndM
74102
75103-- Alcuin Puzzle
76104
77105data Being = Farmer | Fox | Goose | Beans
78− deriving (Bounded, Enum, Eq, Show, Generic)
106+ deriving (Bounded, Enum, Eq, Show, G.Generic)
79107
80108data Bank = LeftB | RightB
81− deriving (Bounded, Enum, Eq, Show, Generic)
109+ deriving (Bounded, Enum, Eq, Show, G.Generic)
82110
83111eats :: Being -> Being -> Bool
84112eats Fox Goose = True
@@ -93,21 +121,21 @@ cross LeftB = RightB
93121cross RightB = LeftB
94122
95123crossR :: R.Relation Bank Bank
96−crossR = R.fromF' cross
124+crossR = R.fromF cross
97125
98126-- | Initial state, everyone in the left bank
99127locationLeft :: Being -> Bank
100128locationLeft _ = LeftB
101129
102130locationLeftR :: R.Relation Being Bank
103−locationLeftR = R.fromF' locationLeft
131+locationLeftR = R.fromF locationLeft
104132
105133-- | Initial state, everyone in the right bank
106134locationRight :: Being -> Bank
107135locationRight _ = RightB
108136
109137locationRightR :: R.Relation Being Bank
110−locationRightR = R.fromF' locationRight
138+locationRightR = R.fromF locationRight
111139
112140-- Properties
113141
@@ -124,7 +152,7 @@ inv :: R.Relation Being Bank -> Bool
124152inv w = (w `R.comp` canEat w) `R.sse` (w `R.comp` farmer)
125153 where
126154 farmer :: R.Relation Being Being
127− farmer = R.fromF' (const Farmer)
155+ farmer = R.fromF (const Farmer)
128156
129157-- Arbitrary state
130158bankState :: Being -> Bank -> Bool
@@ -138,19 +166,19 @@ bankStateR :: R.Relation Being Bank
138166bankStateR = R.toRel bankState
139167
140168-- Main
141−main :: IO ()
142−main = do
169+exec :: IO ()
170+exec = do
143171 putStrLn "Monty Hall Problem solution:"
144172 prettyPrint (secondChoice . firstChoice)
145173 putStrLn "\n Sum of dices probability:"
146− prettyPrint (sumSSM `comp` khatri die die)
174+ prettyPrint (sumSSM . kr die die)
147175 putStrLn "\n Conditional dice throw:"
148176 prettyPrint conditionalThrows
149177 putStrLn "\n Checking that the last result is indeed a distribution: "
150− prettyPrint (bang . sumSSM . khatri die die)
178+ prettyPrint (bang . sumSSM . kr die die)
151179 putStrLn "\n Probability of grass being wet:"
152− prettyPrint (grass_wet . state)
180+ prettyPrint (grass_wet (state grass sprinkler rain))
153181 putStrLn "\n Probability of rain:"
154− prettyPrint (rainning . state)
182+ prettyPrint (rainning . state grass sprinkler rain)
155183 putStrLn "\n Is the arbitrary state a valid state? (Alcuin Puzzle)"
156184 print (inv bankStateR)
test/Examples/Spreadsheets.hsnew file+47
@@ -0,0 +1,47 @@
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+7−1
@@ -1,2 +1,8 @@
1+module Main (main) where
2+
3+import qualified Examples.Readme as RD
4+
15main :: IO ()
2−main = putStrLn "Test suite not yet implemented"
6+main = do
7+ putStrLn ("Testing if README works" :: String)
8+ RD.exec