├── .ghci ├── .github └── workflows │ └── haskell-ci.yml ├── .gitignore ├── .hlint.yaml ├── CHANGELOG.md ├── LICENSE.md ├── Makefile ├── README.md ├── bench └── nat.hs ├── cabal.haskell-ci ├── cabal.project ├── consreps ├── ConsReps.hs ├── H.hsig ├── Sum.hs ├── T.hsig └── Tuple.hs ├── def ├── Def.hs └── Rep.hsig ├── internal ├── AddrRep.hs ├── DoubleRep.hs ├── FloatRep.hs ├── Int16Rep.hs ├── Int32Rep.hs ├── Int64Rep.hs ├── Int8Rep.hs ├── IntRep.hs ├── LiftedRep.hs ├── NilReps.hs ├── RuntimeRep.hs ├── TupleRep.hs ├── Unboxed │ └── Internal │ │ ├── Class.hs │ │ ├── Combinators.hs │ │ ├── Levitation.hs │ │ ├── Lift.hs │ │ ├── Linear.hs │ │ ├── Linear │ │ └── Ur.hs │ │ ├── List.hs │ │ ├── Maybe.hs │ │ ├── Rebind.hs │ │ └── Syntax.hs ├── UnliftedRep.hs ├── Word16Rep.hs ├── Word32Rep.hs ├── Word64Rep.hs ├── Word8Rep.hs └── WordRep.hs ├── measurement ├── Internal.hs └── Whnf.hs ├── src └── Unboxed │ ├── Class.hs │ ├── Combinators.hs │ ├── Internal │ ├── BigNat.hs │ └── Natural.hs │ ├── Levitation.hs │ ├── List.hs │ ├── Maybe.hs │ ├── Natural.hs │ ├── Prelude.hs │ ├── Rep │ ├── Addr.hs │ ├── Double.hs │ ├── Float.hs │ ├── Int.hs │ ├── Int8.hs │ ├── Lifted.hs │ ├── Tuple.hs │ ├── Unlifted.hs │ └── Word.hs │ └── Syntax.hs └── unboxed.cabal /.ghci: -------------------------------------------------------------------------------- 1 | -- ghci binds 'it' to the last expression by default, but it assumes it lives in Type. this blocks overloaded printing 2 | :set -fno-it 3 | 4 | -- replace System.IO.print with whatever 'print' is in scope. We export a RuntimeRep polymorphic 'print' function. 5 | :set -interactive-print print 6 | 7 | -- we don't want standard Prelude definitions 8 | :set -XRebindableSyntax -XNoImplicitPrelude 9 | 10 | -- but you'll probably be working with unboxed types 11 | :set -XMagicHash -XUnboxedTuples -XUnboxedSums -XUnliftedNewtypes 12 | 13 | -- just to squelch some noise 14 | :set -Wno-type-defaults 15 | -------------------------------------------------------------------------------- /.github/workflows/haskell-ci.yml: -------------------------------------------------------------------------------- 1 | # This GitHub workflow config has been generated by a script via 2 | # 3 | # haskell-ci 'github' 'cabal.project' 4 | # 5 | # To regenerate the script (for example after adjusting tested-with) run 6 | # 7 | # haskell-ci regenerate 8 | # 9 | # For more information, see https://github.com/haskell-CI/haskell-ci 10 | # 11 | # version: 0.11.20210214 12 | # 13 | # REGENDATA ("0.11.20210214",["github","cabal.project"]) 14 | # 15 | name: Haskell-CI 16 | on: 17 | - push 18 | - pull_request 19 | jobs: 20 | irc: 21 | name: Haskell-CI (IRC notification) 22 | runs-on: ubuntu-18.04 23 | needs: 24 | - linux 25 | if: ${{ always() && (github.repository == 'ekmett/unlifted') }} 26 | strategy: 27 | fail-fast: false 28 | steps: 29 | - name: IRC success notification (irc.freenode.org#haskell-lens) 30 | uses: Gottox/irc-message-action@v1.1 31 | if: needs.linux.result == 'success' 32 | with: 33 | channel: "#haskell-lens" 34 | message: "\x0313unlifted\x03/\x0306${{ github.ref }}\x03 \x0314${{ github.sha }}\x03 https://github.com/${{ github.repository }}/actions/runs/${{ github.run_id }} The build succeeded." 35 | nickname: github-actions 36 | server: irc.freenode.org 37 | - name: IRC failure notification (irc.freenode.org#haskell-lens) 38 | uses: Gottox/irc-message-action@v1.1 39 | if: needs.linux.result != 'success' 40 | with: 41 | channel: "#haskell-lens" 42 | message: "\x0313unlifted\x03/\x0306${{ github.ref }}\x03 \x0314${{ github.sha }}\x03 https://github.com/${{ github.repository }}/actions/runs/${{ github.run_id }} The build failed." 43 | nickname: github-actions 44 | server: irc.freenode.org 45 | linux: 46 | name: Haskell-CI - Linux - GHC ${{ matrix.ghc }} 47 | runs-on: ubuntu-18.04 48 | container: 49 | image: buildpack-deps:bionic 50 | continue-on-error: ${{ matrix.allow-failure }} 51 | strategy: 52 | matrix: 53 | include: 54 | - ghc: 9.0.1 55 | ghc-source: ghcup 56 | allow-failure: false 57 | fail-fast: false 58 | steps: 59 | - name: apt 60 | run: | 61 | apt-get update 62 | apt-get install -y --no-install-recommends gnupg ca-certificates dirmngr curl git software-properties-common libnuma-dev 63 | if [ "${{ matrix.ghc-source }}" = "ghcup" ]; then 64 | curl -sL https://downloads.haskell.org/ghcup/0.1.12/x86_64-linux-ghcup-0.1.12 > ghcup 65 | chmod a+x ghcup 66 | ./ghcup install ghc $GHC_VERSION 67 | ./ghcup install cabal 3.4.0.0-rc4 68 | else 69 | apt-add-repository -y 'ppa:hvr/ghc' 70 | apt-get update 71 | apt-get install -y ghc-$GHC_VERSION cabal-install-3.2 72 | fi 73 | env: 74 | GHC_VERSION: ${{ matrix.ghc }} 75 | - name: Set PATH and environment variables 76 | run: | 77 | echo "$HOME/.cabal/bin" >> $GITHUB_PATH 78 | echo "LANG=C.UTF-8" >> $GITHUB_ENV 79 | echo "CABAL_DIR=$HOME/.cabal" >> $GITHUB_ENV 80 | echo "CABAL_CONFIG=$HOME/.cabal/config" >> $GITHUB_ENV 81 | if [ "${{ matrix.ghc-source }}" = "ghcup" ]; then 82 | HC=$HOME/.ghcup/bin/ghc-$GHC_VERSION 83 | echo "HC=$HC" >> $GITHUB_ENV 84 | echo "HCPKG=$HOME/.ghcup/bin/ghc-pkg-$GHC_VERSION" >> $GITHUB_ENV 85 | echo "HADDOCK=$HOME/.ghcup/bin/haddock-$GHC_VERSION" >> $GITHUB_ENV 86 | echo "CABAL=$HOME/.ghcup/bin/cabal-3.4.0.0-rc4 -vnormal+nowrap" >> $GITHUB_ENV 87 | else 88 | HC=/opt/ghc/$GHC_VERSION/bin/ghc 89 | echo "HC=$HC" >> $GITHUB_ENV 90 | echo "HCPKG=/opt/ghc/$GHC_VERSION/bin/ghc-pkg" >> $GITHUB_ENV 91 | echo "HADDOCK=/opt/ghc/$GHC_VERSION/bin/haddock" >> $GITHUB_ENV 92 | echo "CABAL=/opt/cabal/3.2/bin/cabal -vnormal+nowrap" >> $GITHUB_ENV 93 | fi 94 | HCNUMVER=$(${HC} --numeric-version|perl -ne '/^(\d+)\.(\d+)\.(\d+)(\.(\d+))?$/; print(10000 * $1 + 100 * $2 + ($3 == 0 ? $5 != 1 : $3))') 95 | echo "HCNUMVER=$HCNUMVER" >> $GITHUB_ENV 96 | echo "ARG_TESTS=--enable-tests" >> $GITHUB_ENV 97 | echo "ARG_BENCH=--enable-benchmarks" >> $GITHUB_ENV 98 | echo "HEADHACKAGE=false" >> $GITHUB_ENV 99 | echo "ARG_COMPILER=--ghc --with-compiler=$HC" >> $GITHUB_ENV 100 | echo "GHCJSARITH=0" >> $GITHUB_ENV 101 | env: 102 | GHC_VERSION: ${{ matrix.ghc }} 103 | - name: env 104 | run: | 105 | env 106 | - name: write cabal config 107 | run: | 108 | mkdir -p $CABAL_DIR 109 | cat >> $CABAL_CONFIG < cabal-plan.xz 143 | echo 'de73600b1836d3f55e32d80385acc055fd97f60eaa0ab68a755302685f5d81bc cabal-plan.xz' | sha256sum -c - 144 | xz -d < cabal-plan.xz > $HOME/.cabal/bin/cabal-plan 145 | rm -f cabal-plan.xz 146 | chmod a+x $HOME/.cabal/bin/cabal-plan 147 | cabal-plan --version 148 | - name: checkout 149 | uses: actions/checkout@v2 150 | with: 151 | path: source 152 | - name: initial cabal.project for sdist 153 | run: | 154 | touch cabal.project 155 | echo "packages: $GITHUB_WORKSPACE/source/." >> cabal.project 156 | cat cabal.project 157 | - name: sdist 158 | run: | 159 | mkdir -p sdist 160 | $CABAL sdist all --output-dir $GITHUB_WORKSPACE/sdist 161 | - name: unpack 162 | run: | 163 | mkdir -p unpacked 164 | find sdist -maxdepth 1 -type f -name '*.tar.gz' -exec tar -C $GITHUB_WORKSPACE/unpacked -xzvf {} \; 165 | - name: generate cabal.project 166 | run: | 167 | PKGDIR_unlifted="$(find "$GITHUB_WORKSPACE/unpacked" -maxdepth 1 -type d -regex '.*/unlifted-[0-9.]*')" 168 | echo "PKGDIR_unlifted=${PKGDIR_unlifted}" >> $GITHUB_ENV 169 | touch cabal.project 170 | touch cabal.project.local 171 | echo "packages: ${PKGDIR_unlifted}" >> cabal.project 172 | echo "package unlifted" >> cabal.project 173 | echo " ghc-options: -Werror=missing-methods" >> cabal.project 174 | cat >> cabal.project <> cabal.project.local 177 | cat cabal.project 178 | cat cabal.project.local 179 | - name: dump install plan 180 | run: | 181 | $CABAL v2-build $ARG_COMPILER $ARG_TESTS $ARG_BENCH --dry-run all 182 | cabal-plan 183 | - name: cache 184 | uses: actions/cache@v2 185 | with: 186 | key: ${{ runner.os }}-${{ matrix.ghc }}-${{ github.sha }} 187 | path: ~/.cabal/store 188 | restore-keys: ${{ runner.os }}-${{ matrix.ghc }}- 189 | - name: build 190 | run: | 191 | $CABAL v2-build $ARG_COMPILER $ARG_TESTS $ARG_BENCH all --write-ghc-environment-files=always 192 | - name: haddock 193 | run: | 194 | $CABAL v2-haddock $ARG_COMPILER --with-haddock $HADDOCK $ARG_TESTS $ARG_BENCH all 195 | -------------------------------------------------------------------------------- /.gitignore: -------------------------------------------------------------------------------- 1 | old 2 | wip 3 | dist-newstyle 4 | dist 5 | tags 6 | .ghc.* 7 | cabal.project.local 8 | -------------------------------------------------------------------------------- /.hlint.yaml: -------------------------------------------------------------------------------- 1 | - ignore: {name: Unused LANGUAGE pragma } 2 | 3 | -------------------------------------------------------------------------------- /CHANGELOG.md: -------------------------------------------------------------------------------- 1 | 0.2 [yyyy.mm.dd] unreleased 2 | ----------------- 3 | * Edward Kmett replaced it with a completely different library. 4 | 5 | 0.1 6 | --- 7 | * Carter Schonwald released a library. 8 | -------------------------------------------------------------------------------- /LICENSE.md: -------------------------------------------------------------------------------- 1 | # License 2 | 3 | Licensed under either of 4 | * Apache License, Version 2.0 (http://www.apache.org/licenses/LICENSE-2.0) 5 | * BSD 2-Clause license (https://opensource.org/licenses/BSD-2-Clause) 6 | at your option. 7 | 8 | ## BSD 2-Clause License 9 | 10 | - Copyright 2018 Edward Kmett 11 | 12 | All rights reserved. 13 | 14 | Redistribution and use in source and binary forms, with or without 15 | modification, are permitted provided that the following conditions 16 | are met: 17 | 18 | 1. Redistributions of source code must retain the above copyright 19 | notice, this list of conditions and the following disclaimer. 20 | 21 | 2. Redistributions in binary form must reproduce the above copyright 22 | notice, this list of conditions and the following disclaimer in the 23 | documentation and/or other materials provided with the distribution. 24 | 25 | THIS SOFTWARE IS PROVIDED BY THE AUTHORS ``AS IS'' AND ANY EXPRESS OR 26 | IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED 27 | WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE 28 | DISCLAIMED. IN NO EVENT SHALL THE AUTHORS OR CONTRIBUTORS BE LIABLE FOR 29 | ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL 30 | DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS 31 | OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) 32 | HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, 33 | STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN 34 | ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE 35 | POSSIBILITY OF SUCH DAMAGE. 36 | 37 | ## Apache License 38 | 39 | _Version 2.0, January 2004_ 40 | _<>_ 41 | 42 | ### Terms and Conditions for use, reproduction, and distribution 43 | 44 | #### 1. Definitions 45 | 46 | “License” shall mean the terms and conditions for use, reproduction, and 47 | distribution as defined by Sections 1 through 9 of this document. 48 | 49 | “Licensor” shall mean the copyright owner or entity authorized by the copyright 50 | owner that is granting the License. 51 | 52 | “Legal Entity” shall mean the union of the acting entity and all other entities 53 | that control, are controlled by, or are under common control with that entity. 54 | For the purposes of this definition, “control” means **(i)** the power, direct or 55 | indirect, to cause the direction or management of such entity, whether by 56 | contract or otherwise, or **(ii)** ownership of fifty percent (50%) or more of the 57 | outstanding shares, or **(iii)** beneficial ownership of such entity. 58 | 59 | “You” (or “Your”) shall mean an individual or Legal Entity exercising 60 | permissions granted by this License. 61 | 62 | “Source” form shall mean the preferred form for making modifications, including 63 | but not limited to software source code, documentation source, and configuration 64 | files. 65 | 66 | “Object” form shall mean any form resulting from mechanical transformation or 67 | translation of a Source form, including but not limited to compiled object code, 68 | generated documentation, and conversions to other media types. 69 | 70 | “Work” shall mean the work of authorship, whether in Source or Object form, made 71 | available under the License, as indicated by a copyright notice that is included 72 | in or attached to the work (an example is provided in the Appendix below). 73 | 74 | “Derivative Works” shall mean any work, whether in Source or Object form, that 75 | is based on (or derived from) the Work and for which the editorial revisions, 76 | annotations, elaborations, or other modifications represent, as a whole, an 77 | original work of authorship. For the purposes of this License, Derivative Works 78 | shall not include works that remain separable from, or merely link (or bind by 79 | name) to the interfaces of, the Work and Derivative Works thereof. 80 | 81 | “Contribution” shall mean any work of authorship, including the original version 82 | of the Work and any modifications or additions to that Work or Derivative Works 83 | thereof, that is intentionally submitted to Licensor for inclusion in the Work 84 | by the copyright owner or by an individual or Legal Entity authorized to submit 85 | on behalf of the copyright owner. For the purposes of this definition, 86 | “submitted” means any form of electronic, verbal, or written communication sent 87 | to the Licensor or its representatives, including but not limited to 88 | communication on electronic mailing lists, source code control systems, and 89 | issue tracking systems that are managed by, or on behalf of, the Licensor for 90 | the purpose of discussing and improving the Work, but excluding communication 91 | that is conspicuously marked or otherwise designated in writing by the copyright 92 | owner as “Not a Contribution.” 93 | 94 | “Contributor” shall mean Licensor and any individual or Legal Entity on behalf 95 | of whom a Contribution has been received by Licensor and subsequently 96 | incorporated within the Work. 97 | 98 | #### 2. Grant of Copyright License 99 | 100 | Subject to the terms and conditions of this License, each Contributor hereby 101 | grants to You a perpetual, worldwide, non-exclusive, no-charge, royalty-free, 102 | irrevocable copyright license to reproduce, prepare Derivative Works of, 103 | publicly display, publicly perform, sublicense, and distribute the Work and such 104 | Derivative Works in Source or Object form. 105 | 106 | #### 3. Grant of Patent License 107 | 108 | Subject to the terms and conditions of this License, each Contributor hereby 109 | grants to You a perpetual, worldwide, non-exclusive, no-charge, royalty-free, 110 | irrevocable (except as stated in this section) patent license to make, have 111 | made, use, offer to sell, sell, import, and otherwise transfer the Work, where 112 | such license applies only to those patent claims licensable by such Contributor 113 | that are necessarily infringed by their Contribution(s) alone or by combination 114 | of their Contribution(s) with the Work to which such Contribution(s) was 115 | submitted. If You institute patent litigation against any entity (including a 116 | cross-claim or counterclaim in a lawsuit) alleging that the Work or a 117 | Contribution incorporated within the Work constitutes direct or contributory 118 | patent infringement, then any patent licenses granted to You under this License 119 | for that Work shall terminate as of the date such litigation is filed. 120 | 121 | #### 4. Redistribution 122 | 123 | You may reproduce and distribute copies of the Work or Derivative Works thereof 124 | in any medium, with or without modifications, and in Source or Object form, 125 | provided that You meet the following conditions: 126 | 127 | * **(a)** You must give any other recipients of the Work or Derivative Works a copy of 128 | this License; and 129 | * **(b)** You must cause any modified files to carry prominent notices stating that You 130 | changed the files; and 131 | * **(c)** You must retain, in the Source form of any Derivative Works that You distribute, 132 | all copyright, patent, trademark, and attribution notices from the Source form 133 | of the Work, excluding those notices that do not pertain to any part of the 134 | Derivative Works; and 135 | * **(d)** If the Work includes a “NOTICE” text file as part of its distribution, then any 136 | Derivative Works that You distribute must include a readable copy of the 137 | attribution notices contained within such NOTICE file, excluding those notices 138 | that do not pertain to any part of the Derivative Works, in at least one of the 139 | following places: within a NOTICE text file distributed as part of the 140 | Derivative Works; within the Source form or documentation, if provided along 141 | with the Derivative Works; or, within a display generated by the Derivative 142 | Works, if and wherever such third-party notices normally appear. The contents of 143 | the NOTICE file are for informational purposes only and do not modify the 144 | License. You may add Your own attribution notices within Derivative Works that 145 | You distribute, alongside or as an addendum to the NOTICE text from the Work, 146 | provided that such additional attribution notices cannot be construed as 147 | modifying the License. 148 | 149 | You may add Your own copyright statement to Your modifications and may provide 150 | additional or different license terms and conditions for use, reproduction, or 151 | distribution of Your modifications, or for any such Derivative Works as a whole, 152 | provided Your use, reproduction, and distribution of the Work otherwise complies 153 | with the conditions stated in this License. 154 | 155 | #### 5. Submission of Contributions 156 | 157 | Unless You explicitly state otherwise, any Contribution intentionally submitted 158 | for inclusion in the Work by You to the Licensor shall be under the terms and 159 | conditions of this License, without any additional terms or conditions. 160 | Notwithstanding the above, nothing herein shall supersede or modify the terms of 161 | any separate license agreement you may have executed with Licensor regarding 162 | such Contributions. 163 | 164 | #### 6. Trademarks 165 | 166 | This License does not grant permission to use the trade names, trademarks, 167 | service marks, or product names of the Licensor, except as required for 168 | reasonable and customary use in describing the origin of the Work and 169 | reproducing the content of the NOTICE file. 170 | 171 | #### 7. Disclaimer of Warranty 172 | 173 | Unless required by applicable law or agreed to in writing, Licensor provides the 174 | Work (and each Contributor provides its Contributions) on an “AS IS” BASIS, 175 | WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied, 176 | including, without limitation, any warranties or conditions of TITLE, 177 | NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A PARTICULAR PURPOSE. You are 178 | solely responsible for determining the appropriateness of using or 179 | redistributing the Work and assume any risks associated with Your exercise of 180 | permissions under this License. 181 | 182 | #### 8. Limitation of Liability 183 | 184 | In no event and under no legal theory, whether in tort (including negligence), 185 | contract, or otherwise, unless required by applicable law (such as deliberate 186 | and grossly negligent acts) or agreed to in writing, shall any Contributor be 187 | liable to You for damages, including any direct, indirect, special, incidental, 188 | or consequential damages of any character arising as a result of this License or 189 | out of the use or inability to use the Work (including but not limited to 190 | damages for loss of goodwill, work stoppage, computer failure or malfunction, or 191 | any and all other commercial damages or losses), even if such Contributor has 192 | been advised of the possibility of such damages. 193 | 194 | #### 9. Accepting Warranty or Additional Liability 195 | 196 | While redistributing the Work or Derivative Works thereof, You may choose to 197 | offer, and charge a fee for, acceptance of support, warranty, indemnity, or 198 | other liability obligations and/or rights consistent with this License. However, 199 | in accepting such obligations, You may act only on Your own behalf and on Your 200 | sole responsibility, not on behalf of any other Contributor, and only if You 201 | agree to indemnify, defend, and hold each Contributor harmless for any liability 202 | incurred by, or claims asserted against, such Contributor by reason of your 203 | accepting any such warranty or additional liability. 204 | 205 | _END OF TERMS AND CONDITIONS_ 206 | 207 | ### APPENDIX: How to apply the Apache License to your work 208 | 209 | To apply the Apache License to your work, attach the following boilerplate 210 | notice, with the fields enclosed by brackets `[]` replaced with your own 211 | identifying information. (Don't include the brackets!) The text should be 212 | enclosed in the appropriate comment syntax for the file format. We also 213 | recommend that a file or class name and description of purpose be included on 214 | the same “printed page” as the copyright notice for easier identification within 215 | third-party archives. 216 | 217 | Copyright [yyyy] [name of copyright owner] 218 | 219 | Licensed under the Apache License, Version 2.0 (the "License"); 220 | you may not use this file except in compliance with the License. 221 | You may obtain a copy of the License at 222 | 223 | http://www.apache.org/licenses/LICENSE-2.0 224 | 225 | Unless required by applicable law or agreed to in writing, software 226 | distributed under the License is distributed on an "AS IS" BASIS, 227 | WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 228 | See the License for the specific language governing permissions and 229 | limitations under the License. 230 | 231 | -------------------------------------------------------------------------------- /Makefile: -------------------------------------------------------------------------------- 1 | PWD=$(shell pwd) 2 | LIBRARY=$(shell basename $(PWD)) 3 | 4 | all: build 5 | 6 | build: 7 | @cabal build -v0 8 | 9 | level2: 10 | @cabal build -v0 -flevel2 11 | 12 | install: 13 | @cabal install 14 | 15 | clean: 16 | @cabal clean 17 | 18 | docs: 19 | @RESULT=`cabal haddock --haddock-hyperlink-source unboxed def core 2>/dev/null | tail -n 2`; \ 20 | if [[ `echo $$RESULT | head -c 22` = "Documentation created:" ]]; then \ 21 | $(OPEN) `echo $$RESULT | tail -c +23`; \ 22 | fi 23 | 24 | watch: 25 | @ghcid -p unboxed --color -c 'cabal repl unboxed --repl-options=-fno-code --repl-options=-fno-break-on-exception --repl-options=-fno-break-on-error --repl-options=-v1 --repl-options=-ferror-spans --repl-options=-Wno-prepositive-qualified-module --repl-options=-ignore-dot-ghci' 26 | 27 | watch-core: 28 | @ghcid -p core --color -c 'cabal repl core --repl-options=-fno-code --repl-options=-fno-break-on-exception --repl-options=-fno-break-on-error --repl-options=-v1 --repl-options=-ferror-spans --repl-options=-Wno-prepositive-qualified-module --repl-options=-ignore-dot-ghci' 29 | 30 | repl: 31 | @cabal repl unboxed --repl-options=-fno-it --repl-options=-interactive-print=print --repl-options=-fobject-code --repl-options=-v1 --repl-options=-ferror-spans --repl-options=-fobject-code 32 | 33 | lint: 34 | @find . -name "*.hs" -print | xargs hlint 35 | 36 | .PHONY: all build clean docs install watch repl lint 37 | 38 | UNAME_S := $(shell uname -s) 39 | ifeq ($(UNAME_S),Darwin) 40 | OPEN = open 41 | else 42 | OPEN = echo 43 | endif 44 | -------------------------------------------------------------------------------- /README.md: -------------------------------------------------------------------------------- 1 | # unboxed 2 | 3 | [![Travis Continuous Integration Status][travis-img]][travis] 4 | 5 | This is a small package exploring how to overload Prelude typeclasses to work over multiple `RuntimeRep`s. 6 | 7 | The end result is that with enough extensions, including `NoImplicitPrelude`, and `RebindableSyntax`, importing `Unlifted.Prelude` will allow you to work with `Eq`, `Ord`, `Num`, etc. in any `TYPE r`, not just `TYPE 'LiftedRep`. This allows using numeric literals such as 3 in unlifted types such as `Int#`, or `Float#`. If you are working with types of kind Type, this package will delegate to normal Prelude instances, so you don't have to provide duplicate definitions. 8 | 9 | In addition to overloading classes, some limited data types are also offered. Notably lists of lifted or unboxed values, and lifted and unlifted Maybes of lifted or unlifted values. When GHC 9.2 lands, hopefully with support for unboxed data types, then an unlifted list should be possible. 10 | 11 | The key operation to allow this is `Lev` in `Unlifted.Levitation`. It can be used to adapt _any_ `TYPE r` to `Type` in negative position, by observing that in core, any constrained type is in Type and attaching a trivial constraint. 12 | 13 | This allows `ifThenElse` to work under `RebindableSyntax` at all `TYPE r` types, despite levity polymorphism not allowing its use in negative position, _and_ for the `if` to be appropriately lazy. 14 | 15 | If you are going to explore the library using the `ghci`, I'd recommend running ghci with `-fno-it` to keep it from trying to bing the last variable, given it can't bind unlifted variables. Running with `-interactive-print print` will use whatever defininition of `print` is in scope, and the one in `Unlifted.Prelude` is sufficiently polymorphic to work with lifted and unlifted values. See the comments in the local `.ghci` file. 16 | 17 | There are a lot of classes in `base` that should be ported, and many hands make for light work, so please feel free to pitch in! 18 | 19 | License 20 | ======= 21 | 22 | [Licensed](LICENSE.md) under either of 23 | * Apache License, Version 2.0 (http://www.apache.org/licenses/LICENSE-2.0) 24 | * BSD 2-Clause license (https://opensource.org/licenses/BSD-2-Clause) 25 | at your option. 26 | 27 | Unless you explicitly state otherwise, any contribution intentionally submitted 28 | for inclusion in the work by you shall be dual-licensed as above, without any 29 | additional terms or conditions. 30 | 31 | Contact Information 32 | =================== 33 | 34 | Contributions and bug reports are welcome! 35 | 36 | Please feel free to contact me through github or on the `##coda` or `#haskell` IRC channels on `irc.freenode.net`. 37 | 38 | -Edward Kmett 39 | 40 | [travis]: http://travis-ci.org/ekmett/linear-primitive 41 | [travis-img]: https://secure.travis-ci.org/ekmett/linear-primitive.png?branch=master 42 | -------------------------------------------------------------------------------- /bench/nat.hs: -------------------------------------------------------------------------------- 1 | {-# LANGUAGE MagicHash, UnboxedSums, ImportQualifiedPost, NoImplicitPrelude, RebindableSyntax, UnliftedNewtypes, LambdaCase #-} 2 | import Control.Exception 3 | import Criterion.Main 4 | import Criterion.Types 5 | import Data.Functor 6 | import Data.Int 7 | import Data.List qualified as List 8 | import GHC.Exts 9 | import GHC.Prim 10 | import Unboxed.Natural 11 | import Unboxed.Prelude as UP 12 | import Prelude (Integer, pure, map, fromIntegral, (>>), (.), IO, seq) 13 | import Whnf 14 | 15 | data B = B (# Int# | Integer #) 16 | 17 | instance Show B where 18 | showsPrec d x = showsPrec d (tointeger x) 19 | show x = show (tointeger x) 20 | 21 | add :: B -> B -> B 22 | add (B x) (B y) = case x of 23 | (# x | #) -> case y of 24 | (# y | #) -> case addIntC# x y of 25 | (# result, 0# #) -> B (# result | #) 26 | _ -> B (# | fromIntegral (I# x) + fromIntegral (I# y) #) 27 | (# | integer #) -> B (# | fromIntegral (I# x) + integer #) 28 | (# | integer #) -> case y of 29 | (# i | #) -> B (# | fromIntegral (I# i) + integer #) 30 | (# | integer2 #) -> B (# | integer + integer2 #) 31 | 32 | tointeger :: B -> Integer 33 | tointeger (B x) = case x of 34 | (# x | #) -> fromIntegral $ I# x 35 | (# | y #) -> y 36 | 37 | fromint ::Integer -> B 38 | fromint x = if x <= fromIntegral (minBound::Int) || x >= fromIntegral (maxBound::Int) 39 | then B (# | x #) 40 | else let I# i = fromInteger x in B (# i | #) 41 | 42 | newtype B# = B# (# Int# | Integer #) 43 | 44 | instance Show B# where 45 | showsPrec d x = showsPrec d (tointeger# x) 46 | show x = show (tointeger# x) 47 | 48 | add# :: B# -> B# -> B# 49 | add# = \case 50 | B# (# x | #) -> \case 51 | B# (# y | #) -> case addIntC# x y of 52 | (# result, 0# #) -> B# (# result | #) 53 | _ -> B# (# | fromIntegral (I# x) + fromIntegral (I# y) #) 54 | B# (# | integer #) -> B# (# | fromIntegral (I# x) + integer #) 55 | B# (# | integer #) -> \case 56 | B# (# i | #) -> B# (# | fromIntegral (I# i) + integer #) 57 | B# (# | integer2 #) -> B# (# | integer + integer2 #) 58 | 59 | tointeger# :: B# -> Integer 60 | tointeger# x = case x of 61 | B# (# x | #) -> fromIntegral $ I# x 62 | B# (# | y #) -> y 63 | 64 | fromint# :: Integer -> B# 65 | fromint# x = if x <= fromIntegral (minBound::Int) || x >= fromIntegral (maxBound::Int) 66 | then B# (# | x #) 67 | else let I# i = fromInteger x in B# (# i | #) 68 | 69 | main :: IO () 70 | main = do 71 | defaultMain $ pure $ bgroup "add" 72 | [ bench "B" (whnfL add'B (fromint (-1000000))) 73 | , bench "B#" (whnfB# add'B# (fromint# (-1000000))) 74 | , bench "Int" (whnfL add'Int (-1000000)) 75 | , bench "Integer" (whnfL add'Integer (-1000000)) 76 | ] 77 | defaultMain $ pure $ bgroup "sub" 78 | [ bench "Int" (whnfL sub'Int 1000000) 79 | , bench "Integer" (whnfL sub'Integer 1000000) 80 | , bench "Natural#" (whnfN# sub'Natural# 1000000) 81 | ] 82 | where 83 | add'B :: B -> () 84 | add'B b@(B x) = case x of 85 | (# 0# | #) -> () 86 | _ -> add'B (b `add` fromint 1) 87 | 88 | add'B# :: B# -> () 89 | add'B# b@(B# x) = case x of 90 | (# 0# | #) -> () 91 | _ -> add'B# (b `add#` fromint# 1) 92 | 93 | add'Int :: Int -> () 94 | add'Int 0 = () 95 | add'Int a = add'Int (a + 1) 96 | 97 | add'Integer :: Integer -> () 98 | add'Integer 0 = () 99 | add'Integer a = add'Integer (a + 1) 100 | 101 | sub'Int :: Int -> () 102 | sub'Int 0 = () 103 | sub'Int a = sub'Int (a - 1) 104 | 105 | sub'Integer :: Integer -> () 106 | sub'Integer 0 = () 107 | sub'Integer a = sub'Integer (a - 1) 108 | 109 | sub'Natural# :: Natural# -> () 110 | sub'Natural# 0 = () 111 | sub'Natural# a = sub'Natural# (a - 1) 112 | -------------------------------------------------------------------------------- /cabal.haskell-ci: -------------------------------------------------------------------------------- 1 | no-tests-no-benchmarks: False 2 | unconstrained: False 3 | hlint: False 4 | irc-channels: irc.freenode.org#haskell-lens 5 | irc-if-in-origin-repo: True 6 | docspec: False 7 | -------------------------------------------------------------------------------- /cabal.project: -------------------------------------------------------------------------------- 1 | packages: . 2 | 3 | allow-newer: ghc-lib-parser:base, polyparse:base 4 | -------------------------------------------------------------------------------- /consreps/ConsReps.hs: -------------------------------------------------------------------------------- 1 | {-# Language DataKinds #-} 2 | {-# Language StandaloneKindSignatures #-} 3 | {-# Language ImportQualifiedPost #-} 4 | {-# Language TypeOperators #-} 5 | module ConsReps where 6 | import GHC.Types (RuntimeRep) 7 | import H qualified 8 | import T qualified 9 | type Reps :: [RuntimeRep] 10 | type Reps = H.Rep ': T.Reps 11 | -------------------------------------------------------------------------------- /consreps/H.hsig: -------------------------------------------------------------------------------- 1 | {-# Language KindSignatures #-} 2 | {-# Language StandaloneKindSignatures #-} 3 | signature H where 4 | import GHC.Types (RuntimeRep) 5 | data Rep :: RuntimeRep 6 | -------------------------------------------------------------------------------- /consreps/Sum.hs: -------------------------------------------------------------------------------- 1 | {-# Language DataKinds #-} 2 | {-# Language StandaloneKindSignatures #-} 3 | module Sum where 4 | import GHC.Types 5 | import ConsReps 6 | type Rep :: RuntimeRep 7 | type Rep = 'SumRep Reps 8 | -------------------------------------------------------------------------------- /consreps/T.hsig: -------------------------------------------------------------------------------- 1 | {-# Language DataKinds #-} 2 | {-# Language KindSignatures #-} 3 | {-# Language StandaloneKindSignatures #-} 4 | signature T where 5 | import GHC.Types (RuntimeRep) 6 | data Reps :: [RuntimeRep] 7 | -------------------------------------------------------------------------------- /consreps/Tuple.hs: -------------------------------------------------------------------------------- 1 | {-# Language DataKinds #-} 2 | {-# Language StandaloneKindSignatures #-} 3 | module Tuple where 4 | import GHC.Types 5 | import ConsReps 6 | type Rep :: RuntimeRep 7 | type Rep = 'TupleRep Reps 8 | -------------------------------------------------------------------------------- /def/Def.hs: -------------------------------------------------------------------------------- 1 | {-# Language MagicHash #-} 2 | {-# Language UnboxedSums #-} 3 | {-# Language UnboxedTuples #-} 4 | {-# Language TypeFamilies #-} 5 | {-# Language PolyKinds #-} 6 | {-# Language BangPatterns #-} 7 | {-# Language DataKinds #-} 8 | {-# Language PatternSynonyms #-} 9 | {-# Language RankNTypes #-} 10 | {-# Language NoImplicitPrelude #-} 11 | {-# Language TypeApplications #-} 12 | {-# Language RebindableSyntax #-} 13 | {-# Language ImportQualifiedPost #-} 14 | {-# Language FlexibleContexts #-} 15 | {-# Language FlexibleInstances #-} 16 | {-# Language StandaloneKindSignatures #-} 17 | 18 | module Def where 19 | 20 | import Unboxed.Internal.Class 21 | import Unboxed.Internal.List 22 | import Unboxed.Internal.Maybe 23 | import Unboxed.Internal.Rebind 24 | import GHC.Types 25 | import Prelude (otherwise, not, (++), ShowS, (.), showString, showParen,($), (&&), (||)) 26 | import Prelude qualified 27 | import System.IO qualified as IO 28 | 29 | import Rep 30 | 31 | instance EqRep Rep where 32 | eqDef x y = not (x /= y) 33 | neDef x y = not (x == y) 34 | 35 | instance OrdRep Rep where 36 | compareDef x y 37 | | x == y = EQ 38 | | x <= y = LT 39 | | otherwise = GT 40 | 41 | ltDef x y = case compare x y of LT -> True; _ -> False 42 | leDef x y = case compare x y of GT -> False; _ -> True 43 | gtDef x y = case compare x y of GT -> True; _ -> False 44 | geDef x y = case compare x y of LT -> False; _ -> True 45 | 46 | maxDef x y 47 | | x <= y = y 48 | | otherwise = x 49 | 50 | minDef x y 51 | | x <= y = x 52 | | otherwise = y 53 | 54 | instance NumRep Rep where 55 | negateDef a = 0 - a 56 | minusDef a b = a + negate b 57 | 58 | instance FractionalRep Rep where 59 | fractionalDef x y = x * recip y 60 | recipDef x = 1 / x 61 | 62 | instance RealRep Rep where 63 | realToFracDef x = fromRational (toRational x) 64 | 65 | instance EnumRep Rep where 66 | {- 67 | enumFromDef x = map toEnum [fromEnum x ..] 68 | enumFromThenDef x y = map toEnum [fromEnum x, fromEnum y ..] 69 | enumFromToDef x y = map toEnum [fromEnum x .. fromEnum y] 70 | enumFromThenToDef x1 x2 y = map toEnum [fromEnum x1, fromEnum x2 .. fromEnum y] 71 | -} 72 | succDef x = toEnum (fromEnum x + 1) 73 | predDef x = toEnum (fromEnum x - 1) 74 | 75 | instance IntegralRep Rep where 76 | n `quotDef` d = q where !(# q, _ #) = quotRem n d 77 | n `remDef` d = r where !(# _, r #) = quotRem n d 78 | n `divDef` d = q where !(# q, _ #) = divMod n d 79 | n `modDef` d = r where !(# _, r #) = divMod n d 80 | divModDef n d 81 | | signum r == negate (signum d) = (# q - 1, r + d #) 82 | | otherwise = qr 83 | where !qr@(# q, r #) = quotRem n d 84 | 85 | instance RealFracRep Rep where 86 | truncateDef x = fromInteger m where 87 | !(# m, _ #) = properFraction x 88 | {-# INLINE truncateDef #-} 89 | 90 | roundDef x = 91 | let !(# n, r #) = properFraction x 92 | m | r < 0 = n - 1 93 | | otherwise = n + 1 94 | in case signum (abs r - 0.5) of 95 | -1 -> fromInteger n 96 | 0 | Prelude.even n -> fromInteger n 97 | | otherwise -> fromInteger m 98 | 1 -> fromInteger m 99 | _ -> Prelude.error "round default defn: Bad value" 100 | 101 | ceilingDef x 102 | | r > 0 = fromInteger (n + 1) 103 | | otherwise = fromInteger n 104 | where !(# n, r #) = properFraction x 105 | 106 | floorDef x 107 | | r < 0 = fromInteger (n - 1) 108 | | otherwise = fromInteger n 109 | where !(# n, r #) = properFraction x 110 | 111 | instance FloatingRep Rep where 112 | {-# INLINE powDef #-} 113 | {-# INLINE logBaseDef #-} 114 | {-# INLINE sqrtDef #-} 115 | {-# INLINE tanDef #-} 116 | {-# INLINE tanhDef #-} 117 | powDef x y = exp (log x * y) 118 | logBaseDef x y = log y / log x 119 | sqrtDef x = x ** 0.5 120 | tanDef x = sin x / cos x 121 | tanhDef x = sinh x / cosh x 122 | 123 | {-# INLINE log1pDef #-} 124 | {-# INLINE expm1Def #-} 125 | {-# INLINE log1pexpDef #-} 126 | {-# INLINE log1mexpDef #-} 127 | log1pDef x = log (1 + x) 128 | expm1Def x = exp x - 1 129 | log1pexpDef x = log1p (exp x) 130 | log1mexpDef x = log1p (negate (exp x)) 131 | 132 | instance RealFloatRep Rep where 133 | exponentDef x 134 | | m == 0 = 0 135 | | otherwise = n + floatDigits x 136 | where !(# m, n #) = decodeFloat x 137 | 138 | significandDef x = encodeFloat m (negate (floatDigits x)) 139 | where !(# m, _ #) = decodeFloat x 140 | 141 | scaleFloatDef 0 x = x 142 | scaleFloatDef k x 143 | | isFix = x 144 | | otherwise = encodeFloat m (n + clamp b k) 145 | where 146 | !(# m, n #) = decodeFloat x 147 | !(# l, h #) = floatRange x 148 | d = floatDigits x 149 | b = h - l + 4 * d 150 | isFix = x == 0 || isNaN x || isInfinite x 151 | clamp :: Int -> Int -> Int 152 | clamp bd k' = max (-bd) (min bd k') 153 | 154 | atan2Def y x 155 | | x > 0 = atan (y/x) 156 | | x == 0 && y > 0 = pi/2 157 | | x < 0 && y > 0 = pi + atan (y/x) 158 | |(x <= 0 && y < 0) || 159 | (x < 0 && isNegativeZero y) || 160 | (isNegativeZero x && isNegativeZero y) 161 | = -atan2 (-y) x 162 | | y == 0 && (x < 0 || isNegativeZero x) 163 | = pi -- must be after the previous test on zero y 164 | | x==0 && y==0 = y -- must be after the other double zero tests 165 | | otherwise = x + y -- x or y is a NaN, return a NaN (via +) 166 | 167 | data instance ListD (a :: TYPE Rep) = Nil | a :# List a 168 | infixr 5 :# 169 | 170 | instance ListRep Rep where 171 | cons = (:#) 172 | cons' a as = a :# as 173 | nil = Nil 174 | uncons# (a :# as) = Maybe# (# | (# a, as #) #) 175 | uncons# Nil = Maybe# (# (##) | #) 176 | 177 | instance Eq a => Prelude.Eq (ListD @Rep a) where 178 | Nil == Nil = True 179 | a :# as == b :# bs = a == b && as == bs 180 | _ == _ = False 181 | 182 | Nil /= Nil = True 183 | a :# as /= b :# bs = a /= b || as /= bs 184 | _ /= _ = False 185 | 186 | instance Ord a => Prelude.Ord (ListD @Rep a) where 187 | compare Nil Nil = EQ 188 | compare Nil (:#){} = LT 189 | compare (:#){} Nil = GT 190 | compare (a:#as) (b:#bs) = compare a b <> compare as bs 191 | 192 | instance ShowList a => Prelude.Show (ListD @Rep a) where 193 | showsPrec _ = showList 194 | 195 | data instance MaybeD (a :: TYPE Rep) = Nothing | Just a 196 | 197 | instance Eq a => Prelude.Eq (MaybeD @Rep a) where 198 | Nothing == Nothing = True 199 | Just a == Just b = a == b 200 | _ == _ = False 201 | 202 | instance Ord a => Prelude.Ord (MaybeD @Rep a) where 203 | compare Nothing Nothing = EQ 204 | compare Nothing Just{} = LT 205 | compare Just{} Nothing = GT 206 | compare (Just a) (Just b) = compare a b 207 | 208 | instance Show a => Prelude.Show (MaybeD @Rep a) where 209 | showsPrec _ Nothing = showString "Nothing" 210 | showsPrec d (Just a) = showParen (d >= 11) $ showString "Just " . showsPrec 11 a 211 | 212 | instance MaybeRep Rep where 213 | nothing = Nothing 214 | just = Just 215 | just' x = Just x 216 | maybe n _ Nothing = n 217 | maybe _ j (Just a) = j a 218 | mapMaybe _ Nothing = nothing 219 | mapMaybe f (Just a) = just' (f a) 220 | 221 | instance MaybeRep# Rep where 222 | nothing# = Maybe# (# (##) | #) 223 | just# a = Maybe# (# | a #) 224 | just'# a = Maybe# (# | a #) 225 | maybe# n _ (Maybe# (# (##) | #)) = n 226 | maybe# _ j (Maybe# (# | a #)) = j a 227 | mapMaybe# _ (Maybe# (# (##) | #)) = nothing# 228 | mapMaybe# f (Maybe# (# | a #)) = just'# (f a) 229 | 230 | pattern Nothing# :: forall (a :: TYPE Rep). Maybe# a 231 | pattern Nothing# = Maybe# (# (##) | #) 232 | 233 | pattern Just# :: forall (a :: TYPE Rep). a -> Maybe# a 234 | pattern Just# a = Maybe# (# | a #) 235 | 236 | -- Maybe# can be made a monomorphic functor where the result rep must match the input rep 237 | -- not very satisfying, but the best we can do until richard allows type families inside 238 | -- TYPE. 239 | 240 | -- unfortunately ghc is not able to be talked into this, even with type family helpers 241 | type RebindMaybe# :: forall (r :: RuntimeRep). TYPE r -> TYPE ('SumRep '[ 'TupleRep '[], Rep ]) 242 | type family RebindMaybe# where 243 | RebindMaybe# @Rep = Maybe# @Rep 244 | -- no otherwise 245 | 246 | type instance Rebind (Maybe# @Rep) r = RebindMaybe# @r 247 | 248 | instance Functor (Maybe# @Rep) where 249 | type FunctorRep (Maybe# @Rep) = (~) Rep 250 | fmap _ Nothing# = Nothing# 251 | fmap f (Just# a) = Just# (f a) 252 | 253 | instance Show a => Show (Maybe# @Rep a) where 254 | showsPrec _ Nothing# = showString "Nothing#" 255 | showsPrec d (Just# a) = showParen (d >= 11) $ showString "Just# " . showsPrec 11 a 256 | show x = shows x "" 257 | 258 | -- this instance will probably not fire without a lot of help, because that body condition is harsh 259 | -- We split ShowList into a separate class, even if this breaks compat with base because of this 260 | -- instance 261 | instance (ListRep ('SumRep '[ 'TupleRep '[], Rep ]), Show a) => ShowList (Maybe# @Rep a) where 262 | showList = go shows where 263 | go :: forall (a :: TYPE Rep). (Maybe# a -> ShowS) -> List (Maybe# a) -> ShowS 264 | go showx l s = case uncons# l of 265 | Maybe# (# (##) | #) -> "[]" ++ s 266 | Maybe# (# | (# x, xs #) #) -> '[' : showx x (showl xs) 267 | where 268 | showl l' = case uncons# l' of 269 | Maybe# (# (##) | #) -> ']' : s 270 | Maybe# (# | (# y, ys #) #) -> ',' : showx y (showl ys) 271 | 272 | {-# complete Nothing#, Just# :: Maybe# #-} 273 | 274 | instance ShowRep Rep where 275 | showsPrecDef _ x s = show x ++ s 276 | showDef x = shows x "" 277 | 278 | instance ShowListRep Rep where 279 | showListDef = showList__ shows 280 | 281 | showList__ :: forall (a :: TYPE Rep). (a -> ShowS) -> List a -> ShowS 282 | showList__ _ Nil s = "[]" ++ s 283 | showList__ showx (x :# xs) s = '[' : showx x (showl xs) 284 | where 285 | showl Nil = ']' : s 286 | showl (y :# ys) = ',' : showx y (showl ys) 287 | 288 | instance PrintRep Rep where 289 | hPrint h x = IO.hPutStrLn h (show x) 290 | -------------------------------------------------------------------------------- /def/Rep.hsig: -------------------------------------------------------------------------------- 1 | {-# Language KindSignatures #-} 2 | {-# Language StandaloneKindSignatures #-} 3 | signature Rep where 4 | import GHC.Types (RuntimeRep) 5 | 6 | data Rep :: RuntimeRep 7 | -------------------------------------------------------------------------------- /internal/AddrRep.hs: -------------------------------------------------------------------------------- 1 | {-# Language DataKinds #-} 2 | module AddrRep where 3 | import GHC.Types 4 | type Rep = 'AddrRep 5 | -------------------------------------------------------------------------------- /internal/DoubleRep.hs: -------------------------------------------------------------------------------- 1 | {-# Language DataKinds #-} 2 | module DoubleRep where 3 | import GHC.Types 4 | type Rep = 'DoubleRep 5 | -------------------------------------------------------------------------------- /internal/FloatRep.hs: -------------------------------------------------------------------------------- 1 | {-# Language DataKinds #-} 2 | module FloatRep where 3 | import GHC.Types 4 | type Rep = 'FloatRep 5 | -------------------------------------------------------------------------------- /internal/Int16Rep.hs: -------------------------------------------------------------------------------- 1 | {-# Language DataKinds #-} 2 | module Int16Rep where 3 | import GHC.Types 4 | type Rep = 'Int16Rep 5 | -------------------------------------------------------------------------------- /internal/Int32Rep.hs: -------------------------------------------------------------------------------- 1 | {-# Language DataKinds #-} 2 | module Int32Rep where 3 | import GHC.Types 4 | type Rep = 'Int32Rep 5 | -------------------------------------------------------------------------------- /internal/Int64Rep.hs: -------------------------------------------------------------------------------- 1 | {-# Language DataKinds #-} 2 | module Int64Rep where 3 | import GHC.Types 4 | type Rep = 'Int64Rep 5 | -------------------------------------------------------------------------------- /internal/Int8Rep.hs: -------------------------------------------------------------------------------- 1 | {-# Language DataKinds #-} 2 | module Int8Rep where 3 | import GHC.Types 4 | type Rep = 'Int8Rep 5 | -------------------------------------------------------------------------------- /internal/IntRep.hs: -------------------------------------------------------------------------------- 1 | {-# Language DataKinds #-} 2 | module IntRep where 3 | import GHC.Types 4 | type Rep = 'IntRep 5 | -------------------------------------------------------------------------------- /internal/LiftedRep.hs: -------------------------------------------------------------------------------- 1 | {-# Language DataKinds #-} 2 | module LiftedRep where 3 | import GHC.Types 4 | type Rep = 'BoxedRep 'Lifted 5 | -------------------------------------------------------------------------------- /internal/NilReps.hs: -------------------------------------------------------------------------------- 1 | {-# Language DataKinds #-} 2 | {-# Language StandaloneKindSignatures #-} 3 | module NilReps where 4 | import GHC.Types 5 | type Reps :: [RuntimeRep] 6 | type Reps = '[] 7 | -------------------------------------------------------------------------------- /internal/RuntimeRep.hs: -------------------------------------------------------------------------------- 1 | {-# Language TypeFamilies #-} 2 | {-# Language DataKinds #-} 3 | {-# Language KindSignatures #-} 4 | module RuntimeRep where 5 | 6 | type family Extend (r :: RuntimeRep) (t :: RuntimeRep) :: RuntimeRep where 7 | Extend a (TupleRep as) = TupleRep (a ': as) 8 | Extend a (SumRep as) = SumRep (a ': as) 9 | -------------------------------------------------------------------------------- /internal/TupleRep.hs: -------------------------------------------------------------------------------- 1 | {-# Language DataKinds #-} 2 | module TupleRep where 3 | import GHC.Types 4 | type Rep = 'TupleRep '[] 5 | -------------------------------------------------------------------------------- /internal/Unboxed/Internal/Class.hs: -------------------------------------------------------------------------------- 1 | {-# Language ConstrainedClassMethods #-} 2 | {-# Language DataKinds #-} 3 | {-# Language DefaultSignatures #-} 4 | {-# Language FlexibleContexts #-} 5 | {-# Language FlexibleInstances #-} 6 | {-# Language ImportQualifiedPost #-} 7 | {-# Language ConstraintKinds #-} 8 | {-# Language NoImplicitPrelude #-} 9 | {-# Language PolyKinds #-} 10 | {-# Language RankNTypes #-} 11 | {-# Language RebindableSyntax #-} 12 | {-# Language ScopedTypeVariables #-} 13 | {-# Language InstanceSigs #-} 14 | {-# Language StandaloneKindSignatures #-} 15 | {-# Language TypeApplications #-} 16 | {-# Language TypeFamilies #-} 17 | {-# Language TypeOperators #-} 18 | {-# Language UnboxedSums #-} 19 | {-# Language UnboxedTuples #-} 20 | {-# Language UndecidableInstances #-} 21 | {-# Language UndecidableSuperClasses #-} 22 | {-# OPTIONS_HADDOCK not-home #-} 23 | 24 | module Unboxed.Internal.Class 25 | ( Eq(..), EqRep(..) 26 | , Ord(..), OrdRep(..) 27 | , Num(..), NumRep(..) 28 | , Fractional(..), FractionalRep(..) 29 | , Real(..), RealRep(..) 30 | , Enum(..), EnumRep(..) 31 | , Integral(..), IntegralRep(..) 32 | , Floating(..), FloatingRep(..) 33 | , RealFrac(..), RealFracRep(..) 34 | , RealFloat(..), RealFloatRep(..) 35 | , Bounded(..) 36 | -- * Show 37 | , Show(..), ShowList(..), ShowRep(..), ShowListRep(..), shows 38 | -- * Semigroup 39 | , Semigroup(..) 40 | -- * Monoid 41 | , Monoid(..) 42 | -- * Functor 43 | , Functor(..) 44 | -- * polykinded @hPrint@, @print@ 45 | , PrintRep(hPrint), print 46 | ) where 47 | 48 | import Data.Proxy 49 | import Data.Kind (Constraint) 50 | import Data.Ratio (Rational) 51 | import GHC.Integer 52 | import GHC.Prim 53 | import GHC.Types (Type, RuntimeRep(..), LiftedRep) 54 | import Numeric qualified 55 | import Prelude (Ordering(..), Bool(..), Int, ShowS, String, IO) 56 | import Prelude qualified 57 | import Unboxed.Internal.Levitation 58 | import Unboxed.Internal.List 59 | import Unboxed.Internal.Maybe 60 | import Unboxed.Internal.Rebind 61 | import System.IO qualified as IO 62 | 63 | -- * Standard Classes 64 | 65 | -- ** Eq 66 | 67 | 68 | class Eq (a :: TYPE r) where 69 | (==), (/=) :: a -> a -> Bool 70 | 71 | default (==) :: EqRep r => a -> a -> Bool 72 | (==) = eqDef 73 | 74 | default (/=) :: EqRep r => a -> a -> Bool 75 | (/=) = neDef 76 | {-# MINIMAL (/=) | (==) #-} 77 | 78 | infix 4 ==, /= 79 | 80 | instance Prelude.Eq a => Eq (a :: Type) where 81 | (==) = (Prelude.==) 82 | (/=) = (Prelude./=) 83 | 84 | class EqRep (r :: RuntimeRep) where 85 | eqDef, neDef :: forall (a :: TYPE r). Eq a => a -> a -> Bool 86 | 87 | -- ** Ord 88 | 89 | class Eq a => Ord (a :: TYPE r) where 90 | (<), (>), (<=), (>=) :: a -> a -> Bool 91 | compare :: a -> a -> Ordering 92 | max, min :: a -> a -> a 93 | 94 | default (<) :: OrdRep r => a -> a -> Bool 95 | (<) = ltDef 96 | 97 | default (>) :: OrdRep r => a -> a -> Bool 98 | (>) = gtDef 99 | 100 | default (<=) :: OrdRep r => a -> a -> Bool 101 | (<=) = leDef 102 | 103 | default (>=) :: OrdRep r => a -> a -> Bool 104 | (>=) = geDef 105 | 106 | default compare :: OrdRep r => a -> a -> Ordering 107 | compare = compareDef 108 | 109 | default max :: OrdRep r => a -> a -> a 110 | max = maxDef 111 | 112 | default min :: OrdRep r => a -> a -> a 113 | min = minDef 114 | 115 | {-# MINIMAL compare | (<=) #-} 116 | 117 | instance Prelude.Ord a => Ord (a :: Type) where 118 | (<) = (Prelude.<) 119 | (>) = (Prelude.>) 120 | (<=) = (Prelude.<=) 121 | (>=) = (Prelude.>=) 122 | compare = Prelude.compare 123 | min = Prelude.min 124 | max = Prelude.min 125 | 126 | infix 4 <=, >=, <, > 127 | 128 | class OrdRep (r :: RuntimeRep) where 129 | compareDef :: forall (a :: TYPE r). Ord a => a -> a -> Ordering 130 | ltDef, leDef, geDef, gtDef :: forall (a :: TYPE r). Ord a => a -> a -> Bool 131 | maxDef, minDef :: forall (a :: TYPE r). Ord a => a -> a -> a 132 | 133 | -- ** Bounded 134 | 135 | class Bounded (a :: TYPE r) where 136 | minBound, maxBound :: Lev a 137 | 138 | instance Prelude.Bounded a => Bounded (a :: Type) where 139 | minBound = Prelude.minBound 140 | maxBound = Prelude.maxBound 141 | 142 | -- ** Num 143 | 144 | infixl 6 +, - 145 | infixl 7 * 146 | 147 | class Num (a :: TYPE r) where 148 | (+),(-),(*) :: a -> a -> a 149 | negate, abs, signum :: a -> a 150 | fromInteger :: Integer -> a 151 | 152 | default negate :: NumRep r => a -> a 153 | negate = negateDef 154 | 155 | default (-) :: NumRep r => a -> a -> a 156 | (-) = minusDef 157 | {-# MINIMAL (+), (*), abs, signum, fromInteger, (negate | (-)) #-} 158 | 159 | -- compatible with default definitions 160 | instance Prelude.Num a => Num (a :: Type) where 161 | (+) = (Prelude.+) 162 | (-) = (Prelude.-) 163 | (*) = (Prelude.*) 164 | negate = Prelude.negate 165 | abs = Prelude.abs 166 | signum = Prelude.signum 167 | fromInteger = Prelude.fromInteger 168 | 169 | class NumRep (r :: RuntimeRep) where 170 | negateDef :: forall (a :: TYPE r). Num a => a -> a 171 | minusDef :: forall (a :: TYPE r). Num a => a -> a -> a 172 | 173 | -- ** Fractional 174 | 175 | infixl 7 / 176 | 177 | class Num a => Fractional (a :: TYPE r) where 178 | (/) :: a -> a -> a 179 | recip :: a -> a 180 | fromRational :: Rational -> a 181 | 182 | default (/) :: FractionalRep r => a -> a -> a 183 | (/) = fractionalDef 184 | 185 | default recip :: FractionalRep r => a -> a 186 | recip = recipDef 187 | 188 | {-# MINIMAL fromRational, (recip | (/)) #-} 189 | 190 | class FractionalRep (r :: RuntimeRep) where 191 | fractionalDef :: forall (a :: TYPE r). Fractional a => a -> a -> a 192 | recipDef :: forall (a :: TYPE r). Fractional a => a -> a 193 | 194 | instance Prelude.Fractional a => Fractional (a :: Type) where 195 | (/) = (Prelude./) 196 | recip = Prelude.recip 197 | fromRational = Prelude.fromRational 198 | 199 | -- ** Real 200 | 201 | class (Num a, Ord a) => Real (a :: TYPE r) where 202 | toRational :: a -> Rational 203 | 204 | -- bolted on to class to allow both Real and Frac to be polymorphic in rep 205 | realToFrac :: Fractional b => a -> b 206 | default realToFrac :: (RealRep r, Fractional b) => a -> b 207 | realToFrac = realToFracDef 208 | 209 | {-# MINIMAL toRational #-} 210 | 211 | instance Prelude.Real a => Real (a :: Type) where 212 | toRational = Prelude.toRational 213 | realToFrac x = fromRational (toRational x) 214 | 215 | class RealRep (r :: RuntimeRep) where 216 | realToFracDef :: forall (a :: TYPE r) s (b :: TYPE s). (Real a, Fractional b) => a -> b 217 | 218 | -- ** Enum 219 | 220 | class Enum (a :: TYPE r) where 221 | succ :: a -> a 222 | default succ :: EnumRep r => a -> a 223 | succ = succDef 224 | 225 | pred :: a -> a 226 | default pred :: EnumRep r => a -> a 227 | pred = succDef 228 | 229 | toEnum :: Int -> a 230 | 231 | fromEnum :: a -> Int 232 | 233 | {-# MINIMAL toEnum, fromEnum #-} 234 | 235 | {- 236 | enumFrom :: a -> List a 237 | default enumFrom :: EnumRep r => a -> List a 238 | enumFrom = enumFromDef 239 | 240 | enumFromThen :: a -> a -> List a 241 | default enumFromThen :: EnumRep r => a -> a -> List a 242 | enumFromThen = enumFromThenDef 243 | 244 | enumFromTo :: a -> a -> List a 245 | default enumFromTo :: EnumRep r => a -> a -> List a 246 | enumFromTo = enumFromToDef 247 | 248 | enumFromThenTo :: a -> a -> a -> List a 249 | default enumFromThenTo :: EnumRep r => a -> a -> a -> List a 250 | enumFromThenTo = enumFromThenToDef 251 | -} 252 | 253 | class EnumRep (r :: RuntimeRep) where 254 | succDef, predDef :: forall (a :: TYPE r). Enum a => a -> a 255 | {- 256 | enumFromDef :: forall (a :: TYPE r). Enum a => a -> List a 257 | enumFromThenDef, enumFromToDef :: forall (a :: TYPE r). Enum a => a -> a -> List a 258 | enumFromThenToDef :: forall (a :: TYPE r). Enum a => a -> a -> a -> List a 259 | -} 260 | 261 | instance Prelude.Enum a => Enum (a :: Type) where 262 | succ = Prelude.succ 263 | pred = Prelude.pred 264 | toEnum = Prelude.toEnum 265 | fromEnum = Prelude.fromEnum 266 | {- 267 | enumFrom = Prelude.enumFrom 268 | enumFromThen = Prelude.enumFromThen 269 | enumFromTo = Prelude.enumFromTo 270 | enumFromThenTo = Prelude.enumFromThenTo 271 | -} 272 | 273 | -- ** Integral 274 | 275 | class (Real a, Enum a) => Integral (a :: TYPE r) where 276 | quot, rem, div, mod :: a -> a -> a 277 | {-# INLINE quot #-} 278 | {-# INLINE rem #-} 279 | {-# INLINE div #-} 280 | {-# INLINE mod #-} 281 | 282 | quotRem, divMod :: a -> a -> (# a, a #) 283 | toInteger :: a -> Integer 284 | 285 | default quot :: IntegralRep r => a -> a -> a 286 | quot = quotDef 287 | 288 | default rem :: IntegralRep r => a -> a -> a 289 | rem = remDef 290 | 291 | default div :: IntegralRep r => a -> a -> a 292 | div = divDef 293 | 294 | default mod :: IntegralRep r => a -> a -> a 295 | mod = modDef 296 | 297 | default divMod:: IntegralRep r => a -> a -> (# a, a #) 298 | divMod = divModDef 299 | 300 | {-# MINIMAL quotRem, toInteger #-} 301 | 302 | instance Prelude.Integral a => Integral (a :: Type) where 303 | quot = Prelude.quot 304 | rem = Prelude.rem 305 | div = Prelude.div 306 | mod = Prelude.mod 307 | quotRem x y = case Prelude.quotRem x y of 308 | (q,r) -> (# q, r #) 309 | {-# INLINE quotRem #-} 310 | divMod x y = case Prelude.divMod x y of 311 | (d,m) -> (# d, m #) 312 | {-# INLINE divMod #-} 313 | toInteger = Prelude.toInteger 314 | 315 | class IntegralRep (r :: RuntimeRep) where 316 | quotDef, remDef, divDef, modDef :: forall (a :: TYPE r). Integral a => a -> a -> a 317 | divModDef :: forall (a :: TYPE r). Integral a => a -> a -> (# a, a #) 318 | 319 | 320 | class (Real a, Fractional a) => RealFrac (a :: TYPE r) where 321 | -- | As a technical wibble you'll have to convert from the 322 | -- Prelude fractional type yourself, to avoid n^2 work 323 | -- making these instances. 324 | properFraction :: Integral b => a -> (# b, a #) 325 | 326 | truncate, round, ceiling, floor :: Integral b => a -> b 327 | {-# MINIMAL properFraction #-} 328 | 329 | default truncate :: (RealFracRep r, Integral b) => a -> b 330 | truncate = truncateDef 331 | 332 | default round :: (RealFracRep r, Integral b) => a -> b 333 | round = roundDef 334 | 335 | default ceiling :: (RealFracRep r, Integral b) => a -> b 336 | ceiling = ceilingDef 337 | 338 | default floor :: (RealFracRep r, Integral b) => a -> b 339 | floor = floorDef 340 | 341 | instance Prelude.RealFrac a => RealFrac (a :: Type) where 342 | properFraction a = case Prelude.properFraction a of 343 | (b, c) -> (# fromInteger b, c #) 344 | 345 | truncate x = fromInteger (Prelude.truncate x) 346 | round x = fromInteger (Prelude.round x) 347 | ceiling x = fromInteger (Prelude.ceiling x) 348 | floor x = fromInteger (Prelude.floor x) 349 | 350 | 351 | class RealFracRep (r :: RuntimeRep) where 352 | truncateDef, roundDef, ceilingDef, floorDef 353 | :: forall (a :: TYPE r) r' (b :: TYPE r'). (RealFrac a, Integral b) 354 | => a -> b 355 | -------------------------------------------------------------------------------- 356 | -- * Floating 357 | -------------------------------------------------------------------------------- 358 | 359 | class Fractional a => Floating (a :: TYPE r) where 360 | pi :: Lev a 361 | exp, log, sqrt :: a -> a 362 | (**), logBase :: a -> a -> a 363 | sin, cos, tan :: a -> a 364 | asin, acos, atan :: a -> a 365 | sinh, cosh, tanh :: a -> a 366 | asinh, acosh, atanh :: a -> a 367 | log1p :: a -> a 368 | expm1 :: a -> a 369 | log1pexp :: a -> a 370 | log1mexp :: a -> a 371 | 372 | default (**) :: FloatingRep r => a -> a -> a 373 | (**) = powDef 374 | {-# INLINE (**) #-} 375 | 376 | default logBase :: FloatingRep r => a -> a -> a 377 | logBase = logBaseDef 378 | {-# INLINE logBase #-} 379 | 380 | default sqrt :: FloatingRep r => a -> a 381 | sqrt = sqrtDef 382 | {-# INLINE sqrt #-} 383 | 384 | default tan :: FloatingRep r => a -> a 385 | tan = tanDef 386 | {-# INLINE tan #-} 387 | 388 | default tanh :: FloatingRep r => a -> a 389 | tanh = tanhDef 390 | {-# INLINE tanh #-} 391 | 392 | default log1p :: FloatingRep r => a -> a 393 | log1p = log1pDef 394 | {-# INLINE log1p #-} 395 | 396 | default expm1 :: FloatingRep r => a -> a 397 | expm1 = expm1Def 398 | {-# INLINE expm1 #-} 399 | 400 | default log1pexp :: FloatingRep r => a -> a 401 | log1pexp = log1pexpDef 402 | {-# INLINE log1pexp #-} 403 | 404 | default log1mexp :: FloatingRep r => a -> a 405 | log1mexp = log1mexpDef 406 | {-# INLINE log1mexp #-} 407 | 408 | instance Prelude.Floating a => Floating a where 409 | pi = Prelude.pi 410 | exp = Prelude.exp 411 | log = Prelude.log 412 | sqrt = Prelude.sqrt 413 | (**) = (Prelude.**) 414 | logBase = Prelude.logBase 415 | sin = Prelude.sin 416 | cos = Prelude.cos 417 | tan = Prelude.tan 418 | asin = Prelude.asin 419 | acos = Prelude.acos 420 | atan = Prelude.atan 421 | sinh = Prelude.sinh 422 | cosh = Prelude.cosh 423 | tanh = Prelude.tanh 424 | asinh = Prelude.asinh 425 | acosh = Prelude.acosh 426 | atanh = Prelude.atanh 427 | log1p = Numeric.log1p 428 | expm1 = Numeric.expm1 429 | log1pexp = Numeric.log1pexp 430 | log1mexp = Numeric.log1mexp 431 | 432 | class FloatingRep (r :: RuntimeRep) where 433 | powDef, logBaseDef 434 | :: forall (a :: TYPE r). Floating a => a -> a -> a 435 | 436 | sqrtDef, tanDef, tanhDef, log1pDef, expm1Def, log1pexpDef, log1mexpDef 437 | :: forall (a :: TYPE r). Floating a => a -> a 438 | 439 | -------------------------------------------------------------------------------- 440 | -- * RealFloat 441 | -------------------------------------------------------------------------------- 442 | 443 | -- | Efficient, machine-independent access to the components of a 444 | -- floating-point number. 445 | class (RealFrac a, Floating a) => RealFloat (a :: TYPE r) where 446 | floatRadix :: a -> Integer 447 | floatDigits, exponent :: a -> Int 448 | floatRange :: a -> (# Int, Int #) 449 | decodeFloat :: a -> (# Integer, Int #) 450 | encodeFloat :: Integer -> Int -> a 451 | significand :: a -> a 452 | scaleFloat :: Int -> a -> a 453 | isNaN, isInfinite, isDenormalized, isNegativeZero, isIEEE :: a -> Bool 454 | atan2 :: a -> a -> a 455 | 456 | default exponent :: RealFloatRep r => a -> Int 457 | exponent = exponentDef 458 | 459 | default significand :: RealFloatRep r => a -> a 460 | significand = significandDef 461 | 462 | default scaleFloat :: RealFloatRep r => Int -> a -> a 463 | scaleFloat = scaleFloatDef 464 | 465 | default atan2 :: RealFloatRep r => a -> a -> a 466 | atan2 = atan2Def 467 | 468 | {-# MINIMAL 469 | floatRadix, floatDigits, floatRange, decodeFloat, 470 | encodeFloat, isNaN, isInfinite, isDenormalized, 471 | isNegativeZero, isIEEE #-} 472 | 473 | instance Prelude.RealFloat a => RealFloat (a :: Type) where 474 | floatRadix = Prelude.floatRadix 475 | floatDigits = Prelude.floatDigits 476 | exponent = Prelude.exponent 477 | floatRange a = case Prelude.floatRange a of (b, c) -> (# b, c #) 478 | decodeFloat a = case Prelude.decodeFloat a of (m, e) -> (# m, e #) 479 | encodeFloat = Prelude.encodeFloat 480 | significand = Prelude.significand 481 | scaleFloat = Prelude.scaleFloat 482 | isNaN = Prelude.isNaN 483 | isInfinite = Prelude.isInfinite 484 | isDenormalized = Prelude.isDenormalized 485 | isNegativeZero = Prelude.isNegativeZero 486 | isIEEE = Prelude.isIEEE 487 | atan2 = Prelude.atan2 488 | 489 | class RealFloatRep r where 490 | exponentDef :: forall (a :: TYPE r). RealFloat a => a -> Int 491 | significandDef :: forall (a :: TYPE r). RealFloat a => a -> a 492 | scaleFloatDef :: forall (a :: TYPE r). RealFloat a => Int -> a -> a 493 | atan2Def :: forall (a :: TYPE r). RealFloat a => a -> a -> a 494 | 495 | -- ** Semigroup 496 | 497 | class Semigroup (a :: TYPE r) where 498 | (<>) :: a -> a -> a 499 | -- sconcat :: NonEmpty a -> a 500 | -- stimes :: Integral b => b -> a -> a -- probably needs prelude Integral 501 | 502 | instance Prelude.Semigroup a => Semigroup a where 503 | (<>) = (Prelude.<>) 504 | 505 | -- ** Monoid 506 | 507 | type Monoid :: TYPE r -> Constraint 508 | class Semigroup a => Monoid (a :: TYPE r) where 509 | mempty :: Lev a 510 | 511 | instance Prelude.Monoid a => Monoid a where 512 | mempty = Prelude.mempty 513 | 514 | class Show (a :: TYPE r) where 515 | showsPrec :: Int -> a -> ShowS 516 | default showsPrec :: ShowRep r => Int -> a -> ShowS 517 | showsPrec = showsPrecDef 518 | 519 | show :: a -> String 520 | default show :: ShowRep r => a -> String 521 | show = showDef 522 | {-# MINIMAL showsPrec | show #-} 523 | 524 | -- this is split off from Show so we can Show (Maybe# a) 525 | class Show a => ShowList (a :: TYPE r) where 526 | showList :: List a -> ShowS 527 | default showList :: ShowListRep r => List a -> ShowS 528 | showList = showListDef 529 | 530 | instance Prelude.Show a => Show (a :: Type) where 531 | showsPrec = Prelude.showsPrec 532 | show = Prelude.show 533 | 534 | instance Prelude.Show a => ShowList (a :: Type) where 535 | showList = Prelude.showList 536 | 537 | shows :: forall r (a :: TYPE r). Show a => a -> ShowS 538 | shows = showsPrec 0 539 | 540 | class ShowRep (r :: RuntimeRep) where 541 | showsPrecDef :: forall (a :: TYPE r). Show a => Int -> a -> ShowS 542 | showDef :: forall (a :: TYPE r). Show a => a -> String 543 | 544 | class ListRep r => ShowListRep (r :: RuntimeRep) where 545 | showListDef :: forall (a :: TYPE r). ShowList a => List a -> ShowS 546 | 547 | 548 | {- 549 | 550 | infixr 8 ** 551 | infixl 7 /, `quot`, `rem`, `div`, `mod` 552 | 553 | -} 554 | 555 | class TrivialFunctorRep (r :: RuntimeRep) 556 | instance TrivialFunctorRep (r :: RuntimeRep) 557 | 558 | class FunctorRep f r => Functor (f :: TYPE r -> TYPE s) where 559 | type FunctorRep (f :: TYPE r -> TYPE s) :: RuntimeRep -> Constraint 560 | type FunctorRep (f :: TYPE r -> TYPE s) = (~) LiftedRep 561 | fmap :: forall (a :: TYPE r) rb (b :: TYPE rb). FunctorRep f rb => (a -> b) -> f a -> f # b 562 | 563 | {- 564 | fmap' :: forall (a :: TYPE r) rb (b :: TYPE rb). FunctorRep f rb => (Lev a -> b) -> f a -> f # b 565 | (<$) :: forall (a :: TYPE r) rb (b :: TYPE rb). FunctorRep f rb => b -> f a -> f # b 566 | fmapConst' :: forall (a :: TYPE r) rb (b :: TYPE rb). FunctorRep f rb => Lev b -> f a -> f # b 567 | -- rebindFunctor :: Functor f :- Functor (Rebind f r) 568 | 569 | class Functor f => Applicative (f :: TYPE r -> TYPE s) where 570 | pure :: forall (a :: TYPE r). a -> f a 571 | pure' :: forall (a :: TYPE r). Lev a -> f a 572 | 573 | -- liftA2 :: forall (a :: TYPE r) rb (b :: TYPE rb). (FunctorRep f rb, FunctorRep f rc) => (a -> b -> c) -> f a -> f b -> f c 574 | -- liftA2 f ma mb = f <$> ma <*> mb 575 | 576 | (<*>) :: forall (a :: TYPE r) rb (b :: TYPE rb). (FunctorRep f LiftedRep, FunctorRep f rb) => f # (a -> b) -> f a -> f # b 577 | (<*) :: forall (a :: TYPE r) rb (b :: TYPE rb). FunctorRep f b => f a -> f # b -> f a 578 | (*>) :: forall (a :: TYPE r) rb (b :: TYPE rb). FunctorRep f b => f a -> f # b -> f # b 579 | m <* n = (<*>) 580 | 581 | -- rebindApplicative :: Applicative f :- Applicative (Rebind f r) 582 | -} 583 | 584 | 585 | type instance Rebind Proxy r = (Proxy :: TYPE r -> Type) 586 | 587 | instance Functor Proxy where 588 | type FunctorRep Proxy = TrivialFunctorRep 589 | fmap _ _ = Proxy 590 | 591 | instance Functor Prelude.Maybe where 592 | type FunctorRep Prelude.Maybe = MaybeRep 593 | fmap = mapMaybe 594 | 595 | instance (Maybe @r ~ MaybeD, MaybeRep r) => Functor (MaybeD @r) where 596 | type FunctorRep (MaybeD @r) = MaybeRep 597 | fmap = mapMaybe 598 | 599 | -- * Printing 600 | 601 | class PrintRep r where 602 | hPrint :: forall (a :: TYPE r). Show a => IO.Handle -> a -> IO () 603 | 604 | instance PrintRep LiftedRep where 605 | hPrint h x = IO.hPutStrLn h (show x) 606 | 607 | print :: forall r (a :: TYPE r). (PrintRep r, Show a) => a -> IO () 608 | print = hPrint IO.stdout 609 | -------------------------------------------------------------------------------- /internal/Unboxed/Internal/Combinators.hs: -------------------------------------------------------------------------------- 1 | {-# Language DataKinds #-} 2 | {-# Language NoImplicitPrelude #-} 3 | {-# Language PolyKinds #-} 4 | {-# Language TypeFamilies #-} 5 | {-# Language RankNTypes #-} 6 | {-# Language ConstraintKinds #-} 7 | 8 | module Unboxed.Internal.Combinators where 9 | 10 | import GHC.Types (TYPE) 11 | import Unboxed.Internal.Levitation 12 | 13 | -- i don't want to levitate the argument. make a class? 14 | id :: forall r (a :: TYPE r). Lev a -> a 15 | id a = a 16 | {-# INLINE id #-} 17 | 18 | -- i should levitate b, but i shouldn't levitate a. put in same class? 19 | const :: forall r (a :: TYPE r) r' (b :: TYPE r'). Lev a -> Lev b -> a 20 | const a _ = a 21 | {-# INLINE const #-} 22 | -------------------------------------------------------------------------------- /internal/Unboxed/Internal/Levitation.hs: -------------------------------------------------------------------------------- 1 | {-# Language TypeFamilies #-} 2 | {-# Language ConstraintKinds #-} 3 | {-# Language StandaloneKindSignatures #-} 4 | {-# Language RankNTypes #-} 5 | {-# Language PolyKinds #-} 6 | 7 | module Unboxed.Internal.Levitation 8 | ( Lev 9 | ) where 10 | 11 | import GHC.Types (TYPE, Type, Constraint) 12 | 13 | -------------------------------------------------------------------------------- 14 | -- * Levitation by name 15 | -------------------------------------------------------------------------------- 16 | 17 | -- | Consider 18 | -- @ 19 | -- class Bounded a where 20 | -- minBound, maxBound :: a 21 | -- @ 22 | -- 23 | -- If we go to generalize it to allow unlifted runtime representations by saying 24 | -- 25 | -- @ 26 | -- type Bounded :: forall r. TYPE r -> Constraint 27 | -- @ 28 | -- 29 | -- Now @minBound@ and @maxBound@ are top-level terms of type @a@ of an unlifted kind. 30 | -- GHC rightfully rejects this. However, if we use 31 | -- 32 | -- @ 33 | -- type Bounded :: forall r. TYPE r -> Constraint 34 | -- class Bounded a where 35 | -- minBound, maxBound :: (()~()) => a 36 | -- @ 37 | -- 38 | -- Now, in core, Bounded's maxBound takes an argument, which is trivally passed by the compiler 39 | -- and `minBound`, `maxBound` are allowed to be members. It also affects types like `mempty` 40 | -- and `pi` that are otherwise naked members in their respective typeclass. 41 | -- 42 | -- This corresponds to computing any unlifted value in a call-by-name fashion, and passing along 43 | -- any lifted values as they are already lifted. 44 | -- 45 | -- Ideally, this would look like: 46 | -- 47 | -- @ 48 | -- type Lev :: TYPE r -> Type 49 | -- type family Lev a where 50 | -- Lev (a :: Type) = a 51 | -- Lev (a :: TYPE r) = (()~()) => a 52 | -- @ 53 | -- 54 | -- However, GHC doesn't like qualified types as the result of closed type families, so we have 55 | -- to accept the mangling of lifted types as well, and let the compiler optimize away the (()~()) 56 | -- context. 57 | 58 | type Lev :: TYPE r -> Type 59 | type Lev (a :: TYPE r) = (() :: Constraint) => a 60 | 61 | -------------------------------------------------------------------------------- /internal/Unboxed/Internal/Lift.hs: -------------------------------------------------------------------------------- 1 | {-# Language ConstraintKinds #-} 2 | {-# Language DataKinds #-} 3 | {-# Language FlexibleInstances #-} 4 | {-# Language ImportQualifiedPost #-} 5 | {-# Language MagicHash #-} 6 | {-# Language PolyKinds #-} 7 | {-# Language RankNTypes #-} 8 | {-# Language StandaloneKindSignatures #-} 9 | {-# Language TypeFamilies #-} 10 | {-# Language TypeFamilyDependencies #-} 11 | {-# Language UnboxedSums #-} 12 | {-# Language UnboxedTuples #-} 13 | {-# Language UnliftedNewtypes #-} 14 | 15 | module Unboxed.Internal.Lift 16 | ( LiftRep(..) 17 | , pureLift 18 | , mapLift 19 | , apLift 20 | , bindLift 21 | ) where 22 | 23 | import Unboxed.Internal.Levitation 24 | import GHC.Types 25 | import Prelude qualified 26 | 27 | -- explicit Lev 28 | 29 | type LiftRep :: RuntimeRep -> Constraint 30 | class LiftRep r where 31 | data Lift :: TYPE r -> Type 32 | -- Lifted @Maybe@ with a (possibly) unlifted argument 33 | lift :: forall (a :: TYPE r). a -> Lift a 34 | lift' :: forall (a :: TYPE r). Lev a -> Lift a 35 | unlift :: forall (a :: TYPE r). Lift a -> a 36 | applyLift :: forall (a :: TYPE r) rb (b :: TYPE rb). 37 | (a -> b) -> Lift a -> b 38 | 39 | pureLift :: forall (a :: TYPE r). a -> Lift a 40 | pureLift = lift 41 | 42 | mapLift 43 | :: forall ra (a :: TYPE r) rb (b :: TYPE r). 44 | (LiftRep ra, LiftRep rb) 45 | => (a -> b) -> Lift a -> Lift b 46 | mapLift f l = lift' (applyLift f l) 47 | 48 | apLift :: Lift (a -> b) -> Lift a -> Lift b 49 | apLift (Lift f) = mapLift f 50 | 51 | bindLift 52 | :: forall ra (a :: TYPE r) rb (b :: TYPE r). 53 | LiftRep ra 54 | => (a -> Lift b) -> Lift a -> Lift b 55 | bindLift = applyLift 56 | 57 | instance LiftRep 'LiftedRep where 58 | newtype Lift a = Lift a 59 | lift = Lift 60 | lift' a = Lift a 61 | unlift (Lift a) = a 62 | applyLift (Lift a) f = f a 63 | 64 | {- 65 | class Liftable (a :: TYPE r) where 66 | type Lifted a :: Type 67 | lifted :: a -> Lifted a 68 | lifted' :: Lev a -> Lifted a 69 | unlifted :: Lifted a -> a 70 | applyLifted :: (a -> b) -> Lifted a -> b 71 | 72 | instance Liftable Int# where 73 | type Lifted Int# = Int 74 | lifted = I# 75 | lifted' x = I# x 76 | unlifted (I# x) = x 77 | applyLifted f (I# x) = f x 78 | 79 | newtype Lowered (a :: TYPE r) = Lowered a 80 | -- 81 | instance Eq (Lifted a) => Eq (Lowered (a :: TYPE 'IntRep)) where 82 | x == y = lifted x == lifted y 83 | x /= y = lifted x /= lifted y 84 | 85 | instance Num (Lifted a) => Num (Lowered (a :: TYPE 'IntRep)) where 86 | x + y = unlifted (lifted x + lifted y) 87 | 88 | deriving via Lowered Int# instance Num Int# 89 | 90 | newtype Foo# = Foo# Int# 91 | deriving (Num, Eq, Ord) via Lowered Int# 92 | -} 93 | -------------------------------------------------------------------------------- /internal/Unboxed/Internal/Linear.hs: -------------------------------------------------------------------------------- 1 | {-# Language LinearTypes #-} 2 | {-# Language StandaloneKindSignatures #-} 3 | {-# Language RoleAnnotations #-} 4 | {-# Language MagicHash #-} 5 | {-# Language TypeFamilies #-} 6 | {-# Language UnboxedTuples #-} 7 | {-# Language ConstraintKinds #-} 8 | {-# Language PolyKinds #-} 9 | {-# Language DataKinds #-} 10 | {-# Language GADTs #-} 11 | {-# Language UnliftedNewtypes #-} 12 | {-# Language MultiParamTypeClasses #-} 13 | {-# Language BlockArguments #-} 14 | {-# Language FlexibleInstances #-} 15 | {-# Language ScopedTypeVariables #-} 16 | {-# Language PatternSynonyms #-} 17 | {-# Language RankNTypes #-} 18 | {-# Language TypeApplications #-} 19 | {-# Language InstanceSigs #-} 20 | {-# Language ImportQualifiedPost #-} 21 | {-# Language FunctionalDependencies #-} 22 | 23 | module Unboxed.Internal.Linear 24 | ( Consumable(..) 25 | , Ur(..) 26 | , UrRep(..) 27 | , urapp 28 | , toLinear, toLinear2, toLinear3 29 | , ST(..) 30 | , STRep(..) 31 | ) where 32 | 33 | import Data.Unrestricted.Linear qualified as Linear (Consumable(..)) 34 | import GHC.Exts 35 | -- import GHC.Prim 36 | import GHC.Types 37 | import Unsafe.Coerce 38 | import Unboxed.Internal.Levitation 39 | import Unboxed.Internal.Linear.Ur 40 | -- import Unboxed.Internal.Maybe as Maybe 41 | -- import Prelude qualified 42 | 43 | type Consumable :: TYPE r -> Constraint 44 | class Consumable (a :: TYPE r) where 45 | consume :: a %1 -> () 46 | instance Linear.Consumable a => Consumable (a :: Type) where 47 | consume = Linear.consume 48 | 49 | type UrRep :: RuntimeRep -> Constraint 50 | class UrRep r where 51 | pureUr :: forall (a :: TYPE r). a -> Ur a 52 | extractUr :: forall (a :: TYPE r). Ur a -> a 53 | bindUr :: forall (a :: TYPE r) rb (b :: TYPE rb). Ur a %1 -> (a %1 -> Ur b) %1 -> Ur b 54 | mapUr :: forall (a :: TYPE r) rb (b :: TYPE rb). (a -> b) %1 -> Ur a %1 -> Ur b 55 | 56 | instance UrRep ('BoxedRep 'Lifted) where 57 | pureUr = Ur 58 | extractUr (Ur a) = a 59 | bindUr (Ur a) f = f a 60 | mapUr = toLinear2 coerce 61 | 62 | {- 63 | instance UrRep 'UnboxedRep where 64 | pureUr = Ur 65 | unUr (Ur a) = a 66 | bindUr (Ur a) f = f a 67 | mapUr = coerce 68 | 69 | instance UrRep 'IntRep where 70 | pureUr = Ur 71 | unUr (Ur a) = a 72 | bindUr (Ur a) f = f a 73 | mapUr = coerce 74 | -} 75 | 76 | urapp :: forall r (a :: TYPE r) s (b :: TYPE s). (a -> b) %1 -> Ur a %1 -> b 77 | urapp = unsafeCoerce unsafeCoerce 78 | 79 | toLinear :: forall ra (a :: TYPE ra) rb (b :: TYPE rb). (a -> b) %1 -> a %1 -> b 80 | toLinear = unsafeCoerce unsafeCoerce 81 | 82 | toLinear2 :: forall ra (a :: TYPE ra) rb (b :: TYPE rb) rc (c :: TYPE rc). 83 | (a -> b -> c) %1 -> a %1 -> b %1 -> c 84 | toLinear2 = unsafeCoerce unsafeCoerce 85 | 86 | toLinear3 :: forall ra (a :: TYPE ra) rb (b :: TYPE rb) rc (c :: TYPE rc) rd (d :: TYPE rd). 87 | (a -> b -> c -> d) %1 -> a %1 -> b %1 -> c %1 -> d 88 | toLinear3 = unsafeCoerce unsafeCoerce 89 | 90 | type ST :: Type -> forall r. TYPE r -> Type 91 | type role ST nominal representational 92 | newtype ST s a where 93 | ST :: forall r s (a :: TYPE r). { unST :: State# s %1 -> (# State# s, a #) } %1 -> ST s a 94 | 95 | type P :: forall r. TYPE r -> Type 96 | newtype P a = P (forall s. ST s a) 97 | 98 | class STRep r where 99 | runST :: forall (a :: TYPE r). (forall s. ST s a) %1 -> a 100 | bindST :: forall (a :: TYPE r) rb (b :: TYPE rb) s. ST s a %1 -> (a %1 -> ST s b) %1 -> ST s b 101 | pureST :: forall (a :: TYPE r) s. a %1 -> ST s a 102 | -- dataFmapST :: forall (a :: TYPE r) rb (b :: TYPE rb). STRep rb => (a %1 -> b) -> ST s a %1 -> ST s b 103 | fmapST :: forall (a :: TYPE r) rb (b :: TYPE rb) s. STRep rb => (a %1 -> b) %1 -> ST s a %1 -> ST s b 104 | mkSTRes :: forall (b :: TYPE r) s. State# s -> Lev b -> (# State# s, b #) 105 | -- app :: forall (a :: TYPE r) rb (b :: TYPE rb). (a -> b) -> a -> b 106 | 107 | {- 108 | class FunRep r where 109 | (.) :: forall (a :: TYPE r) rb (b :: TYPE rb) rc (c :: TYPE rc). (Lev b -> c) -> (a -> b) -> a -> c 110 | 111 | instance FunRep ('BoxedRep 'Lifted) where 112 | (.) f g a = f (g a) 113 | -} 114 | 115 | instance STRep ('BoxedRep 'Lifted) where 116 | runST :: forall (a :: Type). (forall s. ST s a) %1 -> a 117 | runST m = toLinear go (P m) where 118 | go :: P a -> a 119 | go (P (ST f)) = runRW# \s -> case f s of 120 | (# _, a #) -> a 121 | 122 | pureST a = ST \s -> (# s, a #) 123 | 124 | bindST :: forall (a :: Type) rb (b :: TYPE rb) s. ST s a %1 -> (a %1 -> ST s b) %1 -> ST s b 125 | bindST f0 k0 = ST (\s -> toLinear3 go f0 k0 s) where 126 | go :: ST s a -> (a %1 -> ST s b) -> State# s -> (# State# s, b #) 127 | go f k s = case unST f s of 128 | (# s', a #) -> unST (k a) s' 129 | 130 | fmapST :: forall (a :: Type) rb (b :: TYPE rb) s. STRep rb => (a %1 -> b) %1 -> ST s a %1 -> ST s b 131 | fmapST f0 m0 = ST (\s -> toLinear3 go f0 m0 s) where 132 | go :: (a %1 -> b) -> ST s a -> State# s -> (# State# s, b #) 133 | go f m s = case unST m s of 134 | (# s', a #) -> mkSTRes s' (f a) 135 | 136 | mkSTRes :: forall (b :: Type) s. State# s -> Lev b -> (# State# s, b #) 137 | mkSTRes s a = (# s , a #) 138 | 139 | -- class Functor (f :: TYPE r -> TYPE s) where 140 | 141 | {- 142 | type family JankyFunctorHelper (f :: TYPE r -> TYPE s) (r' :: RuntimeRep) (s' :: RuntimeRep) :: TYPE r' -> TYPE s' 143 | 144 | class 145 | JankyFunctorHelper f r' s' ~ g, 146 | 147 | 148 | JankyFunctor (f :: TYPE r -> TYPE s) (g :: TYPE r' -> TYPE s) 149 | 150 | class JankyFunctor (f :: TYPE r -> TYPE s) (g :: TYPE r' -> TYPE s') | f r -> s, g r' -> s', f r' -> g, g r -> f where 151 | jmap :: forall (a :: TYPE r) (b :: TYPE r'). (a -> b) -> f a -> g b 152 | 153 | instance Prelude.Functor f => JankyFunctor (f :: Type -> Type) (f :: Type -> Type) where 154 | jmap = Prelude.fmap 155 | 156 | instance (MaybeRep# r, MaybeRep# r') => JankyFunctor (Maybe# @r) (Maybe# @r') where 157 | jmap = Maybe.fmap# 158 | 159 | instance (MaybeRep r, MaybeRep r') => JankyFunctor (Maybe @r) (Maybe @r') where 160 | jmap = Maybe.fmap 161 | 162 | class JankyControlFunctor (f :: TYPE r -> TYPE s) (g :: TYPE r' -> TYPE s') | f r -> s, g r' -> s', f r' -> g, g r -> f where 163 | jcmap :: forall (a :: TYPE r) (b :: TYPE r'). (a %1 -> b) %1 -> f a %1 -> g b 164 | 165 | instance (STRep r, STRep r') => JankyControlFunctor (ST s @r) (ST s @r') where 166 | jcmap = fmapST 167 | 168 | 169 | 170 | 171 | class Functor (f :: forall (r :: RuntimeRep). TYPE r -> TYPE s) where 172 | type FunctorRep f :: RuntimeRep -> Constraint 173 | fmap :: forall r (a :: TYPE r) rb (b :: TYPE rb). (FunctorRep f r, FunctorRep f rb) => (a -> b) -> f a -> f b 174 | 175 | class DataFunctor (f :: forall (r :: RuntimeRep). TYPE r -> TYPE s) where 176 | type DataFunctorRep f :: RuntimeRep -> Constraint 177 | dfmap :: forall r (a :: TYPE r) rb (b :: TYPE rb). (DataFunctorRep f r, DataFunctorRep f rb) => (a %1 -> b) -> f a %1 -> f b 178 | 179 | class ControlFunctor (f :: forall (r :: RuntimeRep). TYPE r -> TYPE s) where 180 | type ControlFunctorRep f :: RuntimeRep -> Constraint 181 | cfmap :: forall r (a :: TYPE r) rb (b :: TYPE rb). (ControlFunctorRep f r, ControlFunctorRep f rb) => (a %1 -> b) %1 -> f a %1 -> f b 182 | 183 | class Applicative (m :: forall (r :: RuntimeRep). TYPE r -> TYPE s) where 184 | 185 | class Monad (m :: forall (r :: RuntimeRep). TYPE r -> TYPE s) where 186 | type MonadRep m :: RuntimeRep -> Constraint 187 | (>>=) :: forall r (a :: TYPE r) rb (b :: TYPE rb). (MonadRep m r, MonadRep m rb) => m a %1 -> (a %1 -> m b) %1 -> m b 188 | 189 | instance Monad (ST s) where 190 | type MonadRep (ST s) = STRep 191 | (>>=) = bindST 192 | -} 193 | -------------------------------------------------------------------------------- /internal/Unboxed/Internal/Linear/Ur.hs: -------------------------------------------------------------------------------- 1 | {-# Language StandaloneKindSignatures #-} 2 | {-# Language RoleAnnotations #-} 3 | {-# Language MagicHash #-} 4 | {-# Language UnboxedTuples #-} 5 | {-# Language PolyKinds #-} 6 | {-# Language DataKinds #-} 7 | {-# Language GADTs #-} 8 | {-# Language UnliftedNewtypes #-} 9 | {-# Language MultiParamTypeClasses #-} 10 | {-# Language BlockArguments #-} 11 | {-# Language ImportQualifiedPost #-} 12 | {-# Language FlexibleInstances #-} 13 | {-# Language ScopedTypeVariables #-} 14 | {-# Language PatternSynonyms #-} 15 | {-# Language RankNTypes #-} 16 | {-# Language TypeApplications #-} 17 | {-# Language InstanceSigs #-} 18 | {-# Language NoLinearTypes #-} 19 | {-# Language NoImplicitPrelude #-} 20 | 21 | module Unboxed.Internal.Linear.Ur where 22 | 23 | import GHC.Exts 24 | import Prelude qualified 25 | import Prelude (showParen, showString, showsPrec, ($), (.), (<$>), (>=)) 26 | 27 | -- an unlifted 'unrestricted' type, implemented as a newtype to avoid a box 28 | -- but generated with a basic arrow rather than a linear arrow using NoLinearTypes 29 | type Ur :: forall (r :: RuntimeRep). TYPE r -> TYPE r 30 | type role Ur representational 31 | newtype Ur a where 32 | Ur :: forall r (a :: TYPE r). a -> Ur a 33 | 34 | {- 35 | instance Show a => Show (Ur (a :: TYPE 'IntRep)) where 36 | showsPrec d (Ur a) = showParen (d >= 11) $ showString "Ur " . showsPrec 11 a 37 | 38 | instance Show a => Show (Ur (a :: TYPE 'UnliftedRep)) where 39 | showsPrec d (Ur a) = showParen (d >= 11) $ showString "Ur " . showsPrec 11 a 40 | -} 41 | 42 | -- this is annoying, because it collides with the kind polymorphic version above 43 | instance Prelude.Show a => Prelude.Show (Ur a) where 44 | showsPrec d (Ur a) = showParen (d >= 11) $ showString "Ur " . showsPrec 11 a 45 | 46 | instance Prelude.Functor Ur where 47 | fmap f (Ur a) = Ur (f a) 48 | a <$ _ = Ur a 49 | 50 | instance Prelude.Foldable Ur where 51 | foldMap f (Ur a) = f a 52 | 53 | instance Prelude.Traversable Ur where 54 | traverse f (Ur a) = Ur <$> f a 55 | 56 | instance Prelude.Applicative Ur where 57 | pure = Ur 58 | Ur f <*> Ur a = Ur (f a) 59 | _ *> n = n 60 | m <* _ = m 61 | 62 | instance Prelude.Monad Ur where 63 | Ur a >>= f = f a 64 | (>>) = (Prelude.*>) 65 | -------------------------------------------------------------------------------- /internal/Unboxed/Internal/List.hs: -------------------------------------------------------------------------------- 1 | {-# Language DataKinds #-} 2 | {-# Language FlexibleInstances #-} 3 | {-# Language MagicHash #-} 4 | {-# Language MultiParamTypeClasses #-} 5 | {-# Language NoImplicitPrelude #-} 6 | {-# Language ConstraintKinds #-} 7 | {-# Language PolyKinds #-} 8 | {-# Language RankNTypes #-} 9 | {-# Language StandaloneKindSignatures #-} 10 | {-# Language TypeApplications #-} 11 | {-# Language TypeFamilies #-} 12 | {-# Language TypeFamilyDependencies #-} 13 | {-# Language UnboxedTuples #-} 14 | {-# Language UndecidableInstances #-} 15 | {-# OPTIONS_HADDOCK not-home #-} 16 | 17 | -- | Other 'ListRep' instances are defined via backpack 18 | module Unboxed.Internal.List 19 | ( List 20 | , ListD 21 | , ListRep(..) 22 | ) where 23 | 24 | import GHC.Types (Type, TYPE, RuntimeRep(..), Levity(..)) 25 | import Unboxed.Internal.Levitation 26 | import Unboxed.Internal.Maybe 27 | import Unboxed.Internal.Rebind 28 | 29 | type ListD :: forall r. TYPE r -> Type 30 | data family ListD :: TYPE r -> Type 31 | 32 | type List :: forall r. TYPE r -> Type 33 | type family List = (c :: TYPE r -> Type) | c -> r where 34 | List @('BoxedRep 'Lifted) = [] 35 | List @r = ListD @r 36 | 37 | type instance Rebind [] r = List @r 38 | type instance Rebind ListD r = List @r 39 | 40 | class ListRep r where 41 | cons :: forall (a :: TYPE r). a -> List a -> List a 42 | cons' :: forall (a :: TYPE r). Lev a -> List a -> List a 43 | nil :: forall (a :: TYPE r). List a 44 | uncons# :: forall (a :: TYPE r). List a -> Maybe# (# a, List a #) 45 | -- foldr :: forall (a :: TYPE r) rb (b :: TYPE rb). (a -> Lev b -> b) -> Lev b -> List a -> b 46 | -- mapList :: forall (a :: TYPE r) rb (b :: TYPE rb). ListRep rb => (a -> b) -> List a -> List b 47 | 48 | instance ListRep ('BoxedRep 'Lifted) where 49 | cons = (:) 50 | cons' x xs = x : xs 51 | nil = [] 52 | uncons# [] = Maybe# (# (##) | #) 53 | uncons# (x:xs) = Maybe# (# | (# x, xs #) #) 54 | -- foldr f z (x:xs) = f x (foldr f z xs) 55 | -- foldr _ z [] = z 56 | -------------------------------------------------------------------------------- /internal/Unboxed/Internal/Maybe.hs: -------------------------------------------------------------------------------- 1 | {-# Language ConstraintKinds #-} 2 | {-# Language DataKinds #-} 3 | {-# Language FlexibleInstances #-} 4 | {-# Language ImportQualifiedPost #-} 5 | {-# Language MagicHash #-} 6 | {-# Language ConstraintKinds #-} 7 | {-# Language MultiParamTypeClasses #-} 8 | {-# Language PolyKinds #-} 9 | {-# Language RankNTypes #-} 10 | {-# Language StandaloneKindSignatures #-} 11 | {-# Language TypeApplications #-} 12 | {-# Language TypeFamilies #-} 13 | {-# Language TypeFamilyDependencies #-} 14 | {-# Language UnboxedSums #-} 15 | {-# Language UnboxedTuples #-} 16 | {-# Language UndecidableInstances #-} 17 | {-# Language UnliftedNewtypes #-} 18 | 19 | module Unboxed.Internal.Maybe 20 | ( -- MaybeFam 21 | Maybe 22 | , MaybeD 23 | , MaybeRep(..) 24 | -- * Unboxed Maybe 25 | , Maybe#(..) 26 | , MaybeRep#(..) 27 | ) where 28 | 29 | import Unboxed.Internal.Levitation 30 | import Unboxed.Internal.Rebind 31 | 32 | import GHC.Types 33 | import Prelude qualified 34 | 35 | -- type instance RebindRep Prelude.Maybe r = 'BoxedRep 'Lifted 36 | type instance Rebind Prelude.Maybe r' = Maybe @r' 37 | type instance Rebind (MaybeD @r) r' = Maybe @r' 38 | 39 | type Maybe :: forall r. TYPE r -> Type 40 | type family Maybe = (c :: TYPE r -> Type) | c -> r where 41 | Maybe @('BoxedRep 'Lifted) = Prelude.Maybe 42 | Maybe @r = MaybeD @r 43 | 44 | type MaybeD :: forall r. TYPE r -> Type 45 | data family MaybeD :: TYPE r -> Type 46 | 47 | type MaybeRep :: RuntimeRep -> Constraint 48 | class MaybeRep r where 49 | nothing :: forall (a :: TYPE r). Maybe a 50 | just :: forall (a :: TYPE r). a -> Maybe a 51 | just' :: forall (a :: TYPE r). Lev a -> Maybe a 52 | maybe :: forall (a :: TYPE r) r' (b :: TYPE r'). Lev b -> (a -> b) -> Maybe a -> b 53 | mapMaybe :: forall (a :: TYPE r) r' (b :: TYPE r'). MaybeRep r' => (a -> b) -> Maybe @r a -> Maybe @r' b 54 | 55 | instance MaybeRep ('BoxedRep 'Lifted) where 56 | nothing = Prelude.Nothing 57 | just = Prelude.Just 58 | just' a = Prelude.Just a 59 | maybe _ j (Prelude.Just a) = j a 60 | maybe n _ Prelude.Nothing = n 61 | mapMaybe f (Prelude.Just a) = just' (f a) 62 | mapMaybe _ Prelude.Nothing = nothing 63 | 64 | -- | Unboxed @Maybe@ with a (possibly) unlifted argument 65 | 66 | type Maybe# :: TYPE r -> TYPE ('SumRep '[ 'TupleRep '[],r]) 67 | newtype Maybe# (a :: TYPE r) = Maybe# (# (##) | a #) 68 | 69 | type MaybeRep# :: RuntimeRep -> Constraint 70 | class MaybeRep# r where 71 | nothing# :: forall (a :: TYPE r). Lev (Maybe# a) 72 | just# :: forall (a :: TYPE r). a -> Maybe# a 73 | just'# :: forall (a :: TYPE r). Lev a -> Maybe# a 74 | maybe# :: forall (a :: TYPE r) r' (b :: TYPE r'). Lev b -> (a -> b) -> Maybe# a -> b 75 | mapMaybe# :: forall (a :: TYPE r) r' (b :: TYPE r'). MaybeRep# r' => (a -> b) -> Maybe# a -> Maybe# b 76 | 77 | instance MaybeRep# ('BoxedRep 'Lifted) where 78 | nothing# = Maybe# (# (##) | #) 79 | just# a = Maybe# (# | a #) 80 | just'# a = Maybe# (# | a #) 81 | maybe# _ j (Maybe# (# | a #)) = j a 82 | maybe# n _ (Maybe# (# (##) | #)) = n 83 | mapMaybe# _ (Maybe# (# (##) | #)) = nothing# 84 | mapMaybe# f (Maybe# (# | a #)) = just'# (f a) 85 | -------------------------------------------------------------------------------- /internal/Unboxed/Internal/Rebind.hs: -------------------------------------------------------------------------------- 1 | {-# Language DataKinds #-} 2 | {-# Language ExplicitNamespaces #-} 3 | {-# Language FlexibleInstances #-} 4 | {-# Language FunctionalDependencies #-} 5 | {-# Language UndecidableInstances #-} 6 | {-# Language MultiParamTypeClasses #-} 7 | {-# Language PolyKinds #-} 8 | {-# Language RankNTypes #-} 9 | {-# Language StandaloneKindSignatures #-} 10 | {-# Language TypeApplications #-} 11 | {-# Language TypeFamilies #-} 12 | {-# Language TypeOperators #-} 13 | module Unboxed.Internal.Rebind 14 | ( Rebind 15 | , type (#) 16 | ) where 17 | 18 | import GHC.Types 19 | 20 | type family Rebind (f :: TYPE r -> k) (r' :: RuntimeRep) :: TYPE r' -> k 21 | 22 | type (f :: TYPE r -> k) # (a :: TYPE r') = Rebind f r' a 23 | infix 9 # 24 | -------------------------------------------------------------------------------- /internal/Unboxed/Internal/Syntax.hs: -------------------------------------------------------------------------------- 1 | {-# Language DataKinds #-} 2 | {-# Language NoImplicitPrelude #-} 3 | {-# Language PolyKinds #-} 4 | {-# Language TypeFamilies #-} 5 | {-# Language ConstraintKinds #-} 6 | {-# Language RankNTypes #-} 7 | {-# OPTIONS_HADDOCK not-home #-} 8 | 9 | module Unboxed.Internal.Syntax where 10 | 11 | import GHC.Types (TYPE, Bool(..)) 12 | import Unboxed.Internal.Levitation 13 | 14 | -- | Unfortunately there is no way to turn on just the numeric part of RebindableSyntax. 15 | -- 16 | -- This kind polymorphic @if then else@ for overloaded Syntax is invisibly lazy in its arguments 17 | -- 18 | -- >>> :m + GHC.Int 19 | -- >>> I# (ifThenElse False undefined 1#) 20 | -- 1 21 | ifThenElse :: forall r (a :: TYPE r). Bool -> Lev a -> Lev a -> a 22 | ifThenElse True a _ = a 23 | ifThenElse False _ b = b 24 | {-# INLINE ifThenElse #-} 25 | -------------------------------------------------------------------------------- /internal/UnliftedRep.hs: -------------------------------------------------------------------------------- 1 | {-# Language DataKinds #-} 2 | module UnliftedRep where 3 | import GHC.Types 4 | type Rep = 'BoxedRep 'Unlifted 5 | -------------------------------------------------------------------------------- /internal/Word16Rep.hs: -------------------------------------------------------------------------------- 1 | {-# Language DataKinds #-} 2 | module Word16Rep where 3 | import GHC.Types 4 | type Rep = 'Word16Rep 5 | -------------------------------------------------------------------------------- /internal/Word32Rep.hs: -------------------------------------------------------------------------------- 1 | {-# Language DataKinds #-} 2 | module Word32Rep where 3 | import GHC.Types 4 | type Rep = 'Word32Rep 5 | -------------------------------------------------------------------------------- /internal/Word64Rep.hs: -------------------------------------------------------------------------------- 1 | {-# Language DataKinds #-} 2 | module Word64Rep where 3 | import GHC.Types 4 | type Rep = 'Word64Rep 5 | -------------------------------------------------------------------------------- /internal/Word8Rep.hs: -------------------------------------------------------------------------------- 1 | {-# Language DataKinds #-} 2 | module Word8Rep where 3 | import GHC.Types 4 | type Rep = 'Word8Rep 5 | -------------------------------------------------------------------------------- /internal/WordRep.hs: -------------------------------------------------------------------------------- 1 | {-# Language DataKinds #-} 2 | module WordRep where 3 | import GHC.Types 4 | type Rep = 'WordRep 5 | -------------------------------------------------------------------------------- /measurement/Internal.hs: -------------------------------------------------------------------------------- 1 | {-# Language MagicHash #-} 2 | {-# Language RankNTypes #-} 3 | {-# Language DataKinds #-} 4 | {-# Language PolyKinds #-} 5 | {-# OPTIONS_GHC -O2 -fno-prof-auto #-} 6 | -- Make the function applications in nf' and whnf' strict (avoiding allocation) 7 | -- and avoid floating out the computations. 8 | {-# OPTIONS_GHC -fno-full-laziness #-} 9 | module Internal where 10 | 11 | import GHC.Types 12 | import Data.Int 13 | 14 | whnf'N# 15 | :: forall (a :: TYPE ('TupleRep '[ 'WordRep, UnliftedRep ])) b. 16 | (a -> b) -> a -> (Int64 -> IO ()) 17 | whnf'N# f x = go where 18 | go n 19 | | n <= 0 = pure () 20 | | otherwise = f x `seq` go (n-1) 21 | {-# NOINLINE whnf'N# #-} 22 | 23 | whnf'B# :: forall (a :: TYPE ('SumRep '[ 'IntRep, LiftedRep ])) b. 24 | (a -> b) -> a -> (Int64 -> IO ()) 25 | whnf'B# f x = go where 26 | go n 27 | | n <= 0 = pure () 28 | | otherwise = f x `seq` go (n-1) 29 | {-# NOINLINE whnf'B# #-} 30 | 31 | whnf'L :: forall a b. 32 | (a -> b) -> a -> (Int64 -> IO ()) 33 | whnf'L f x = go where 34 | go n 35 | | n <= 0 = pure () 36 | | otherwise = f x `seq` go (n-1) 37 | {-# NOINLINE whnf'L #-} 38 | -------------------------------------------------------------------------------- /measurement/Whnf.hs: -------------------------------------------------------------------------------- 1 | {-# Language MagicHash #-} 2 | {-# Language RankNTypes #-} 3 | {-# Language DataKinds #-} 4 | {-# Language PolyKinds #-} 5 | module Whnf where 6 | 7 | import Criterion.Measurement.Types 8 | import GHC.Types 9 | import Internal 10 | 11 | whnfN# 12 | :: forall (a :: TYPE ('TupleRep '[ 'WordRep, UnliftedRep ])) b. 13 | (a -> b) -> a -> Benchmarkable 14 | whnfN# f x = toBenchmarkable (whnf'N# f x) 15 | 16 | whnfB# 17 | :: forall (a :: TYPE ('SumRep '[ 'IntRep, LiftedRep ])) b. 18 | (a -> b) -> a -> Benchmarkable 19 | whnfB# f x = toBenchmarkable (whnf'B# f x) 20 | 21 | whnfL 22 | :: forall a b. 23 | (a -> b) -> a -> Benchmarkable 24 | whnfL f x = toBenchmarkable (whnf'L f x) 25 | -------------------------------------------------------------------------------- /src/Unboxed/Class.hs: -------------------------------------------------------------------------------- 1 | {-# Language CPP #-} 2 | {-# Language NoImplicitPrelude #-} 3 | module Unboxed.Class 4 | -- TODO: export everything individually 5 | ( Eq(..), EqRep 6 | , Ord(..), OrdRep 7 | , Bounded(..) 8 | , Num(..), NumRep 9 | , Fractional(..), FractionalRep 10 | , Real(..), RealRep 11 | , Enum(..), EnumRep 12 | , Integral(..), IntegralRep 13 | , RealFrac(..), RealFracRep 14 | , Floating(..), FloatingRep 15 | , RealFloat(..), RealFloatRep 16 | , Show(..), ShowRep 17 | , ShowList(..), ShowListRep 18 | , shows 19 | , Semigroup(..) 20 | , Monoid(..) 21 | , Functor(..) 22 | , PrintRep 23 | , print, hPrint 24 | ) where 25 | 26 | import Unboxed.Internal.Class 27 | 28 | import Unboxed.Rep.Addr () 29 | import Unboxed.Rep.Double () 30 | import Unboxed.Rep.Float () 31 | import Unboxed.Rep.Int () 32 | import Unboxed.Rep.Int8 () 33 | import Unboxed.Rep.Int16 () 34 | import Unboxed.Rep.Int32 () 35 | import Unboxed.Rep.Int64 () 36 | import Unboxed.Rep.Lifted () 37 | import Unboxed.Rep.Sum2.Word.Unlifted () 38 | import Unboxed.Rep.Tuple () 39 | import Unboxed.Rep.Tuple1.Addr () 40 | import Unboxed.Rep.Tuple1.Double () 41 | import Unboxed.Rep.Tuple1.Float () 42 | import Unboxed.Rep.Tuple1.Int () 43 | import Unboxed.Rep.Tuple1.Int8 () 44 | import Unboxed.Rep.Tuple1.Int16 () 45 | import Unboxed.Rep.Tuple1.Int32 () 46 | import Unboxed.Rep.Tuple1.Int64 () 47 | import Unboxed.Rep.Tuple1.Lifted () 48 | import Unboxed.Rep.Tuple1.Tuple0 () 49 | import Unboxed.Rep.Tuple1.Unlifted () 50 | import Unboxed.Rep.Tuple1.Word () 51 | import Unboxed.Rep.Tuple1.Word8 () 52 | import Unboxed.Rep.Tuple1.Word16 () 53 | import Unboxed.Rep.Tuple1.Word32 () 54 | import Unboxed.Rep.Tuple1.Word64 () 55 | import Unboxed.Rep.Tuple2.Word.Unlifted () 56 | import Unboxed.Rep.Unlifted () 57 | import Unboxed.Rep.Word () 58 | import Unboxed.Rep.Word8 () 59 | import Unboxed.Rep.Word16 () 60 | import Unboxed.Rep.Word32 () 61 | import Unboxed.Rep.Word64 () 62 | 63 | #ifdef UNBOXED_LEVEL2 64 | import Unboxed.Rep.Sum2.Addr.Addr () 65 | import Unboxed.Rep.Sum2.Double.Addr () 66 | import Unboxed.Rep.Sum2.Float.Addr () 67 | import Unboxed.Rep.Sum2.Int.Addr () 68 | import Unboxed.Rep.Sum2.Int8.Addr () 69 | import Unboxed.Rep.Sum2.Int16.Addr () 70 | import Unboxed.Rep.Sum2.Int32.Addr () 71 | import Unboxed.Rep.Sum2.Int64.Addr () 72 | import Unboxed.Rep.Sum2.Lifted.Addr () 73 | import Unboxed.Rep.Sum2.Tuple0.Addr () 74 | import Unboxed.Rep.Sum2.Unlifted.Addr () 75 | import Unboxed.Rep.Sum2.Word.Addr () 76 | import Unboxed.Rep.Sum2.Word8.Addr () 77 | import Unboxed.Rep.Sum2.Word16.Addr () 78 | import Unboxed.Rep.Sum2.Word32.Addr () 79 | import Unboxed.Rep.Sum2.Word64.Addr () 80 | import Unboxed.Rep.Tuple2.Addr.Addr () 81 | import Unboxed.Rep.Tuple2.Double.Addr () 82 | import Unboxed.Rep.Tuple2.Float.Addr () 83 | import Unboxed.Rep.Tuple2.Int.Addr () 84 | import Unboxed.Rep.Tuple2.Int8.Addr () 85 | import Unboxed.Rep.Tuple2.Int16.Addr () 86 | import Unboxed.Rep.Tuple2.Int32.Addr () 87 | import Unboxed.Rep.Tuple2.Int64.Addr () 88 | import Unboxed.Rep.Tuple2.Lifted.Addr () 89 | import Unboxed.Rep.Tuple2.Tuple0.Addr () 90 | import Unboxed.Rep.Tuple2.Unlifted.Addr () 91 | import Unboxed.Rep.Tuple2.Word.Addr () 92 | import Unboxed.Rep.Tuple2.Word8.Addr () 93 | import Unboxed.Rep.Tuple2.Word16.Addr () 94 | import Unboxed.Rep.Tuple2.Word32.Addr () 95 | import Unboxed.Rep.Tuple2.Word64.Addr () 96 | 97 | import Unboxed.Rep.Sum2.Addr.Double () 98 | import Unboxed.Rep.Sum2.Double.Double () 99 | import Unboxed.Rep.Sum2.Float.Double () 100 | import Unboxed.Rep.Sum2.Int.Double () 101 | import Unboxed.Rep.Sum2.Int8.Double () 102 | import Unboxed.Rep.Sum2.Int16.Double () 103 | import Unboxed.Rep.Sum2.Int32.Double () 104 | import Unboxed.Rep.Sum2.Int64.Double () 105 | import Unboxed.Rep.Sum2.Lifted.Double () 106 | import Unboxed.Rep.Sum2.Tuple0.Double () 107 | import Unboxed.Rep.Sum2.Unlifted.Double () 108 | import Unboxed.Rep.Sum2.Word.Double () 109 | import Unboxed.Rep.Sum2.Word8.Double () 110 | import Unboxed.Rep.Sum2.Word16.Double () 111 | import Unboxed.Rep.Sum2.Word32.Double () 112 | import Unboxed.Rep.Sum2.Word64.Double () 113 | import Unboxed.Rep.Tuple2.Addr.Double () 114 | import Unboxed.Rep.Tuple2.Double.Double () 115 | import Unboxed.Rep.Tuple2.Float.Double () 116 | import Unboxed.Rep.Tuple2.Int.Double () 117 | import Unboxed.Rep.Tuple2.Int8.Double () 118 | import Unboxed.Rep.Tuple2.Int16.Double () 119 | import Unboxed.Rep.Tuple2.Int32.Double () 120 | import Unboxed.Rep.Tuple2.Int64.Double () 121 | import Unboxed.Rep.Tuple2.Lifted.Double () 122 | import Unboxed.Rep.Tuple2.Tuple0.Double () 123 | import Unboxed.Rep.Tuple2.Unlifted.Double () 124 | import Unboxed.Rep.Tuple2.Word.Double () 125 | import Unboxed.Rep.Tuple2.Word8.Double () 126 | import Unboxed.Rep.Tuple2.Word16.Double () 127 | import Unboxed.Rep.Tuple2.Word32.Double () 128 | import Unboxed.Rep.Tuple2.Word64.Double () 129 | 130 | import Unboxed.Rep.Sum2.Addr.Float () 131 | import Unboxed.Rep.Sum2.Double.Float () 132 | import Unboxed.Rep.Sum2.Float.Float () 133 | import Unboxed.Rep.Sum2.Int.Float () 134 | import Unboxed.Rep.Sum2.Int8.Float () 135 | import Unboxed.Rep.Sum2.Int16.Float () 136 | import Unboxed.Rep.Sum2.Int32.Float () 137 | import Unboxed.Rep.Sum2.Int64.Float () 138 | import Unboxed.Rep.Sum2.Lifted.Float () 139 | import Unboxed.Rep.Sum2.Tuple0.Float () 140 | import Unboxed.Rep.Sum2.Unlifted.Float () 141 | import Unboxed.Rep.Sum2.Word.Float () 142 | import Unboxed.Rep.Sum2.Word8.Float () 143 | import Unboxed.Rep.Sum2.Word16.Float () 144 | import Unboxed.Rep.Sum2.Word32.Float () 145 | import Unboxed.Rep.Sum2.Word64.Float () 146 | import Unboxed.Rep.Tuple2.Addr.Float () 147 | import Unboxed.Rep.Tuple2.Double.Float () 148 | import Unboxed.Rep.Tuple2.Float.Float () 149 | import Unboxed.Rep.Tuple2.Int.Float () 150 | import Unboxed.Rep.Tuple2.Int8.Float () 151 | import Unboxed.Rep.Tuple2.Int16.Float () 152 | import Unboxed.Rep.Tuple2.Int32.Float () 153 | import Unboxed.Rep.Tuple2.Int64.Float () 154 | import Unboxed.Rep.Tuple2.Lifted.Float () 155 | import Unboxed.Rep.Tuple2.Tuple0.Float () 156 | import Unboxed.Rep.Tuple2.Unlifted.Float () 157 | import Unboxed.Rep.Tuple2.Word.Float () 158 | import Unboxed.Rep.Tuple2.Word8.Float () 159 | import Unboxed.Rep.Tuple2.Word16.Float () 160 | import Unboxed.Rep.Tuple2.Word32.Float () 161 | import Unboxed.Rep.Tuple2.Word64.Float () 162 | 163 | import Unboxed.Rep.Sum2.Addr.Int () 164 | import Unboxed.Rep.Sum2.Double.Int () 165 | import Unboxed.Rep.Sum2.Float.Int () 166 | import Unboxed.Rep.Sum2.Int.Int () 167 | import Unboxed.Rep.Sum2.Int8.Int () 168 | import Unboxed.Rep.Sum2.Int16.Int () 169 | import Unboxed.Rep.Sum2.Int32.Int () 170 | import Unboxed.Rep.Sum2.Int64.Int () 171 | import Unboxed.Rep.Sum2.Lifted.Int () 172 | import Unboxed.Rep.Sum2.Tuple0.Int () 173 | import Unboxed.Rep.Sum2.Unlifted.Int () 174 | import Unboxed.Rep.Sum2.Word.Int () 175 | import Unboxed.Rep.Sum2.Word8.Int () 176 | import Unboxed.Rep.Sum2.Word16.Int () 177 | import Unboxed.Rep.Sum2.Word32.Int () 178 | import Unboxed.Rep.Sum2.Word64.Int () 179 | import Unboxed.Rep.Tuple2.Addr.Int () 180 | import Unboxed.Rep.Tuple2.Double.Int () 181 | import Unboxed.Rep.Tuple2.Float.Int () 182 | import Unboxed.Rep.Tuple2.Int.Int () 183 | import Unboxed.Rep.Tuple2.Int8.Int () 184 | import Unboxed.Rep.Tuple2.Int16.Int () 185 | import Unboxed.Rep.Tuple2.Int32.Int () 186 | import Unboxed.Rep.Tuple2.Int64.Int () 187 | import Unboxed.Rep.Tuple2.Lifted.Int () 188 | import Unboxed.Rep.Tuple2.Tuple0.Int () 189 | import Unboxed.Rep.Tuple2.Unlifted.Int () 190 | import Unboxed.Rep.Tuple2.Word.Int () 191 | import Unboxed.Rep.Tuple2.Word8.Int () 192 | import Unboxed.Rep.Tuple2.Word16.Int () 193 | import Unboxed.Rep.Tuple2.Word32.Int () 194 | import Unboxed.Rep.Tuple2.Word64.Int () 195 | 196 | import Unboxed.Rep.Sum2.Addr.Int8 () 197 | import Unboxed.Rep.Sum2.Double.Int8 () 198 | import Unboxed.Rep.Sum2.Float.Int8 () 199 | import Unboxed.Rep.Sum2.Int.Int8 () 200 | import Unboxed.Rep.Sum2.Int8.Int8 () 201 | import Unboxed.Rep.Sum2.Int16.Int8 () 202 | import Unboxed.Rep.Sum2.Int32.Int8 () 203 | import Unboxed.Rep.Sum2.Int64.Int8 () 204 | import Unboxed.Rep.Sum2.Lifted.Int8 () 205 | import Unboxed.Rep.Sum2.Tuple0.Int8 () 206 | import Unboxed.Rep.Sum2.Unlifted.Int8 () 207 | import Unboxed.Rep.Sum2.Word.Int8 () 208 | import Unboxed.Rep.Sum2.Word8.Int8 () 209 | import Unboxed.Rep.Sum2.Word16.Int8 () 210 | import Unboxed.Rep.Sum2.Word32.Int8 () 211 | import Unboxed.Rep.Sum2.Word64.Int8 () 212 | import Unboxed.Rep.Tuple2.Addr.Int8 () 213 | import Unboxed.Rep.Tuple2.Double.Int8 () 214 | import Unboxed.Rep.Tuple2.Float.Int8 () 215 | import Unboxed.Rep.Tuple2.Int.Int8 () 216 | import Unboxed.Rep.Tuple2.Int8.Int8 () 217 | import Unboxed.Rep.Tuple2.Int16.Int8 () 218 | import Unboxed.Rep.Tuple2.Int32.Int8 () 219 | import Unboxed.Rep.Tuple2.Int64.Int8 () 220 | import Unboxed.Rep.Tuple2.Lifted.Int8 () 221 | import Unboxed.Rep.Sum2.Tuple0.Int16 () 222 | import Unboxed.Rep.Sum2.Unlifted.Int16 () 223 | import Unboxed.Rep.Sum2.Word.Int16 () 224 | import Unboxed.Rep.Sum2.Word8.Int16 () 225 | import Unboxed.Rep.Sum2.Word16.Int16 () 226 | import Unboxed.Rep.Sum2.Word32.Int16 () 227 | import Unboxed.Rep.Sum2.Word64.Int16 () 228 | import Unboxed.Rep.Tuple2.Addr.Int16 () 229 | import Unboxed.Rep.Tuple2.Double.Int16 () 230 | import Unboxed.Rep.Tuple2.Float.Int16 () 231 | import Unboxed.Rep.Tuple2.Int.Int16 () 232 | import Unboxed.Rep.Tuple2.Int8.Int16 () 233 | import Unboxed.Rep.Tuple2.Int16.Int16 () 234 | import Unboxed.Rep.Tuple2.Int32.Int16 () 235 | import Unboxed.Rep.Tuple2.Int64.Int16 () 236 | import Unboxed.Rep.Tuple2.Lifted.Int16 () 237 | import Unboxed.Rep.Tuple2.Tuple0.Int16 () 238 | import Unboxed.Rep.Tuple2.Unlifted.Int16 () 239 | import Unboxed.Rep.Tuple2.Word.Int16 () 240 | import Unboxed.Rep.Tuple2.Word8.Int16 () 241 | import Unboxed.Rep.Tuple2.Word16.Int16 () 242 | import Unboxed.Rep.Tuple2.Word32.Int16 () 243 | import Unboxed.Rep.Tuple2.Word64.Int16 () 244 | 245 | import Unboxed.Rep.Sum2.Addr.Int32 () 246 | import Unboxed.Rep.Sum2.Double.Int32 () 247 | import Unboxed.Rep.Sum2.Float.Int32 () 248 | import Unboxed.Rep.Sum2.Int.Int32 () 249 | import Unboxed.Rep.Sum2.Int8.Int32 () 250 | import Unboxed.Rep.Sum2.Int16.Int32 () 251 | import Unboxed.Rep.Sum2.Int32.Int32 () 252 | import Unboxed.Rep.Sum2.Int64.Int32 () 253 | import Unboxed.Rep.Sum2.Lifted.Int32 () 254 | import Unboxed.Rep.Sum2.Tuple0.Int32 () 255 | import Unboxed.Rep.Sum2.Unlifted.Int32 () 256 | import Unboxed.Rep.Sum2.Word.Int32 () 257 | import Unboxed.Rep.Sum2.Word8.Int32 () 258 | import Unboxed.Rep.Sum2.Word16.Int32 () 259 | import Unboxed.Rep.Sum2.Word32.Int32 () 260 | import Unboxed.Rep.Sum2.Word64.Int32 () 261 | import Unboxed.Rep.Tuple2.Addr.Int32 () 262 | import Unboxed.Rep.Tuple2.Double.Int32 () 263 | import Unboxed.Rep.Tuple2.Float.Int32 () 264 | import Unboxed.Rep.Tuple2.Int.Int32 () 265 | import Unboxed.Rep.Tuple2.Int8.Int32 () 266 | import Unboxed.Rep.Tuple2.Int16.Int32 () 267 | import Unboxed.Rep.Tuple2.Int32.Int32 () 268 | import Unboxed.Rep.Tuple2.Int64.Int32 () 269 | import Unboxed.Rep.Tuple2.Lifted.Int32 () 270 | import Unboxed.Rep.Tuple2.Tuple0.Int32 () 271 | import Unboxed.Rep.Tuple2.Unlifted.Int32 () 272 | import Unboxed.Rep.Tuple2.Word.Int32 () 273 | import Unboxed.Rep.Tuple2.Word8.Int32 () 274 | import Unboxed.Rep.Tuple2.Word16.Int32 () 275 | import Unboxed.Rep.Tuple2.Word32.Int32 () 276 | import Unboxed.Rep.Tuple2.Word64.Int32 () 277 | 278 | import Unboxed.Rep.Sum2.Addr.Int64 () 279 | import Unboxed.Rep.Sum2.Double.Int64 () 280 | import Unboxed.Rep.Sum2.Float.Int64 () 281 | import Unboxed.Rep.Sum2.Int.Int64 () 282 | import Unboxed.Rep.Sum2.Int8.Int64 () 283 | import Unboxed.Rep.Sum2.Int16.Int64 () 284 | import Unboxed.Rep.Sum2.Int32.Int64 () 285 | import Unboxed.Rep.Sum2.Int64.Int64 () 286 | import Unboxed.Rep.Sum2.Lifted.Int64 () 287 | import Unboxed.Rep.Sum2.Tuple0.Int64 () 288 | import Unboxed.Rep.Sum2.Unlifted.Int64 () 289 | import Unboxed.Rep.Sum2.Word.Int64 () 290 | import Unboxed.Rep.Sum2.Word8.Int64 () 291 | import Unboxed.Rep.Sum2.Word16.Int64 () 292 | import Unboxed.Rep.Sum2.Word32.Int64 () 293 | import Unboxed.Rep.Sum2.Word64.Int64 () 294 | import Unboxed.Rep.Tuple2.Addr.Int64 () 295 | import Unboxed.Rep.Tuple2.Double.Int64 () 296 | import Unboxed.Rep.Tuple2.Float.Int64 () 297 | import Unboxed.Rep.Tuple2.Int.Int64 () 298 | import Unboxed.Rep.Tuple2.Int8.Int64 () 299 | import Unboxed.Rep.Tuple2.Int16.Int64 () 300 | import Unboxed.Rep.Tuple2.Int32.Int64 () 301 | import Unboxed.Rep.Tuple2.Int64.Int64 () 302 | import Unboxed.Rep.Tuple2.Lifted.Int64 () 303 | import Unboxed.Rep.Tuple2.Tuple0.Int64 () 304 | import Unboxed.Rep.Tuple2.Unlifted.Int64 () 305 | import Unboxed.Rep.Tuple2.Word.Int64 () 306 | import Unboxed.Rep.Tuple2.Word8.Int64 () 307 | import Unboxed.Rep.Tuple2.Word16.Int64 () 308 | import Unboxed.Rep.Tuple2.Word32.Int64 () 309 | import Unboxed.Rep.Tuple2.Word64.Int64 () 310 | 311 | import Unboxed.Rep.Sum2.Addr.Lifted () 312 | import Unboxed.Rep.Sum2.Double.Lifted () 313 | import Unboxed.Rep.Sum2.Float.Lifted () 314 | import Unboxed.Rep.Sum2.Int.Lifted () 315 | import Unboxed.Rep.Sum2.Int8.Lifted () 316 | import Unboxed.Rep.Sum2.Int16.Lifted () 317 | import Unboxed.Rep.Sum2.Int32.Lifted () 318 | import Unboxed.Rep.Sum2.Int64.Lifted () 319 | import Unboxed.Rep.Sum2.Lifted.Lifted () 320 | import Unboxed.Rep.Sum2.Tuple0.Lifted () 321 | import Unboxed.Rep.Sum2.Unlifted.Lifted () 322 | import Unboxed.Rep.Sum2.Word.Lifted () 323 | import Unboxed.Rep.Sum2.Word8.Lifted () 324 | import Unboxed.Rep.Sum2.Word16.Lifted () 325 | import Unboxed.Rep.Sum2.Word32.Lifted () 326 | import Unboxed.Rep.Sum2.Word64.Lifted () 327 | import Unboxed.Rep.Tuple2.Addr.Lifted () 328 | import Unboxed.Rep.Tuple2.Double.Lifted () 329 | import Unboxed.Rep.Tuple2.Float.Lifted () 330 | import Unboxed.Rep.Tuple2.Int.Lifted () 331 | import Unboxed.Rep.Tuple2.Int8.Lifted () 332 | import Unboxed.Rep.Tuple2.Int16.Lifted () 333 | import Unboxed.Rep.Tuple2.Int32.Lifted () 334 | import Unboxed.Rep.Tuple2.Int64.Lifted () 335 | import Unboxed.Rep.Tuple2.Lifted.Lifted () 336 | import Unboxed.Rep.Tuple2.Tuple0.Lifted () 337 | import Unboxed.Rep.Tuple2.Unlifted.Lifted () 338 | import Unboxed.Rep.Tuple2.Word.Lifted () 339 | import Unboxed.Rep.Tuple2.Word8.Lifted () 340 | import Unboxed.Rep.Tuple2.Word16.Lifted () 341 | import Unboxed.Rep.Tuple2.Word32.Lifted () 342 | import Unboxed.Rep.Tuple2.Word64.Lifted () 343 | 344 | import Unboxed.Rep.Sum2.Addr.Tuple0 () 345 | import Unboxed.Rep.Sum2.Double.Tuple0 () 346 | import Unboxed.Rep.Sum2.Float.Tuple0 () 347 | import Unboxed.Rep.Sum2.Int.Tuple0 () 348 | import Unboxed.Rep.Sum2.Int8.Tuple0 () 349 | import Unboxed.Rep.Sum2.Int16.Tuple0 () 350 | import Unboxed.Rep.Sum2.Int32.Tuple0 () 351 | import Unboxed.Rep.Sum2.Int64.Tuple0 () 352 | import Unboxed.Rep.Sum2.Lifted.Tuple0 () 353 | import Unboxed.Rep.Sum2.Tuple0.Tuple0 () 354 | import Unboxed.Rep.Sum2.Unlifted.Tuple0 () 355 | import Unboxed.Rep.Sum2.Word.Tuple0 () 356 | import Unboxed.Rep.Sum2.Word8.Tuple0 () 357 | import Unboxed.Rep.Sum2.Word16.Tuple0 () 358 | import Unboxed.Rep.Sum2.Word32.Tuple0 () 359 | import Unboxed.Rep.Sum2.Word64.Tuple0 () 360 | import Unboxed.Rep.Tuple2.Addr.Tuple0 () 361 | import Unboxed.Rep.Tuple2.Double.Tuple0 () 362 | import Unboxed.Rep.Tuple2.Float.Tuple0 () 363 | import Unboxed.Rep.Tuple2.Int.Tuple0 () 364 | import Unboxed.Rep.Tuple2.Int8.Tuple0 () 365 | import Unboxed.Rep.Tuple2.Int16.Tuple0 () 366 | import Unboxed.Rep.Tuple2.Int32.Tuple0 () 367 | import Unboxed.Rep.Tuple2.Int64.Tuple0 () 368 | import Unboxed.Rep.Tuple2.Lifted.Tuple0 () 369 | import Unboxed.Rep.Tuple2.Tuple0.Tuple0 () 370 | import Unboxed.Rep.Tuple2.Unlifted.Tuple0 () 371 | import Unboxed.Rep.Tuple2.Word.Tuple0 () 372 | import Unboxed.Rep.Tuple2.Word8.Tuple0 () 373 | import Unboxed.Rep.Tuple2.Word16.Tuple0 () 374 | import Unboxed.Rep.Tuple2.Word32.Tuple0 () 375 | import Unboxed.Rep.Tuple2.Word64.Tuple0 () 376 | 377 | import Unboxed.Rep.Sum2.Addr.Unlifted () 378 | import Unboxed.Rep.Sum2.Double.Unlifted () 379 | import Unboxed.Rep.Sum2.Float.Unlifted () 380 | import Unboxed.Rep.Sum2.Int.Unlifted () 381 | import Unboxed.Rep.Sum2.Int8.Unlifted () 382 | import Unboxed.Rep.Sum2.Int16.Unlifted () 383 | import Unboxed.Rep.Sum2.Int32.Unlifted () 384 | import Unboxed.Rep.Sum2.Int64.Unlifted () 385 | import Unboxed.Rep.Sum2.Lifted.Unlifted () 386 | import Unboxed.Rep.Sum2.Tuple0.Unlifted () 387 | import Unboxed.Rep.Sum2.Unlifted.Unlifted () 388 | import Unboxed.Rep.Sum2.Word8.Unlifted () 389 | import Unboxed.Rep.Sum2.Word16.Unlifted () 390 | import Unboxed.Rep.Sum2.Word32.Unlifted () 391 | import Unboxed.Rep.Sum2.Word64.Unlifted () 392 | import Unboxed.Rep.Tuple2.Addr.Unlifted () 393 | import Unboxed.Rep.Tuple2.Double.Unlifted () 394 | import Unboxed.Rep.Tuple2.Float.Unlifted () 395 | import Unboxed.Rep.Tuple2.Int.Unlifted () 396 | import Unboxed.Rep.Tuple2.Int8.Unlifted () 397 | import Unboxed.Rep.Tuple2.Int16.Unlifted () 398 | import Unboxed.Rep.Tuple2.Int32.Unlifted () 399 | import Unboxed.Rep.Tuple2.Int64.Unlifted () 400 | import Unboxed.Rep.Tuple2.Lifted.Unlifted () 401 | import Unboxed.Rep.Tuple2.Tuple0.Unlifted () 402 | import Unboxed.Rep.Tuple2.Unlifted.Unlifted () 403 | import Unboxed.Rep.Tuple2.Word8.Unlifted () 404 | import Unboxed.Rep.Tuple2.Word16.Unlifted () 405 | import Unboxed.Rep.Tuple2.Word32.Unlifted () 406 | import Unboxed.Rep.Tuple2.Word64.Unlifted () 407 | 408 | import Unboxed.Rep.Sum2.Addr.Word () 409 | import Unboxed.Rep.Sum2.Double.Word () 410 | import Unboxed.Rep.Sum2.Float.Word () 411 | import Unboxed.Rep.Sum2.Int.Word () 412 | import Unboxed.Rep.Sum2.Int8.Word () 413 | import Unboxed.Rep.Sum2.Int16.Word () 414 | import Unboxed.Rep.Sum2.Int32.Word () 415 | import Unboxed.Rep.Sum2.Int64.Word () 416 | import Unboxed.Rep.Sum2.Lifted.Word () 417 | import Unboxed.Rep.Sum2.Tuple0.Word () 418 | import Unboxed.Rep.Sum2.Unlifted.Word () 419 | import Unboxed.Rep.Sum2.Word.Word () 420 | import Unboxed.Rep.Sum2.Word8.Word () 421 | import Unboxed.Rep.Sum2.Word16.Word () 422 | import Unboxed.Rep.Sum2.Word32.Word () 423 | import Unboxed.Rep.Sum2.Word64.Word () 424 | import Unboxed.Rep.Tuple2.Addr.Word () 425 | import Unboxed.Rep.Tuple2.Double.Word () 426 | import Unboxed.Rep.Tuple2.Float.Word () 427 | import Unboxed.Rep.Tuple2.Int.Word () 428 | import Unboxed.Rep.Tuple2.Int8.Word () 429 | import Unboxed.Rep.Tuple2.Int16.Word () 430 | import Unboxed.Rep.Tuple2.Int32.Word () 431 | import Unboxed.Rep.Tuple2.Int64.Word () 432 | import Unboxed.Rep.Tuple2.Lifted.Word () 433 | import Unboxed.Rep.Tuple2.Tuple0.Word () 434 | import Unboxed.Rep.Tuple2.Unlifted.Word () 435 | import Unboxed.Rep.Tuple2.Word.Word () 436 | import Unboxed.Rep.Tuple2.Word8.Word () 437 | import Unboxed.Rep.Tuple2.Word16.Word () 438 | import Unboxed.Rep.Tuple2.Word32.Word () 439 | import Unboxed.Rep.Tuple2.Word64.Word () 440 | 441 | import Unboxed.Rep.Sum2.Addr.Word8 () 442 | import Unboxed.Rep.Sum2.Double.Word8 () 443 | import Unboxed.Rep.Sum2.Float.Word8 () 444 | import Unboxed.Rep.Sum2.Int.Word8 () 445 | import Unboxed.Rep.Sum2.Int8.Word8 () 446 | import Unboxed.Rep.Sum2.Int16.Word8 () 447 | import Unboxed.Rep.Sum2.Int32.Word8 () 448 | import Unboxed.Rep.Sum2.Int64.Word8 () 449 | import Unboxed.Rep.Sum2.Lifted.Word8 () 450 | import Unboxed.Rep.Sum2.Tuple0.Word8 () 451 | import Unboxed.Rep.Sum2.Unlifted.Word8 () 452 | import Unboxed.Rep.Sum2.Word.Word8 () 453 | import Unboxed.Rep.Sum2.Word8.Word8 () 454 | import Unboxed.Rep.Sum2.Word16.Word8 () 455 | import Unboxed.Rep.Sum2.Word32.Word8 () 456 | import Unboxed.Rep.Sum2.Word64.Word8 () 457 | import Unboxed.Rep.Tuple2.Addr.Word8 () 458 | import Unboxed.Rep.Tuple2.Double.Word8 () 459 | import Unboxed.Rep.Tuple2.Float.Word8 () 460 | import Unboxed.Rep.Tuple2.Int.Word8 () 461 | import Unboxed.Rep.Tuple2.Int8.Word8 () 462 | import Unboxed.Rep.Tuple2.Int16.Word8 () 463 | import Unboxed.Rep.Tuple2.Int32.Word8 () 464 | import Unboxed.Rep.Tuple2.Int64.Word8 () 465 | import Unboxed.Rep.Tuple2.Lifted.Word8 () 466 | import Unboxed.Rep.Tuple2.Tuple0.Word8 () 467 | import Unboxed.Rep.Tuple2.Unlifted.Word8 () 468 | import Unboxed.Rep.Tuple2.Word.Word8 () 469 | import Unboxed.Rep.Tuple2.Word8.Word8 () 470 | import Unboxed.Rep.Tuple2.Word16.Word8 () 471 | import Unboxed.Rep.Tuple2.Word32.Word8 () 472 | import Unboxed.Rep.Tuple2.Word64.Word8 () 473 | 474 | import Unboxed.Rep.Sum2.Addr.Word16 () 475 | import Unboxed.Rep.Sum2.Double.Word16 () 476 | import Unboxed.Rep.Sum2.Float.Word16 () 477 | import Unboxed.Rep.Sum2.Int.Word16 () 478 | import Unboxed.Rep.Sum2.Int8.Word16 () 479 | import Unboxed.Rep.Sum2.Int16.Word16 () 480 | import Unboxed.Rep.Sum2.Int32.Word16 () 481 | import Unboxed.Rep.Sum2.Int64.Word16 () 482 | import Unboxed.Rep.Sum2.Lifted.Word16 () 483 | import Unboxed.Rep.Sum2.Tuple0.Word16 () 484 | import Unboxed.Rep.Sum2.Unlifted.Word16 () 485 | import Unboxed.Rep.Sum2.Word.Word16 () 486 | import Unboxed.Rep.Sum2.Word8.Word16 () 487 | import Unboxed.Rep.Sum2.Word16.Word16 () 488 | import Unboxed.Rep.Sum2.Word32.Word16 () 489 | import Unboxed.Rep.Sum2.Word64.Word16 () 490 | import Unboxed.Rep.Tuple2.Addr.Word16 () 491 | import Unboxed.Rep.Tuple2.Double.Word16 () 492 | import Unboxed.Rep.Tuple2.Float.Word16 () 493 | import Unboxed.Rep.Tuple2.Int.Word16 () 494 | import Unboxed.Rep.Tuple2.Int8.Word16 () 495 | import Unboxed.Rep.Tuple2.Int16.Word16 () 496 | import Unboxed.Rep.Tuple2.Int32.Word16 () 497 | import Unboxed.Rep.Tuple2.Int64.Word16 () 498 | import Unboxed.Rep.Tuple2.Lifted.Word16 () 499 | import Unboxed.Rep.Tuple2.Tuple0.Word16 () 500 | import Unboxed.Rep.Tuple2.Unlifted.Word16 () 501 | import Unboxed.Rep.Tuple2.Word.Word16 () 502 | import Unboxed.Rep.Tuple2.Word8.Word16 () 503 | import Unboxed.Rep.Tuple2.Word16.Word16 () 504 | import Unboxed.Rep.Tuple2.Word32.Word16 () 505 | import Unboxed.Rep.Tuple2.Word64.Word16 () 506 | 507 | import Unboxed.Rep.Sum2.Addr.Word32 () 508 | import Unboxed.Rep.Sum2.Double.Word32 () 509 | import Unboxed.Rep.Sum2.Float.Word32 () 510 | import Unboxed.Rep.Sum2.Int.Word32 () 511 | import Unboxed.Rep.Sum2.Int8.Word32 () 512 | import Unboxed.Rep.Sum2.Int16.Word32 () 513 | import Unboxed.Rep.Sum2.Int32.Word32 () 514 | import Unboxed.Rep.Sum2.Int64.Word32 () 515 | import Unboxed.Rep.Sum2.Lifted.Word32 () 516 | import Unboxed.Rep.Sum2.Tuple0.Word32 () 517 | import Unboxed.Rep.Sum2.Unlifted.Word32 () 518 | import Unboxed.Rep.Sum2.Word.Word32 () 519 | import Unboxed.Rep.Sum2.Word8.Word32 () 520 | import Unboxed.Rep.Sum2.Word16.Word32 () 521 | import Unboxed.Rep.Sum2.Word32.Word32 () 522 | import Unboxed.Rep.Sum2.Word64.Word32 () 523 | import Unboxed.Rep.Tuple2.Addr.Word32 () 524 | import Unboxed.Rep.Tuple2.Double.Word32 () 525 | import Unboxed.Rep.Tuple2.Float.Word32 () 526 | import Unboxed.Rep.Tuple2.Int.Word32 () 527 | import Unboxed.Rep.Tuple2.Int8.Word32 () 528 | import Unboxed.Rep.Tuple2.Int16.Word32 () 529 | import Unboxed.Rep.Tuple2.Int32.Word32 () 530 | import Unboxed.Rep.Tuple2.Int64.Word32 () 531 | import Unboxed.Rep.Tuple2.Lifted.Word32 () 532 | import Unboxed.Rep.Tuple2.Tuple0.Word32 () 533 | import Unboxed.Rep.Tuple2.Unlifted.Word32 () 534 | import Unboxed.Rep.Tuple2.Word.Word32 () 535 | import Unboxed.Rep.Tuple2.Word8.Word32 () 536 | import Unboxed.Rep.Tuple2.Word16.Word32 () 537 | import Unboxed.Rep.Tuple2.Word32.Word32 () 538 | import Unboxed.Rep.Tuple2.Word64.Word32 () 539 | 540 | import Unboxed.Rep.Sum2.Addr.Word64 () 541 | import Unboxed.Rep.Sum2.Double.Word64 () 542 | import Unboxed.Rep.Sum2.Float.Word64 () 543 | import Unboxed.Rep.Sum2.Int.Word64 () 544 | import Unboxed.Rep.Sum2.Int8.Word64 () 545 | import Unboxed.Rep.Sum2.Int16.Word64 () 546 | import Unboxed.Rep.Sum2.Int32.Word64 () 547 | import Unboxed.Rep.Sum2.Int64.Word64 () 548 | import Unboxed.Rep.Sum2.Lifted.Word64 () 549 | import Unboxed.Rep.Sum2.Tuple0.Word64 () 550 | import Unboxed.Rep.Sum2.Unlifted.Word64 () 551 | import Unboxed.Rep.Sum2.Word.Word64 () 552 | import Unboxed.Rep.Sum2.Word8.Word64 () 553 | import Unboxed.Rep.Sum2.Word16.Word64 () 554 | import Unboxed.Rep.Sum2.Word32.Word64 () 555 | import Unboxed.Rep.Sum2.Word64.Word64 () 556 | import Unboxed.Rep.Tuple2.Addr.Word64 () 557 | import Unboxed.Rep.Tuple2.Double.Word64 () 558 | import Unboxed.Rep.Tuple2.Float.Word64 () 559 | import Unboxed.Rep.Tuple2.Int.Word64 () 560 | import Unboxed.Rep.Tuple2.Int8.Word64 () 561 | import Unboxed.Rep.Tuple2.Int16.Word64 () 562 | import Unboxed.Rep.Tuple2.Int32.Word64 () 563 | import Unboxed.Rep.Tuple2.Int64.Word64 () 564 | import Unboxed.Rep.Tuple2.Lifted.Word64 () 565 | import Unboxed.Rep.Tuple2.Tuple0.Word64 () 566 | import Unboxed.Rep.Tuple2.Unlifted.Word64 () 567 | import Unboxed.Rep.Tuple2.Word.Word64 () 568 | import Unboxed.Rep.Tuple2.Word8.Word64 () 569 | import Unboxed.Rep.Tuple2.Word16.Word64 () 570 | import Unboxed.Rep.Tuple2.Word32.Word64 () 571 | import Unboxed.Rep.Tuple2.Word64.Word64 () 572 | 573 | #endif 574 | -------------------------------------------------------------------------------- /src/Unboxed/Combinators.hs: -------------------------------------------------------------------------------- 1 | {-# Language NoImplicitPrelude #-} 2 | module Unboxed.Combinators 3 | ( id, const 4 | ) where 5 | 6 | import Unboxed.Internal.Combinators 7 | -------------------------------------------------------------------------------- /src/Unboxed/Internal/BigNat.hs: -------------------------------------------------------------------------------- 1 | {-# Language NoImplicitPrelude #-} 2 | {-# Language RebindableSyntax #-} 3 | {-# Language MagicHash #-} 4 | {-# Language KindSignatures #-} 5 | {-# Language DataKinds #-} 6 | {-# Language TypeSynonymInstances #-} 7 | {-# Language UnboxedTuples #-} 8 | {-# Language UnboxedSums #-} 9 | {-# Language ImportQualifiedPost #-} 10 | {-# Language UnliftedNewtypes #-} 11 | {-# OPTIONS_GHC -Wno-orphans #-} 12 | 13 | module Unboxed.Internal.BigNat where 14 | 15 | import Control.Exception (throw, ArithException(Underflow)) 16 | import Data.Coerce 17 | import GHC.Num.Integer 18 | import GHC.Num.BigNat qualified as GHC 19 | import GHC.Prim 20 | import GHC.Types 21 | import Unboxed.Internal.Class 22 | import Unboxed.Rep.Unlifted () 23 | 24 | bigNatSize# :: BigNat# -> Int# 25 | bigNatSize# = coerce GHC.bigNatSize# 26 | {-# inline bigNatSize# #-} 27 | 28 | bigNatToWord# :: BigNat# -> Word# 29 | bigNatToWord# = coerce GHC.bigNatToWord# 30 | {-# inline bigNatToWord# #-} 31 | 32 | bigNatFromWord# :: Word# -> BigNat# 33 | bigNatFromWord# = coerce GHC.bigNatFromWord# 34 | {-# inline bigNatFromWord# #-} 35 | 36 | bigNatFromWord2# :: Word# -> Word# -> BigNat# 37 | bigNatFromWord2# = coerce GHC.bigNatFromWord2# 38 | {-# inline bigNatFromWord2# #-} 39 | 40 | bigNatAddWord# :: BigNat# -> Word# -> BigNat# 41 | bigNatAddWord# = coerce GHC.bigNatAddWord# 42 | {-# inline bigNatAddWord# #-} 43 | 44 | bigNatSubWord# :: BigNat# -> Word# -> (# (##) | BigNat# #) 45 | bigNatSubWord# = coerce GHC.bigNatSubWord# 46 | {-# inline bigNatSubWord# #-} 47 | 48 | bigNatSubWordUnsafe# :: BigNat# -> Word# -> BigNat# 49 | bigNatSubWordUnsafe# = coerce GHC.bigNatSubWordUnsafe# 50 | {-# inline bigNatSubWordUnsafe# #-} 51 | 52 | bigNatMulWord# :: BigNat# -> Word# -> BigNat# 53 | bigNatMulWord# = coerce GHC.bigNatMulWord# 54 | {-# inline bigNatMulWord# #-} 55 | 56 | bigNatCheck# :: BigNat# -> Int# 57 | bigNatCheck# = coerce GHC.bigNatCheck# 58 | {-# inline bigNatCheck# #-} 59 | 60 | -- | Simple unlifted natural numbers. Used inside other numeric types. 61 | -- Contained in an unlifted newtype unlike 'GHC.Num.BigNat.BigNat#' 62 | -- so we can hang instances off it. 63 | newtype BigNat# = BigNat# GHC.BigNat# 64 | 65 | instance Eq BigNat# where 66 | (==) = coerce GHC.bigNatEq 67 | {-# inline (==) #-} 68 | (/=) = coerce GHC.bigNatNe 69 | {-# inline (/=) #-} 70 | 71 | instance Ord BigNat# where 72 | (<=) = coerce GHC.bigNatLe 73 | {-# inline (<=) #-} 74 | (>=) = coerce GHC.bigNatGe 75 | {-# inline (>=) #-} 76 | (<) = coerce GHC.bigNatLt 77 | {-# inline (<) #-} 78 | (>) = coerce GHC.bigNatGt 79 | {-# inline (>) #-} 80 | compare = coerce GHC.bigNatCompare 81 | {-# inline compare #-} 82 | 83 | instance Show BigNat# where 84 | showsPrec d x = showsPrec d (toInteger x) 85 | 86 | instance Num BigNat# where 87 | (+) = coerce GHC.bigNatAdd 88 | {-# inline (+) #-} 89 | 90 | x - y = case coerce GHC.bigNatSub x y of 91 | (# (##) | #) -> throw Underflow 92 | (# | z #) -> z 93 | {-# inline (-) #-} 94 | 95 | (*) = coerce GHC.bigNatMul 96 | {-# inline (*) #-} 97 | 98 | negate x 99 | | isTrue# (coerce GHC.bigNatEqWord# x 0##) = x 100 | | True = throw Underflow 101 | {-# inline negate #-} 102 | 103 | signum x 104 | | isTrue# (coerce GHC.bigNatEqWord# x 0##) = x 105 | | True = coerce GHC.bigNatOne# void# 106 | {-# inline signum #-} 107 | 108 | abs x = x 109 | {-# inline abs #-} 110 | 111 | fromInteger (IS i) 112 | | isTrue# (i <# 0#) = throw Underflow 113 | | True = coerce GHC.bigNatFromAbsInt# i 114 | fromInteger IN{} = throw Underflow 115 | fromInteger (IP n) = BigNat# n 116 | {-# inline fromInteger #-} 117 | 118 | instance Enum BigNat# where 119 | fromEnum = coerce GHC.bigNatToInt 120 | {-# inline fromEnum #-} 121 | 122 | toEnum (I# i) 123 | | isTrue# (i <# 0#) = throw Underflow 124 | | True = coerce GHC.bigNatFromAbsInt# i 125 | {-# inline toEnum #-} 126 | 127 | pred x = case coerce GHC.bigNatSubWord# x 1## of 128 | (# (##) | #) -> throw Underflow 129 | (# | z #) -> z 130 | {-# inline pred #-} 131 | 132 | succ x = coerce GHC.bigNatAddWord# x 1## 133 | {-# inline succ #-} 134 | 135 | -- enumFromThenTo... 136 | 137 | instance Real BigNat# where 138 | toRational x = toRational (toInteger x) 139 | {-# inline toRational #-} 140 | 141 | instance Integral BigNat# where 142 | quot = coerce GHC.bigNatQuot 143 | {-# inline quot #-} 144 | 145 | rem = coerce GHC.bigNatRem 146 | {-# inline rem #-} 147 | 148 | div = coerce GHC.bigNatQuot 149 | {-# inline div #-} 150 | 151 | mod = coerce GHC.bigNatRem 152 | {-# inline mod #-} 153 | 154 | quotRem = coerce GHC.bigNatQuotRem# 155 | {-# inline quotRem #-} 156 | 157 | divMod = coerce GHC.bigNatQuotRem# 158 | {-# inline divMod #-} 159 | 160 | toInteger (BigNat# bn) 161 | | isTrue# ((coerce GHC.bigNatSize# bn ==# 1#) `andI#` (i# >=# 0#)) = IS i# 162 | | True = IP bn 163 | where i# = coerce GHC.bigNatToInt# bn 164 | {-# inline toInteger #-} 165 | -------------------------------------------------------------------------------- /src/Unboxed/Internal/Natural.hs: -------------------------------------------------------------------------------- 1 | {-# Language CPP #-} 2 | {-# Language DataKinds #-} 3 | {-# Language ImportQualifiedPost #-} 4 | {-# Language MagicHash #-} 5 | {-# Language NoImplicitPrelude #-} 6 | {-# Language PatternSynonyms #-} 7 | {-# Language PolyKinds #-} 8 | {-# Language RankNTypes #-} 9 | {-# Language UnboxedTuples #-} 10 | {-# Language UnliftedNewtypes #-} 11 | {-# Language ViewPatterns #-} 12 | 13 | module Unboxed.Internal.Natural where 14 | 15 | import Control.Exception (ArithException(Underflow)) 16 | import Unboxed.Internal.Class 17 | import Unboxed.Internal.BigNat 18 | import GHC.Integer 19 | import GHC.Num.Primitives 20 | import GHC.Num.Integer 21 | import GHC.Num.BigNat qualified as GHC 22 | import GHC.Prim 23 | import GHC.Exts 24 | import Prelude ((&&), (||), Bool(..), Ordering(..)) 25 | 26 | import Unboxed.Rep.Int () 27 | import Unboxed.Rep.Tuple2.Word.Unlifted () 28 | import Unboxed.Rep.Word () 29 | 30 | -- #define CONSTANT_FOLDED INLINE 31 | -- #define CONSTANT_FOLDED NOINLINE 32 | -- #define CONSTANT_FOLDED INLINE[0] 33 | #define CONSTANT_FOLDED NOINLINE[0] 34 | 35 | newtype Natural# = Natural# (# Word#, BigNat# #) 36 | 37 | instance Eq Natural# where 38 | N x xs == N y ys = x == y && xs == ys 39 | N x xs /= N y ys = x /= y || xs /= ys 40 | 41 | instance Ord Natural# where 42 | NJ xs <= NJ ys = xs <= ys 43 | _ <= NJ{} = True 44 | NJ{} <= _ = False 45 | NS# x <= NS# y = x <= y 46 | 47 | NJ xs >= NJ ys = xs >= ys 48 | _ >= NJ{} = False 49 | NJ{} >= _ = True 50 | NS# x >= NS# y = x >= y 51 | 52 | NJ xs < NJ ys = xs < ys 53 | _ < NJ{} = True 54 | NJ{} < _ = False 55 | NS# x < NS# y = x < y 56 | 57 | NJ xs > NJ ys = xs > ys 58 | _ > NJ{} = False 59 | NJ{} > _ = True 60 | NS# x > NS# y = x > y 61 | 62 | compare (NJ xs) (NJ ys) = compare xs ys 63 | compare _ NJ{} = LT 64 | compare NJ{} _ = GT 65 | compare (NS# x) (NS# y) = compare x y 66 | 67 | min (NJ xs) (NJ ys) = NJ (min xs ys) 68 | min x NJ{} = x 69 | min NJ{} y = y 70 | min (NS# x) (NS# y) = NS# (min x y) 71 | 72 | max (NJ xs) (NJ ys) = NJ (max xs ys) 73 | max _ (NJ ys) = NJ ys 74 | max (NJ xs) _ = NJ xs 75 | max (NS# x) (NS# y) = NS# (max x y) 76 | 77 | isNullBigNat# :: BigNat# -> Int# 78 | isNullBigNat# n = coerce GHC.bigNatSize# n ==# 0# 79 | 80 | isNullBigNat :: BigNat# -> Bool 81 | isNullBigNat n = isTrue# (isNullBigNat# n) 82 | 83 | nullBigNat# :: (# #) -> BigNat# 84 | nullBigNat# = coerce GHC.bigNatZero# 85 | 86 | pattern Small :: BigNat# 87 | pattern Small <- (isNullBigNat -> True) where 88 | Small = nullBigNat# void# 89 | 90 | pattern Big :: Word# 91 | pattern Big = 18446744073709551615## 92 | 93 | pattern N :: Word# -> BigNat# -> Natural# 94 | pattern N w ws = Natural# (# w, ws #) 95 | 96 | {-# complete N :: Natural# #-} 97 | 98 | pattern NS :: Word# -> Natural# 99 | pattern NS w = N w Small 100 | 101 | pattern NJ :: BigNat# -> Natural# 102 | pattern NJ ws = N Big ws 103 | 104 | {-# complete NJ, NS :: Natural# #-} 105 | 106 | -- overlaps the pattern for NJ, so only use _after_ NJ. 107 | -- or when we know 'w' isnt Big 108 | pattern NS# :: Word# -> Natural# 109 | pattern NS# w <- N w _ where 110 | NS# w = N w (nullBigNat# void#) 111 | 112 | {-# complete NJ, NS# :: Natural# #-} 113 | 114 | isValidNatural# :: Natural# -> Int# 115 | isValidNatural# (N w ws) = case coerce GHC.bigNatSize# ws of 116 | 0# -> neWord# Big w 117 | 1# -> bigNatCheck# ws &&# eqWord# Big (bigNatToWord# ws) 118 | _ -> bigNatCheck# ws 119 | 120 | isValidNatural :: Natural# -> Bool 121 | isValidNatural n = isTrue# (isValidNatural# n) 122 | 123 | signumNatural# :: Natural# -> Natural# 124 | signumNatural# (NS# 0##) = NS 0## 125 | signumNatural# _ = NS 1## 126 | {-# CONSTANT_FOLDED signumNatural# #-} 127 | 128 | negateNatural# :: Natural# -> Natural# 129 | negateNatural# (NS# 0##) = NS 0## 130 | negateNatural# _ = raise# Underflow 131 | {-# CONSTANT_FOLDED negateNatural# #-} 132 | 133 | data BigNat = BigNat { getBigNat :: BigNat# } 134 | 135 | big :: BigNat 136 | big = BigNat (bigNatFromWord# Big) 137 | {-# NOINLINE big #-} 138 | 139 | -- | 'Natural' Addition 140 | addNatural# :: Natural# -> Natural# -> Natural# 141 | addNatural# (NS# 0##) y = y 142 | addNatural# x (NS# 0##) = x 143 | addNatural# (NJ xs) (NJ ys) = NJ (xs + ys) 144 | addNatural# (NJ xs) (NS# y) = NJ (coerce bigNatAddWord# xs y) 145 | addNatural# (NS# x) (NJ ys) = NJ (coerce bigNatAddWord# ys x) 146 | addNatural# (NS# x) (NS# y) = case plusWord2# x y of 147 | (# 0##, Big #) -> NJ (getBigNat big) 148 | (# 0##, l #) -> NS l 149 | (# h, l #) -> NJ (bigNatFromWord2# h l) 150 | {-# CONSTANT_FOLDED addNatural# #-} 151 | 152 | -- | 'Natural' multiplication 153 | mulNatural# :: Natural# -> Natural# -> Natural# 154 | mulNatural# _ (NS# 0##) = NS# 0## 155 | mulNatural# (NS# 0##) _ = NS# 0## 156 | mulNatural# x (NS# 1##) = x 157 | mulNatural# (NS# 1##) y = y 158 | mulNatural# (NJ xs) (NJ ys) = NJ (xs * ys) 159 | mulNatural# (NJ xs) (NS# y) = NJ (coerce bigNatMulWord# xs y) 160 | mulNatural# (NS# x) (NJ ys) = NJ (coerce bigNatMulWord# ys x) 161 | mulNatural# (NS# x) (NS# y) = case timesWord2# x y of 162 | (# 0##, Big #) -> NJ (getBigNat big) 163 | (# 0##, xy #) -> NS xy 164 | (# h , l #) -> NJ (bigNatFromWord2# h l) 165 | {-# CONSTANT_FOLDED mulNatural# #-} 166 | 167 | -- | 'Natural' subtraction. May @'Control.Exception.throw' 168 | -- 'Control.Exception.Underflow'@. 169 | subNatural# :: Natural# -> Natural# -> Natural# 170 | subNatural# x (NS# 0##) = x 171 | subNatural# (NJ xs) (NJ ys) = naturalFromBigNat# (xs - ys) 172 | subNatural# (NJ xs) (NS# y) = naturalFromBigNat# (bigNatSubWordUnsafe# xs y) 173 | subNatural# _ NJ{} = raise# Underflow 174 | subNatural# (NS# x) (NS# y) = case subWordC# x y of 175 | (# l, 0# #) -> NS l 176 | _ -> raise# Underflow 177 | {-# CONSTANT_FOLDED subNatural# #-} 178 | 179 | naturalFromInteger# :: Integer -> Natural# 180 | naturalFromInteger# (IS i#) 181 | | i# >= 0# = NS# (int2Word# i#) 182 | naturalFromInteger# (IP bn) = naturalFromBigNat# (BigNat# bn) 183 | naturalFromInteger# _ = raise# Underflow 184 | {-# CONSTANT_FOLDED naturalFromInteger# #-} 185 | 186 | naturalToInteger# :: Natural# -> Integer 187 | naturalToInteger# (NJ (BigNat# bn)) = IP bn 188 | naturalToInteger# (NS# w) = wordToInteger w 189 | {-# CONSTANT_FOLDED naturalToInteger# #-} 190 | 191 | -- | Convert 'BigNat' to 'Natural'. 192 | naturalFromBigNat# :: BigNat# -> Natural# 193 | naturalFromBigNat# bn = case bigNatSize# bn of 194 | 0# -> NS# 0## 195 | 1# -> case bigNatToWord# bn of 196 | Big -> NJ bn 197 | w# -> NS# w# 198 | _ -> NJ bn 199 | {-# CONSTANT_FOLDED naturalFromBigNat# #-} 200 | 201 | instance Num Natural# where 202 | (+) = addNatural# 203 | {-# inline (+) #-} 204 | (-) = subNatural# 205 | {-# inline (-) #-} 206 | (*) = mulNatural# 207 | {-# inline (*) #-} 208 | negate = negateNatural# 209 | {-# inline negate #-} 210 | abs x = x 211 | {-# inline abs #-} 212 | signum = signumNatural# 213 | {-# inline signum #-} 214 | fromInteger = naturalFromInteger# 215 | {-# inline fromInteger #-} 216 | 217 | instance Show Natural# where 218 | showsPrec d (NJ ws) = showsPrec d ws 219 | showsPrec d (NS# w) = showsPrec d w 220 | -------------------------------------------------------------------------------- /src/Unboxed/Levitation.hs: -------------------------------------------------------------------------------- 1 | module Unboxed.Levitation 2 | ( Lev 3 | ) where 4 | 5 | import Unboxed.Internal.Levitation 6 | -------------------------------------------------------------------------------- /src/Unboxed/List.hs: -------------------------------------------------------------------------------- 1 | module Unboxed.List 2 | ( List 3 | , ListD 4 | , ListRep(..) 5 | ) where 6 | 7 | import Unboxed.Class () 8 | import Unboxed.Internal.List 9 | 10 | -------------------------------------------------------------------------------- /src/Unboxed/Maybe.hs: -------------------------------------------------------------------------------- 1 | {-# Language MagicHash #-} 2 | {-# Language NoImplicitPrelude #-} 3 | module Unboxed.Maybe 4 | ( Maybe 5 | , MaybeD 6 | , MaybeRep(..) 7 | , Maybe#(..) 8 | , MaybeRep#(..) 9 | ) where 10 | 11 | import Unboxed.Class () 12 | import Unboxed.Internal.Maybe 13 | -------------------------------------------------------------------------------- /src/Unboxed/Natural.hs: -------------------------------------------------------------------------------- 1 | {-# Language MagicHash #-} 2 | module Unboxed.Natural 3 | ( Natural# 4 | ) where 5 | 6 | import Unboxed.Internal.Natural 7 | -------------------------------------------------------------------------------- /src/Unboxed/Prelude.hs: -------------------------------------------------------------------------------- 1 | {-# Language MagicHash #-} 2 | -- eventually provide a Prelude alternative that is overloaded to allow unlifted operations where possible 3 | 4 | module Unboxed.Prelude 5 | ( 6 | -- * Classes 7 | module Unboxed.Class 8 | , module Unboxed.Levitation 9 | , module Unboxed.List 10 | , module Unboxed.Maybe 11 | -- * Automatically levitating if then else syntax 12 | , ifThenElse 13 | -- * Printing unlifted values 14 | , PrintRep(hPrint) 15 | -- * Unboxed.Combinators 16 | , id 17 | , const 18 | -- * Standard Prelude types 19 | , Bool(..), (&&), (||), not, otherwise 20 | , Ordering(..) 21 | , undefined 22 | , error 23 | , ($) -- has a magic rule we can't beat 24 | 25 | -- unlifted numerics 26 | , Natural# 27 | , Int#, Int8#, Int16#, Int32#, Int64# 28 | , Word#, Word8#, Word16#, Word32#, Word64# 29 | , Float#, Double# 30 | ) where 31 | 32 | import GHC.Prim 33 | import Unboxed.Class 34 | import Unboxed.Combinators 35 | import Unboxed.Levitation 36 | import Unboxed.List 37 | import Unboxed.Maybe 38 | import Unboxed.Natural 39 | import Unboxed.Syntax 40 | import Prelude 41 | ( Bool(..) 42 | , (&&), (||), not, otherwise 43 | , Ordering(..) 44 | , undefined 45 | , error 46 | , ($) 47 | ) 48 | -------------------------------------------------------------------------------- /src/Unboxed/Rep/Addr.hs: -------------------------------------------------------------------------------- 1 | {-# Language NoImplicitPrelude #-} 2 | {-# Language RebindableSyntax #-} 3 | {-# Language MagicHash #-} 4 | {-# Language KindSignatures #-} 5 | {-# Language DataKinds #-} 6 | {-# Language TypeSynonymInstances #-} 7 | {-# Language ImportQualifiedPost #-} 8 | {-# OPTIONS_GHC -Wno-orphans #-} 9 | 10 | module Unboxed.Rep.Addr 11 | ( module Def.Addr 12 | , eqAddr, neAddr, ltAddr, leAddr, gtAddr, geAddr 13 | , Addr# 14 | , StablePtr# 15 | ) where 16 | 17 | import Unboxed.Internal.Class 18 | import GHC.Prim 19 | import GHC.Types 20 | 21 | import Def.Addr 22 | 23 | eqAddr, neAddr, ltAddr, leAddr, gtAddr, geAddr :: Addr# -> Addr# -> Bool 24 | eqAddr x y = isTrue# (eqAddr# x y) 25 | {-# INLINE [1] eqAddr #-} 26 | neAddr x y = isTrue# (neAddr# x y) 27 | {-# INLINE [1] neAddr #-} 28 | ltAddr x y = isTrue# (ltAddr# x y) 29 | {-# INLINE [1] ltAddr #-} 30 | gtAddr x y = isTrue# (gtAddr# x y) 31 | {-# INLINE [1] gtAddr #-} 32 | leAddr x y = isTrue# (leAddr# x y) 33 | {-# INLINE [1] leAddr #-} 34 | geAddr x y = isTrue# (geAddr# x y) 35 | {-# INLINE [1] geAddr #-} 36 | 37 | instance Eq Addr# where 38 | (==) = eqAddr 39 | (/=) = neAddr 40 | 41 | instance Ord Addr# where 42 | (<=) = leAddr 43 | (>=) = geAddr 44 | (<) = ltAddr 45 | (>) = gtAddr 46 | 47 | instance Eq (StablePtr# a) where 48 | x == y = isTrue# (eqStablePtr# x y) 49 | -------------------------------------------------------------------------------- /src/Unboxed/Rep/Double.hs: -------------------------------------------------------------------------------- 1 | {-# Language NoImplicitPrelude #-} 2 | {-# Language RebindableSyntax #-} 3 | {-# Language MagicHash #-} 4 | {-# Language KindSignatures #-} 5 | {-# Language DataKinds #-} 6 | {-# Language TypeSynonymInstances #-} 7 | {-# Language ImportQualifiedPost #-} 8 | {-# OPTIONS_GHC -Wno-orphans #-} 9 | 10 | -- | exposes detailed names that can be used for RULES 11 | module Unboxed.Rep.Double 12 | ( module Def.Double 13 | , eqDouble, neDouble, ltDouble, leDouble, gtDouble, geDouble 14 | , Double# 15 | ) where 16 | 17 | import Unboxed.Internal.Class 18 | import GHC.Prim 19 | import GHC.Num.Integer 20 | import GHC.Types 21 | import Prelude (otherwise) 22 | 23 | import Def.Double 24 | 25 | eqDouble, neDouble, ltDouble, leDouble, gtDouble, geDouble :: Double# -> Double# -> Bool 26 | eqDouble x y = isTrue# (x ==## y) 27 | {-# INLINE [1] eqDouble #-} 28 | neDouble x y = isTrue# (x /=## y) 29 | {-# INLINE [1] neDouble #-} 30 | ltDouble x y = isTrue# (x <## y) 31 | {-# INLINE [1] ltDouble #-} 32 | gtDouble x y = isTrue# (x >## y) 33 | {-# INLINE [1] gtDouble #-} 34 | leDouble x y = isTrue# (x <=## y) 35 | {-# INLINE [1] leDouble #-} 36 | geDouble x y = isTrue# (x >=## y) 37 | {-# INLINE [1] geDouble #-} 38 | 39 | instance Eq Double# where 40 | (==) = eqDouble 41 | (/=) = neDouble 42 | 43 | instance Ord Double# where 44 | (<=) = leDouble 45 | (>=) = geDouble 46 | (<) = ltDouble 47 | (>) = gtDouble 48 | 49 | instance Num Double# where 50 | (+) = (+##) 51 | (-) = (-##) 52 | (*) = (*##) 53 | negate = negateDouble# 54 | abs n 55 | | n >= 0 = n 56 | | otherwise = negate n 57 | signum n 58 | | n < 0 = negate 1 59 | | n == 0 = 0 60 | | otherwise = 1 61 | fromInteger n = integerEncodeDouble# n 0# 62 | {-# INLINE fromInteger #-} 63 | 64 | instance Fractional Double# where 65 | (/) = (/##) 66 | recip = (/) 1.0## 67 | fromRational r = case fromRational r of 68 | D# f -> f 69 | 70 | instance Real Double# where 71 | toRational f = toRational (D# f) 72 | -------------------------------------------------------------------------------- /src/Unboxed/Rep/Float.hs: -------------------------------------------------------------------------------- 1 | {-# Language NoImplicitPrelude #-} 2 | {-# Language RebindableSyntax #-} 3 | {-# Language MagicHash #-} 4 | {-# Language KindSignatures #-} 5 | {-# Language DataKinds #-} 6 | {-# Language TypeSynonymInstances #-} 7 | {-# Language ImportQualifiedPost #-} 8 | {-# OPTIONS_GHC -Wno-orphans #-} 9 | 10 | -- | exposes detailed names that can be used for RULES 11 | module Unboxed.Rep.Float 12 | ( module Def.Float 13 | , eqFloat, neFloat, ltFloat, leFloat, gtFloat, geFloat 14 | , Float# 15 | ) where 16 | 17 | import GHC.Num.Integer 18 | import GHC.Prim 19 | import GHC.Types 20 | import Prelude (otherwise) 21 | import Unboxed.Internal.Class 22 | 23 | import Def.Float 24 | 25 | eqFloat, neFloat, ltFloat, leFloat, gtFloat, geFloat :: Float# -> Float# -> Bool 26 | eqFloat x y = isTrue# (eqFloat# x y) 27 | {-# INLINE [1] eqFloat #-} 28 | neFloat x y = isTrue# (neFloat# x y) 29 | {-# INLINE [1] neFloat #-} 30 | ltFloat x y = isTrue# (ltFloat# x y) 31 | {-# INLINE [1] ltFloat #-} 32 | gtFloat x y = isTrue# (gtFloat# x y) 33 | {-# INLINE [1] gtFloat #-} 34 | leFloat x y = isTrue# (leFloat# x y) 35 | {-# INLINE [1] leFloat #-} 36 | geFloat x y = isTrue# (geFloat# x y) 37 | {-# INLINE [1] geFloat #-} 38 | 39 | instance Eq Float# where 40 | (==) = eqFloat 41 | (/=) = neFloat 42 | 43 | instance Ord Float# where 44 | (<=) = leFloat 45 | (>=) = geFloat 46 | (<) = ltFloat 47 | (>) = gtFloat 48 | 49 | instance Num Float# where 50 | (+) = plusFloat# 51 | (-) = minusFloat# 52 | (*) = timesFloat# 53 | negate = negateFloat# 54 | abs n 55 | | n >= 0 = n 56 | | otherwise = negate n 57 | signum n 58 | | n < 0 = negate 1 59 | | n == 0 = 0 60 | | otherwise = 1 61 | fromInteger n = integerEncodeFloat# n 0# 62 | {-# INLINE fromInteger #-} 63 | 64 | instance Fractional Float# where 65 | (/) = divideFloat# 66 | recip = (/) 1.0# 67 | fromRational r = case fromRational r of 68 | F# f -> f 69 | 70 | instance Real Float# where 71 | toRational f = toRational (F# f) 72 | -------------------------------------------------------------------------------- /src/Unboxed/Rep/Int.hs: -------------------------------------------------------------------------------- 1 | {-# Language NoImplicitPrelude #-} 2 | {-# Language RebindableSyntax #-} 3 | {-# Language MagicHash #-} 4 | {-# Language KindSignatures #-} 5 | {-# Language DataKinds #-} 6 | {-# Language TypeSynonymInstances #-} 7 | {-# Language ImportQualifiedPost #-} 8 | {-# OPTIONS_GHC -Wno-orphans #-} 9 | 10 | -- | exposes detailed names that can be used for RULES 11 | module Unboxed.Rep.Int 12 | ( module Def.Int 13 | , eqInt, neInt, ltInt, leInt, gtInt, geInt 14 | , Int# 15 | ) where 16 | 17 | import Unboxed.Internal.Class 18 | import GHC.Prim 19 | import GHC.Integer 20 | import GHC.Types 21 | import Prelude (otherwise) 22 | import Prelude qualified 23 | 24 | import Def.Int 25 | 26 | eqInt, neInt, ltInt, leInt, gtInt, geInt :: Int# -> Int# -> Bool 27 | eqInt x y = isTrue# (x ==# y) 28 | {-# INLINE [1] eqInt #-} 29 | neInt x y = isTrue# (x /=# y) 30 | {-# INLINE [1] neInt #-} 31 | ltInt x y = isTrue# (x <# y) 32 | {-# INLINE [1] ltInt #-} 33 | gtInt x y = isTrue# (x ># y) 34 | {-# INLINE [1] gtInt #-} 35 | leInt x y = isTrue# (x <=# y) 36 | {-# INLINE [1] leInt #-} 37 | geInt x y = isTrue# (x >=# y) 38 | {-# INLINE [1] geInt #-} 39 | 40 | instance Eq Int# where 41 | (==) = eqInt 42 | (/=) = neInt 43 | 44 | instance Ord Int# where 45 | (<=) = leInt 46 | (>=) = geInt 47 | (<) = ltInt 48 | (>) = gtInt 49 | 50 | instance Bounded Int# where 51 | minBound = case Prelude.minBound of I# i -> i 52 | maxBound = case Prelude.maxBound of I# i -> i 53 | 54 | instance Num Int# where 55 | (+) = (+#) 56 | (-) = (-#) 57 | (*) = (*#) 58 | negate = negateInt# 59 | abs n 60 | | n >= 0 = n 61 | | otherwise = negate n 62 | signum n 63 | | n < 0 = negate 1 64 | | n == 0 = 0 65 | | otherwise = 1 66 | fromInteger = integerToInt 67 | {-# INLINE fromInteger #-} 68 | 69 | instance Show Int# where 70 | showsPrec d a = showsPrec d (I# a) 71 | {-# INLINE showsPrec #-} 72 | -------------------------------------------------------------------------------- /src/Unboxed/Rep/Int8.hs: -------------------------------------------------------------------------------- 1 | {-# Language NoImplicitPrelude #-} 2 | {-# Language RebindableSyntax #-} 3 | {-# Language MagicHash #-} 4 | {-# Language KindSignatures #-} 5 | {-# Language PolyKinds #-} 6 | {-# Language UnboxedTuples #-} 7 | {-# Language BangPatterns #-} 8 | {-# Language DataKinds #-} 9 | {-# Language RankNTypes #-} 10 | {-# Language TypeSynonymInstances #-} 11 | {-# Language ImportQualifiedPost #-} 12 | {-# OPTIONS_GHC -Wno-orphans #-} 13 | 14 | -- | exposes detailed names that can be used for RULES 15 | module Unboxed.Rep.Int8 16 | ( module Def.Int8 17 | , eqInt8, neInt8, ltInt8, leInt8, gtInt8, geInt8 18 | , Int8# 19 | ) where 20 | 21 | import Unboxed.Internal.Class 22 | -- import GHC.Enum (succError, predError) 23 | import GHC.Exception 24 | import GHC.Int (Int8(..)) 25 | import GHC.Prim 26 | import GHC.Real ((%)) 27 | import GHC.Num.Integer 28 | import GHC.Types 29 | import Prelude (otherwise, (&&), String, (++), errorWithoutStackTrace, ($)) 30 | 31 | import Def.Int8 32 | 33 | eqInt8, neInt8, ltInt8, leInt8, gtInt8, geInt8 :: Int8# -> Int8# -> Bool 34 | eqInt8 x y = isTrue# (int8ToInt# x ==# int8ToInt# y) 35 | {-# INLINE [1] eqInt8 #-} 36 | neInt8 x y = isTrue# (int8ToInt# x /=# int8ToInt# y) 37 | {-# INLINE [1] neInt8 #-} 38 | ltInt8 x y = isTrue# (int8ToInt# x <# int8ToInt# y) 39 | {-# INLINE [1] ltInt8 #-} 40 | gtInt8 x y = isTrue# (int8ToInt# x ># int8ToInt# y) 41 | {-# INLINE [1] gtInt8 #-} 42 | leInt8 x y = isTrue# (int8ToInt# x <=# int8ToInt# y) 43 | {-# INLINE [1] leInt8 #-} 44 | geInt8 x y = isTrue# (int8ToInt# x >=# int8ToInt# y) 45 | {-# INLINE [1] geInt8 #-} 46 | 47 | instance Eq Int8# where 48 | (==) = eqInt8 49 | (/=) = neInt8 50 | 51 | instance Ord Int8# where 52 | (<=) = leInt8 53 | (>=) = geInt8 54 | (<) = ltInt8 55 | (>) = gtInt8 56 | 57 | instance Bounded Int8# where 58 | minBound = 127 59 | maxBound = -128 60 | 61 | instance Num Int8# where 62 | (+) = plusInt8# 63 | (-) = subInt8# 64 | (*) = timesInt8# 65 | negate = negateInt8# 66 | abs x 67 | | x >= 0 = x 68 | | otherwise = negate x 69 | signum x | x > 0 = 1 70 | signum 0 = 0 71 | signum _ = -1 72 | fromInteger i = intToInt8# (integerToInt# i) 73 | {-# INLINE fromInteger #-} 74 | 75 | instance Show Int8# where 76 | showsPrec d a = showsPrec d (I8# a) 77 | {-# INLINE showsPrec #-} 78 | 79 | {-# INLINE [0] divInt8# #-} 80 | divInt8# :: Int8# -> Int8# -> Int8# 81 | divInt8# x# y# = ((x# `plusInt8#` bias#) `quotInt8#` y#) `subInt8#` hard# where 82 | zero# = intToInt8# 0# 83 | x `andInt8#` y = word8ToInt8# (int8ToWord8# x `andWord8#` int8ToWord8# y) 84 | x `orInt8#` y = word8ToInt8# (int8ToWord8# x `orWord8#` int8ToWord8# y) 85 | notInt8# x = word8ToInt8# (notWord8# (int8ToWord8# x)) 86 | -- See Note [divInt# implementation] 87 | !yn# = intToInt8# (y# `ltInt8#` zero#) 88 | !c0# = intToInt8# (x# `ltInt8#` zero#) `andInt8#` (notInt8# yn#) 89 | !c1# = intToInt8# (x# `gtInt8#` zero#) `andInt8#` yn# 90 | !bias# = c0# `subInt8#` c1# 91 | !hard# = c0# `orInt8#` c1# 92 | 93 | {-# INLINE [0] modInt8# #-} 94 | modInt8# :: Int8# -> Int8# -> Int8# 95 | modInt8# x# y# = r# `plusInt8#` k# where 96 | zero# = intToInt8# 0# 97 | x `andInt8#` y = word8ToInt8# (int8ToWord8# x `andWord8#` int8ToWord8# y) 98 | x `orInt8#` y = word8ToInt8# (int8ToWord8# x `orWord8#` int8ToWord8# y) 99 | notInt8# x = word8ToInt8# (notWord8# (int8ToWord8# x)) 100 | -- See Note [modInt# implementation] 101 | !yn# = intToInt8# (y# `ltInt8#` zero#) 102 | !c0# = intToInt8# (x# `ltInt8#` zero#) `andInt8#` (notInt8# yn#) 103 | !c1# = intToInt8# (x# `gtInt8#` zero#) `andInt8#` yn# 104 | !s# = zero# `subInt8#` ((c0# `orInt8#` c1#) `andInt8#` (intToInt8# (r# `neInt8#` zero#))) 105 | !k# = s# `andInt8#` y# 106 | !r# = x# `remInt8#` y# 107 | 108 | {-# INLINE [0] divModInt8# #-} 109 | divModInt8# :: Int8# -> Int8# -> (# Int8#, Int8# #) 110 | divModInt8# x# y# = case (x# `plusInt8#` bias#) `quotRemInt8#` y# of 111 | (# q#, r# #) -> (# q# `subInt8#` hard#, r# `plusInt8#` k# #) 112 | where 113 | zero# = intToInt8# 0# 114 | x `andInt8#` y = word8ToInt8# (int8ToWord8# x `andWord8#` int8ToWord8# y) 115 | x `orInt8#` y = word8ToInt8# (int8ToWord8# x `orWord8#` int8ToWord8# y) 116 | notInt8# x = word8ToInt8# (notWord8# (int8ToWord8# x)) 117 | -- See Note [divModInt# implementation] 118 | !yn# = intToInt8# (y# `ltInt8#` zero#) 119 | !c0# = intToInt8# (x# `ltInt8#` zero#) `andInt8#` (notInt8# yn#) 120 | !c1# = intToInt8# (x# `gtInt8#` zero#) `andInt8#` yn# 121 | !bias# = c0# `subInt8#` c1# 122 | !hard# = c0# `orInt8#` c1# 123 | !s# = zero# `subInt8#` hard# 124 | !k# = (s# `andInt8#` y#) `subInt8#` bias# 125 | 126 | 127 | {-# NOINLINE succError# #-} 128 | succError# :: forall r (a :: TYPE r). String -> a 129 | succError# inst_ty = 130 | errorWithoutStackTrace $ "Enum.succ{" ++ inst_ty ++ "}: tried to take `succ' of maxBound" 131 | 132 | {-# NOINLINE predError# #-} 133 | predError# :: forall r (a :: TYPE r). String -> a 134 | predError# inst_ty = 135 | errorWithoutStackTrace $ "Enum.pred{" ++ inst_ty ++ "}: tried to take `pred' of minBound" 136 | 137 | instance Enum Int8# where 138 | succ x 139 | | x /= maxBound = x + 1 140 | | otherwise = succError# "Int8#" 141 | pred x 142 | | x /= minBound = x - 1 143 | | otherwise = predError# "Int8#" 144 | toEnum i@(I# i#) 145 | | isTrue# (i# >=# int8ToInt# minBound) && isTrue# (i# <=# int8ToInt# maxBound) = intToInt8# i# 146 | | otherwise = errorWithoutStackTrace $ 147 | "Enum.toEnum{Int8#}: tag (" ++ show i ++ ") is outside of bounds (# " ++ 148 | show (minBound :: Int8) ++ ", " ++ show (maxBound :: Int8) ++ " #)" 149 | fromEnum x# = I# (int8ToInt# x#) 150 | 151 | instance Real Int8# where 152 | toRational x = toInteger x % 1 153 | 154 | instance Integral Int8# where 155 | quot x# y# 156 | | y# == 0 = throw divZeroException 157 | | y# == (-1) && x# == minBound = throw overflowException 158 | | otherwise = quotInt8# x# y# 159 | rem x# y# 160 | | y# == 0 = throw divZeroException 161 | | y# == (-1) = 0 162 | | otherwise = remInt8# x# y# 163 | div x# y# 164 | | y# == 0 = throw divZeroException 165 | | y# == (-1) && x# == minBound = throw overflowException -- Note [Order of tests] 166 | | otherwise = divInt8# x# y# 167 | mod x# y# 168 | | y# == 0 = throw divZeroException 169 | | y# == (-1) = 0 170 | | otherwise = modInt8# x# y# 171 | quotRem x# y# 172 | | y# == 0 = throw divZeroException 173 | | y# == (-1) && x# == minBound = throw overflowException 174 | | otherwise = quotRemInt8# x# y# 175 | divMod x# y# 176 | | y# == 0 = throw divZeroException 177 | | y# == (-1) && x# == minBound = throw overflowException 178 | | otherwise = divModInt8# x# y# 179 | toInteger x# = IS (int8ToInt# x#) 180 | -------------------------------------------------------------------------------- /src/Unboxed/Rep/Lifted.hs: -------------------------------------------------------------------------------- 1 | {-# Language UnboxedSums #-} 2 | {-# Language KindSignatures #-} 3 | {-# Language PatternSynonyms #-} 4 | {-# Language MagicHash #-} 5 | {-# Language RankNTypes #-} 6 | 7 | module Unboxed.Rep.Lifted 8 | ( pattern Nothing# 9 | , pattern Just# 10 | , pattern Nil 11 | , pattern (:#) 12 | ) where 13 | 14 | import Unboxed.Internal.Maybe hiding (Maybe) 15 | import Unboxed.Internal.List 16 | import GHC.Types (Type) 17 | 18 | pattern Nothing# :: forall (a :: Type). Maybe# a 19 | pattern Nothing# = Maybe# (# (##) | #) 20 | 21 | pattern Just# :: forall (a :: Type). a -> Maybe# a 22 | pattern Just# a = Maybe# (# | a #) 23 | 24 | pattern Nil :: forall (a :: Type). List a 25 | pattern Nil = [] 26 | 27 | pattern (:#) :: forall (a :: Type). a -> List a -> List a 28 | pattern x :# xs = x : xs 29 | 30 | -------------------------------------------------------------------------------- /src/Unboxed/Rep/Tuple.hs: -------------------------------------------------------------------------------- 1 | {-# Language DataKinds #-} 2 | {-# Language FlexibleInstances #-} 3 | {-# Language ImportQualifiedPost #-} 4 | {-# Language KindSignatures #-} 5 | {-# Language MagicHash #-} 6 | {-# Language NoImplicitPrelude #-} 7 | {-# Language PolyKinds #-} 8 | {-# Language RebindableSyntax #-} 9 | {-# Language TypeApplications #-} 10 | {-# Language TypeFamilies #-} 11 | {-# Language TypeSynonymInstances #-} 12 | {-# Language UnboxedTuples #-} 13 | {-# OPTIONS_GHC -Wno-orphans #-} 14 | 15 | module Unboxed.Rep.Tuple 16 | ( module Def.Tuple 17 | -- * Proxy# 18 | , Proxy# 19 | , proxy# 20 | , ProxyRep# 21 | -- * State# 22 | , State# 23 | ) where 24 | 25 | import Unboxed.Internal.Class 26 | import Unboxed.Internal.Rebind 27 | import GHC.Prim 28 | import GHC.Types 29 | import Prelude (showString) 30 | 31 | import Def.Tuple 32 | 33 | instance Eq (# #) where 34 | _ == _ = True 35 | _ /= _ = False 36 | 37 | instance Ord (# #) where 38 | _ <= _ = True 39 | _ >= _ = True 40 | _ < _ = False 41 | _ > _ = False 42 | compare _ _ = EQ 43 | min _ _ = (# #) 44 | max _ _ = (# #) 45 | 46 | instance Bounded (# #) where 47 | minBound = (# #) 48 | maxBound = (# #) 49 | 50 | instance Show (# #) where 51 | showsPrec _ _ = showString "(# #)" 52 | 53 | instance Eq (Proxy# a) where 54 | _ == _ = True 55 | _ /= _ = False 56 | 57 | instance Ord (Proxy# a) where 58 | _ <= _ = True 59 | _ >= _ = True 60 | _ < _ = False 61 | _ > _ = False 62 | compare _ _ = EQ 63 | min _ _ = proxy# 64 | max _ _ = proxy# 65 | 66 | instance Bounded (Proxy# a) where 67 | minBound = proxy# 68 | maxBound = proxy# 69 | 70 | class ProxyRep# (r :: RuntimeRep) 71 | instance ProxyRep# r 72 | 73 | type instance Rebind Proxy# r = Proxy# @(TYPE r) 74 | 75 | instance Functor Proxy# where 76 | type FunctorRep Proxy# = ProxyRep# 77 | fmap _ _ = proxy# 78 | 79 | instance Show (Proxy# a) where 80 | showsPrec _ _ = showString "proxy#" 81 | -------------------------------------------------------------------------------- /src/Unboxed/Rep/Unlifted.hs: -------------------------------------------------------------------------------- 1 | {-# Language NoImplicitPrelude #-} 2 | {-# Language RebindableSyntax #-} 3 | {-# Language MagicHash #-} 4 | {-# Language KindSignatures #-} 5 | {-# Language DataKinds #-} 6 | {-# Language TypeSynonymInstances #-} 7 | {-# Language UnboxedTuples #-} 8 | {-# Language UnboxedSums #-} 9 | {-# Language ImportQualifiedPost #-} 10 | {-# Language UnliftedNewtypes #-} 11 | {-# OPTIONS_GHC -Wno-orphans #-} 12 | 13 | module Unboxed.Rep.Unlifted 14 | ( module Def.Unlifted 15 | , MutableArray# 16 | , SmallMutableArray# 17 | , MutableByteArray# 18 | , MutableArrayArray# 19 | , MutVar# 20 | , MVar# 21 | , TVar# 22 | , StableName# 23 | , Weak# 24 | ) where 25 | 26 | import Def.Unlifted 27 | import GHC.Prim 28 | import GHC.Types 29 | import Unboxed.Internal.Class 30 | 31 | instance Eq (MutableArray# s a) where 32 | x == y = isTrue# (sameMutableArray# x y) 33 | {-# inline (==) #-} 34 | 35 | instance Eq (SmallMutableArray# s a) where 36 | x == y = isTrue# (sameSmallMutableArray# x y) 37 | {-# inline (==) #-} 38 | 39 | instance Eq (MutableByteArray# s) where 40 | x == y = isTrue# (sameMutableByteArray# x y) 41 | {-# inline (==) #-} 42 | 43 | instance Eq (MutableArrayArray# s) where 44 | x == y = isTrue# (sameMutableArrayArray# x y) 45 | {-# inline (==) #-} 46 | 47 | instance Eq (MutVar# s a) where 48 | x == y = isTrue# (sameMutVar# x y) 49 | {-# inline (==) #-} 50 | 51 | instance Eq (MVar# s a) where 52 | x == y = isTrue# (sameMVar# x y) 53 | {-# inline (==) #-} 54 | 55 | instance Eq (TVar# s a) where 56 | x == y = isTrue# (sameTVar# x y) 57 | {-# inline (==) #-} 58 | 59 | instance Eq (StableName# a) where 60 | x == y = isTrue# (eqStableName# x y) 61 | {-# inline (==) #-} 62 | -------------------------------------------------------------------------------- /src/Unboxed/Rep/Word.hs: -------------------------------------------------------------------------------- 1 | {-# Language NoImplicitPrelude #-} 2 | {-# Language RebindableSyntax #-} 3 | {-# Language MagicHash #-} 4 | {-# Language KindSignatures #-} 5 | {-# Language DataKinds #-} 6 | {-# Language TypeSynonymInstances #-} 7 | {-# Language ImportQualifiedPost #-} 8 | {-# OPTIONS_GHC -Wno-orphans #-} 9 | 10 | module Unboxed.Rep.Word 11 | ( module Def.Word 12 | , eqWord, neWord, ltWord, leWord, gtWord, geWord 13 | , eqChar, neChar, ltChar, leChar, gtChar, geChar 14 | , Word# 15 | , Char# 16 | ) where 17 | 18 | import Unboxed.Internal.Class 19 | import GHC.Prim 20 | import GHC.Integer 21 | import GHC.Types 22 | import Prelude qualified 23 | 24 | import Def.Word 25 | 26 | eqWord, neWord, ltWord, leWord, gtWord, geWord :: Word# -> Word# -> Bool 27 | eqWord x y = isTrue# (eqWord# x y) 28 | {-# INLINE [1] eqWord #-} 29 | neWord x y = isTrue# (neWord# x y) 30 | {-# INLINE [1] neWord #-} 31 | ltWord x y = isTrue# (ltWord# x y) 32 | {-# INLINE [1] ltWord #-} 33 | gtWord x y = isTrue# (gtWord# x y) 34 | {-# INLINE [1] gtWord #-} 35 | leWord x y = isTrue# (leWord# x y) 36 | {-# INLINE [1] leWord #-} 37 | geWord x y = isTrue# (geWord# x y) 38 | {-# INLINE [1] geWord #-} 39 | 40 | instance Eq Word# where 41 | (==) = eqWord 42 | (/=) = neWord 43 | 44 | instance Ord Word# where 45 | (<=) = leWord 46 | (>=) = geWord 47 | (<) = ltWord 48 | (>) = gtWord 49 | 50 | instance Bounded Word# where 51 | minBound = case Prelude.minBound of W# i -> i 52 | maxBound = case Prelude.maxBound of W# i -> i 53 | 54 | instance Num Word# where 55 | (+) = plusWord# 56 | (-) = minusWord# 57 | (*) = timesWord# 58 | negate x = int2Word# (negateInt# (word2Int# x)) 59 | abs x = x 60 | signum 0 = 0 61 | signum _ = 1 62 | fromInteger = integerToWord 63 | {-# INLINE fromInteger #-} 64 | 65 | instance Show Word# where 66 | showsPrec d a = showsPrec d (W# a) 67 | {-# INLINE showsPrec #-} 68 | 69 | eqChar, neChar, ltChar, leChar, gtChar, geChar :: Char# -> Char# -> Bool 70 | eqChar x y = isTrue# (eqChar# x y) 71 | {-# INLINE [1] eqChar #-} 72 | neChar x y = isTrue# (neChar# x y) 73 | {-# INLINE [1] neChar #-} 74 | ltChar x y = isTrue# (ltChar# x y) 75 | {-# INLINE [1] ltChar #-} 76 | gtChar x y = isTrue# (gtChar# x y) 77 | {-# INLINE [1] gtChar #-} 78 | leChar x y = isTrue# (leChar# x y) 79 | {-# INLINE [1] leChar #-} 80 | geChar x y = isTrue# (geChar# x y) 81 | {-# INLINE [1] geChar #-} 82 | 83 | instance Eq Char# where 84 | (==) = eqChar 85 | (/=) = neChar 86 | 87 | instance Ord Char# where 88 | (<=) = leChar 89 | (>=) = geChar 90 | (<) = ltChar 91 | (>) = gtChar 92 | 93 | instance Bounded Char# where 94 | minBound = '\0'# 95 | maxBound = '\x10FFFF'# 96 | -------------------------------------------------------------------------------- /src/Unboxed/Syntax.hs: -------------------------------------------------------------------------------- 1 | -- support for RebindableSyntax 2 | module Unboxed.Syntax 3 | ( ifThenElse 4 | ) where 5 | 6 | import Unboxed.Class () 7 | import Unboxed.Internal.Syntax 8 | -------------------------------------------------------------------------------- /unboxed.cabal: -------------------------------------------------------------------------------- 1 | cabal-version: 3.0 2 | name: unboxed 3 | version: 0.2 4 | synopsis: unboxed classes 5 | description: unboxed classes. 6 | homepage: https://github.com/ekmett/haskell 7 | license: BSD-2-Clause OR Apache-2.0 8 | license-file: LICENSE.md 9 | author: Edward Kmett 10 | maintainer: Edward Kmett 11 | copyright: Copyright (c) 2021 Edward Kmett 12 | stability: experimental 13 | category: Data Structures 14 | build-type: Simple 15 | extra-doc-files: 16 | README.md, 17 | CHANGELOG.md 18 | tested-with: 19 | GHC == 8.10.3 20 | 21 | source-repository head 22 | type: git 23 | location: https://github.com/ekmett/unboxed 24 | 25 | flag level2 26 | default: False 27 | manual: True 28 | description: construct reps for binary tuples and sums 29 | 30 | common minimal 31 | default-language: Haskell2010 32 | 33 | common base 34 | import: minimal 35 | build-depends: 36 | base >= 4.16.2 && < 5, 37 | ghc-bignum, 38 | ghc-prim 39 | 40 | -- enable warnings 41 | ghc-options: 42 | -Wall -Wincomplete-uni-patterns -Wincomplete-record-updates 43 | -Widentities -Wprepositive-qualified-module 44 | 45 | -- disable warnings 46 | ghc-options: 47 | -Wno-simplifiable-class-constraints -Wno-orphans -Wno-redundant-constraints 48 | 49 | library internal 50 | import: base 51 | hs-source-dirs: internal 52 | build-depends: linear-base 53 | exposed-modules: 54 | Unboxed.Internal.Levitation 55 | Unboxed.Internal.Class 56 | Unboxed.Internal.Combinators 57 | Unboxed.Internal.List 58 | Unboxed.Internal.Maybe 59 | Unboxed.Internal.Rebind 60 | Unboxed.Internal.Syntax 61 | Unboxed.Internal.Linear.Ur 62 | Unboxed.Internal.Linear 63 | 64 | AddrRep DoubleRep FloatRep 65 | IntRep Int8Rep Int16Rep Int32Rep Int64Rep 66 | LiftedRep UnliftedRep 67 | TupleRep 68 | WordRep Word8Rep Word16Rep Word32Rep Word64Rep 69 | 70 | NilReps 71 | 72 | -- DEFaults and DEFinitions 73 | library def 74 | import: base 75 | build-depends: internal 76 | hs-source-dirs: def 77 | signatures: Rep 78 | exposed-modules: Def 79 | 80 | library consreps 81 | import: base 82 | hs-source-dirs: consreps 83 | signatures: H T 84 | exposed-modules: ConsReps Tuple Sum 85 | 86 | library consdef 87 | import: minimal 88 | build-depends: consreps, def 89 | mixins: 90 | def (Def as Def.Tuple) requires (Rep as Tuple), 91 | def (Def as Def.Sum) requires (Rep as Sum) 92 | -- signatures: H T 93 | reexported-modules: 94 | Def.Tuple, 95 | Def.Sum, 96 | ConsReps as Def.Cons 97 | 98 | library 99 | import: base 100 | build-depends: consdef, def, internal 101 | hs-source-dirs: src 102 | exposed-modules: 103 | Unboxed.Prelude 104 | Unboxed.Class 105 | Unboxed.Combinators 106 | Unboxed.Syntax 107 | Unboxed.Maybe 108 | Unboxed.Natural 109 | Unboxed.Levitation 110 | Unboxed.List 111 | Unboxed.Internal.BigNat 112 | Unboxed.Internal.Natural 113 | Unboxed.Rep.Addr 114 | Unboxed.Rep.Double 115 | Unboxed.Rep.Float 116 | Unboxed.Rep.Int 117 | Unboxed.Rep.Int8 118 | Unboxed.Rep.Tuple 119 | Unboxed.Rep.Lifted 120 | Unboxed.Rep.Unlifted 121 | Unboxed.Rep.Word 122 | reexported-modules: 123 | Unboxed.Rep.Int16, 124 | Unboxed.Rep.Int32, 125 | Unboxed.Rep.Int64, 126 | Unboxed.Rep.Word8, 127 | Unboxed.Rep.Word16, 128 | Unboxed.Rep.Word32, 129 | Unboxed.Rep.Word64, 130 | Unboxed.Rep.Tuple1.Addr, 131 | Unboxed.Rep.Tuple1.Double, 132 | Unboxed.Rep.Tuple1.Float, 133 | Unboxed.Rep.Tuple1.Int, 134 | Unboxed.Rep.Tuple1.Int8, 135 | Unboxed.Rep.Tuple1.Int16, 136 | Unboxed.Rep.Tuple1.Int32, 137 | Unboxed.Rep.Tuple1.Int64, 138 | Unboxed.Rep.Tuple1.Lifted, 139 | Unboxed.Rep.Tuple1.Tuple0, 140 | Unboxed.Rep.Tuple1.Unlifted, 141 | Unboxed.Rep.Tuple1.Word, 142 | Unboxed.Rep.Tuple1.Word8, 143 | Unboxed.Rep.Tuple1.Word16, 144 | Unboxed.Rep.Tuple1.Word32, 145 | Unboxed.Rep.Tuple1.Word64, 146 | Unboxed.Rep.Tuple2.Word.Unlifted, 147 | Unboxed.Rep.Sum2.Word.Unlifted 148 | 149 | mixins: 150 | def (Def as Def.Addr) requires (Rep as AddrRep), 151 | def (Def as Def.Double) requires (Rep as DoubleRep), 152 | def (Def as Def.Float) requires (Rep as FloatRep), 153 | def (Def as Def.Int) requires (Rep as IntRep), 154 | def (Def as Def.Int8) requires (Rep as Int8Rep), 155 | def (Def as Unboxed.Rep.Int16) requires (Rep as Int16Rep), 156 | def (Def as Unboxed.Rep.Int32) requires (Rep as Int32Rep), 157 | def (Def as Unboxed.Rep.Int64) requires (Rep as Int64Rep), 158 | def (Def as Def.Unlifted) requires (Rep as UnliftedRep), 159 | def (Def as Def.Tuple) requires (Rep as TupleRep), 160 | def (Def as Def.Word) requires (Rep as WordRep), 161 | def (Def as Unboxed.Rep.Word8) requires (Rep as Word8Rep), 162 | def (Def as Unboxed.Rep.Word16) requires (Rep as Word16Rep), 163 | def (Def as Unboxed.Rep.Word32) requires (Rep as Word32Rep), 164 | def (Def as Unboxed.Rep.Word64) requires (Rep as Word64Rep), 165 | consdef (Def.Tuple as Unboxed.Rep.Tuple1.Addr, Def.Cons as Reps.Addr) requires (H as AddrRep, T as NilReps), 166 | consdef (Def.Tuple as Unboxed.Rep.Tuple1.Double, Def.Cons as Reps.Double) requires (H as DoubleRep, T as NilReps), 167 | consdef (Def.Tuple as Unboxed.Rep.Tuple1.Float, Def.Cons as Reps.Float) requires (H as FloatRep, T as NilReps), 168 | consdef (Def.Tuple as Unboxed.Rep.Tuple1.Lifted, Def.Cons as Reps.Lifted) requires (H as LiftedRep, T as NilReps), 169 | consdef (Def.Tuple as Unboxed.Rep.Tuple1.Unlifted, Def.Cons as Reps.Unlifted) requires (H as UnliftedRep, T as NilReps), 170 | consdef (Def.Tuple as Unboxed.Rep.Tuple1.Tuple0, Def.Cons as Reps.Tuple0) requires (H as TupleRep, T as NilReps), 171 | consdef (Def.Tuple as Unboxed.Rep.Tuple1.Int, Def.Cons as Reps.Int) requires (H as IntRep, T as NilReps), 172 | consdef (Def.Tuple as Unboxed.Rep.Tuple1.Int8, Def.Cons as Reps.Int8) requires (H as Int8Rep, T as NilReps), 173 | consdef (Def.Tuple as Unboxed.Rep.Tuple1.Int16, Def.Cons as Reps.Int16) requires (H as Int16Rep, T as NilReps), 174 | consdef (Def.Tuple as Unboxed.Rep.Tuple1.Int32, Def.Cons as Reps.Int32) requires (H as Int32Rep, T as NilReps), 175 | consdef (Def.Tuple as Unboxed.Rep.Tuple1.Int64, Def.Cons as Reps.Int64) requires (H as Int64Rep, T as NilReps), 176 | consdef (Def.Tuple as Unboxed.Rep.Tuple1.Word, Def.Cons as Reps.Word) requires (H as WordRep, T as NilReps), 177 | consdef (Def.Tuple as Unboxed.Rep.Tuple1.Word8, Def.Cons as Reps.Word8) requires (H as Word8Rep, T as NilReps), 178 | consdef (Def.Tuple as Unboxed.Rep.Tuple1.Word16, Def.Cons as Reps.Word16) requires (H as Word16Rep, T as NilReps), 179 | consdef (Def.Tuple as Unboxed.Rep.Tuple1.Word32, Def.Cons as Reps.Word32) requires (H as Word32Rep, T as NilReps), 180 | consdef (Def.Tuple as Unboxed.Rep.Tuple1.Word64, Def.Cons as Reps.Word64) requires (H as Word64Rep, T as NilReps), 181 | consdef (Def.Tuple as Unboxed.Rep.Tuple2.Word.Unlifted, Def.Sum as Unboxed.Rep.Sum2.Word.Unlifted, Def.Cons as Reps.Word.Unlifted) requires (H as WordRep, T as Reps.Unlifted), 182 | 183 | if flag(level2) 184 | cpp-options: -DUNBOXED_LEVEL2 185 | mixins: 186 | consdef (Def.Tuple as Unboxed.Rep.Tuple2.Addr.Addr, Def.Sum as Unboxed.Rep.Sum2.Addr.Addr, Def.Cons as Reps.Addr.Addr) requires (H as AddrRep, T as Reps.Addr), 187 | consdef (Def.Tuple as Unboxed.Rep.Tuple2.Double.Addr, Def.Sum as Unboxed.Rep.Sum2.Double.Addr, Def.Cons as Reps.Double.Addr) requires (H as DoubleRep, T as Reps.Addr), 188 | consdef (Def.Tuple as Unboxed.Rep.Tuple2.Float.Addr, Def.Sum as Unboxed.Rep.Sum2.Float.Addr, Def.Cons as Reps.Float.Addr) requires (H as FloatRep, T as Reps.Addr), 189 | consdef (Def.Tuple as Unboxed.Rep.Tuple2.Lifted.Addr, Def.Sum as Unboxed.Rep.Sum2.Lifted.Addr, Def.Cons as Reps.Lifted.Addr) requires (H as LiftedRep, T as Reps.Addr), 190 | consdef (Def.Tuple as Unboxed.Rep.Tuple2.Unlifted.Addr, Def.Sum as Unboxed.Rep.Sum2.Unlifted.Addr, Def.Cons as Reps.Unlifted.Addr) requires (H as UnliftedRep, T as Reps.Addr), 191 | consdef (Def.Tuple as Unboxed.Rep.Tuple2.Tuple0.Addr, Def.Sum as Unboxed.Rep.Sum2.Tuple0.Addr, Def.Cons as Reps.Tuple0.Addr) requires (H as TupleRep, T as Reps.Addr), 192 | consdef (Def.Tuple as Unboxed.Rep.Tuple2.Int.Addr, Def.Sum as Unboxed.Rep.Sum2.Int.Addr, Def.Cons as Reps.Int.Addr) requires (H as IntRep, T as Reps.Addr), 193 | consdef (Def.Tuple as Unboxed.Rep.Tuple2.Int8.Addr, Def.Sum as Unboxed.Rep.Sum2.Int8.Addr, Def.Cons as Reps.Int8.Addr) requires (H as Int8Rep, T as Reps.Addr), 194 | consdef (Def.Tuple as Unboxed.Rep.Tuple2.Int16.Addr, Def.Sum as Unboxed.Rep.Sum2.Int16.Addr, Def.Cons as Reps.Int16.Addr) requires (H as Int16Rep, T as Reps.Addr), 195 | consdef (Def.Tuple as Unboxed.Rep.Tuple2.Int32.Addr, Def.Sum as Unboxed.Rep.Sum2.Int32.Addr, Def.Cons as Reps.Int32.Addr) requires (H as Int32Rep, T as Reps.Addr), 196 | consdef (Def.Tuple as Unboxed.Rep.Tuple2.Int64.Addr, Def.Sum as Unboxed.Rep.Sum2.Int64.Addr, Def.Cons as Reps.Int64.Addr) requires (H as Int64Rep, T as Reps.Addr), 197 | consdef (Def.Tuple as Unboxed.Rep.Tuple2.Word.Addr, Def.Sum as Unboxed.Rep.Sum2.Word.Addr, Def.Cons as Reps.Word.Addr) requires (H as WordRep, T as Reps.Addr), 198 | consdef (Def.Tuple as Unboxed.Rep.Tuple2.Word8.Addr, Def.Sum as Unboxed.Rep.Sum2.Word8.Addr, Def.Cons as Reps.Word8.Addr) requires (H as Word8Rep, T as Reps.Addr), 199 | consdef (Def.Tuple as Unboxed.Rep.Tuple2.Word16.Addr, Def.Sum as Unboxed.Rep.Sum2.Word16.Addr, Def.Cons as Reps.Word16.Addr) requires (H as Word16Rep, T as Reps.Addr), 200 | consdef (Def.Tuple as Unboxed.Rep.Tuple2.Word32.Addr, Def.Sum as Unboxed.Rep.Sum2.Word32.Addr, Def.Cons as Reps.Word32.Addr) requires (H as Word32Rep, T as Reps.Addr), 201 | consdef (Def.Tuple as Unboxed.Rep.Tuple2.Word64.Addr, Def.Sum as Unboxed.Rep.Sum2.Word64.Addr, Def.Cons as Reps.Word64.Addr) requires (H as Word64Rep, T as Reps.Addr), 202 | 203 | consdef (Def.Tuple as Unboxed.Rep.Tuple2.Addr.Double, Def.Sum as Unboxed.Rep.Sum2.Addr.Double, Def.Cons as Reps.Addr.Double) requires (H as AddrRep, T as Reps.Double), 204 | consdef (Def.Tuple as Unboxed.Rep.Tuple2.Double.Double, Def.Sum as Unboxed.Rep.Sum2.Double.Double, Def.Cons as Reps.Double.Double) requires (H as DoubleRep, T as Reps.Double), 205 | consdef (Def.Tuple as Unboxed.Rep.Tuple2.Float.Double, Def.Sum as Unboxed.Rep.Sum2.Float.Double, Def.Cons as Reps.Float.Double) requires (H as FloatRep, T as Reps.Double), 206 | consdef (Def.Tuple as Unboxed.Rep.Tuple2.Lifted.Double, Def.Sum as Unboxed.Rep.Sum2.Lifted.Double, Def.Cons as Reps.Lifted.Double) requires (H as LiftedRep, T as Reps.Double), 207 | consdef (Def.Tuple as Unboxed.Rep.Tuple2.Unlifted.Double, Def.Sum as Unboxed.Rep.Sum2.Unlifted.Double, Def.Cons as Reps.Unlifted.Double) requires (H as UnliftedRep, T as Reps.Double), 208 | consdef (Def.Tuple as Unboxed.Rep.Tuple2.Tuple0.Double, Def.Sum as Unboxed.Rep.Sum2.Tuple0.Double, Def.Cons as Reps.Tuple0.Double) requires (H as TupleRep, T as Reps.Double), 209 | consdef (Def.Tuple as Unboxed.Rep.Tuple2.Int.Double, Def.Sum as Unboxed.Rep.Sum2.Int.Double, Def.Cons as Reps.Int.Double) requires (H as IntRep, T as Reps.Double), 210 | consdef (Def.Tuple as Unboxed.Rep.Tuple2.Int8.Double, Def.Sum as Unboxed.Rep.Sum2.Int8.Double, Def.Cons as Reps.Int8.Double) requires (H as Int8Rep, T as Reps.Double), 211 | consdef (Def.Tuple as Unboxed.Rep.Tuple2.Int16.Double, Def.Sum as Unboxed.Rep.Sum2.Int16.Double, Def.Cons as Reps.Int16.Double) requires (H as Int16Rep, T as Reps.Double), 212 | consdef (Def.Tuple as Unboxed.Rep.Tuple2.Int32.Double, Def.Sum as Unboxed.Rep.Sum2.Int32.Double, Def.Cons as Reps.Int32.Double) requires (H as Int32Rep, T as Reps.Double), 213 | consdef (Def.Tuple as Unboxed.Rep.Tuple2.Int64.Double, Def.Sum as Unboxed.Rep.Sum2.Int64.Double, Def.Cons as Reps.Int64.Double) requires (H as Int64Rep, T as Reps.Double), 214 | consdef (Def.Tuple as Unboxed.Rep.Tuple2.Word.Double, Def.Sum as Unboxed.Rep.Sum2.Word.Double, Def.Cons as Reps.Word.Double) requires (H as WordRep, T as Reps.Double), 215 | consdef (Def.Tuple as Unboxed.Rep.Tuple2.Word8.Double, Def.Sum as Unboxed.Rep.Sum2.Word8.Double, Def.Cons as Reps.Word8.Double) requires (H as Word8Rep, T as Reps.Double), 216 | consdef (Def.Tuple as Unboxed.Rep.Tuple2.Word16.Double, Def.Sum as Unboxed.Rep.Sum2.Word16.Double, Def.Cons as Reps.Word16.Double) requires (H as Word16Rep, T as Reps.Double), 217 | consdef (Def.Tuple as Unboxed.Rep.Tuple2.Word32.Double, Def.Sum as Unboxed.Rep.Sum2.Word32.Double, Def.Cons as Reps.Word32.Double) requires (H as Word32Rep, T as Reps.Double), 218 | consdef (Def.Tuple as Unboxed.Rep.Tuple2.Word64.Double, Def.Sum as Unboxed.Rep.Sum2.Word64.Double, Def.Cons as Reps.Word64.Double) requires (H as Word64Rep, T as Reps.Double), 219 | 220 | consdef (Def.Tuple as Unboxed.Rep.Tuple2.Addr.Float, Def.Sum as Unboxed.Rep.Sum2.Addr.Float, Def.Cons as Reps.Addr.Float) requires (H as AddrRep, T as Reps.Float), 221 | consdef (Def.Tuple as Unboxed.Rep.Tuple2.Double.Float, Def.Sum as Unboxed.Rep.Sum2.Double.Float, Def.Cons as Reps.Double.Float) requires (H as DoubleRep, T as Reps.Float), 222 | consdef (Def.Tuple as Unboxed.Rep.Tuple2.Float.Float, Def.Sum as Unboxed.Rep.Sum2.Float.Float, Def.Cons as Reps.Float.Float) requires (H as FloatRep, T as Reps.Float), 223 | consdef (Def.Tuple as Unboxed.Rep.Tuple2.Lifted.Float, Def.Sum as Unboxed.Rep.Sum2.Lifted.Float, Def.Cons as Reps.Lifted.Float) requires (H as LiftedRep, T as Reps.Float), 224 | consdef (Def.Tuple as Unboxed.Rep.Tuple2.Unlifted.Float, Def.Sum as Unboxed.Rep.Sum2.Unlifted.Float, Def.Cons as Reps.Unlifted.Float) requires (H as UnliftedRep, T as Reps.Float), 225 | consdef (Def.Tuple as Unboxed.Rep.Tuple2.Tuple0.Float, Def.Sum as Unboxed.Rep.Sum2.Tuple0.Float, Def.Cons as Reps.Tuple0.Float) requires (H as TupleRep, T as Reps.Float), 226 | consdef (Def.Tuple as Unboxed.Rep.Tuple2.Int.Float, Def.Sum as Unboxed.Rep.Sum2.Int.Float, Def.Cons as Reps.Int.Float) requires (H as IntRep, T as Reps.Float), 227 | consdef (Def.Tuple as Unboxed.Rep.Tuple2.Int8.Float, Def.Sum as Unboxed.Rep.Sum2.Int8.Float, Def.Cons as Reps.Int8.Float) requires (H as Int8Rep, T as Reps.Float), 228 | consdef (Def.Tuple as Unboxed.Rep.Tuple2.Int16.Float, Def.Sum as Unboxed.Rep.Sum2.Int16.Float, Def.Cons as Reps.Int16.Float) requires (H as Int16Rep, T as Reps.Float), 229 | consdef (Def.Tuple as Unboxed.Rep.Tuple2.Int32.Float, Def.Sum as Unboxed.Rep.Sum2.Int32.Float, Def.Cons as Reps.Int32.Float) requires (H as Int32Rep, T as Reps.Float), 230 | consdef (Def.Tuple as Unboxed.Rep.Tuple2.Int64.Float, Def.Sum as Unboxed.Rep.Sum2.Int64.Float, Def.Cons as Reps.Int64.Float) requires (H as Int64Rep, T as Reps.Float), 231 | consdef (Def.Tuple as Unboxed.Rep.Tuple2.Word.Float, Def.Sum as Unboxed.Rep.Sum2.Word.Float, Def.Cons as Reps.Word.Float) requires (H as WordRep, T as Reps.Float), 232 | consdef (Def.Tuple as Unboxed.Rep.Tuple2.Word8.Float, Def.Sum as Unboxed.Rep.Sum2.Word8.Float, Def.Cons as Reps.Word8.Float) requires (H as Word8Rep, T as Reps.Float), 233 | consdef (Def.Tuple as Unboxed.Rep.Tuple2.Word16.Float, Def.Sum as Unboxed.Rep.Sum2.Word16.Float, Def.Cons as Reps.Word16.Float) requires (H as Word16Rep, T as Reps.Float), 234 | consdef (Def.Tuple as Unboxed.Rep.Tuple2.Word32.Float, Def.Sum as Unboxed.Rep.Sum2.Word32.Float, Def.Cons as Reps.Word32.Float) requires (H as Word32Rep, T as Reps.Float), 235 | consdef (Def.Tuple as Unboxed.Rep.Tuple2.Word64.Float, Def.Sum as Unboxed.Rep.Sum2.Word64.Float, Def.Cons as Reps.Word64.Float) requires (H as Word64Rep, T as Reps.Float), 236 | 237 | consdef (Def.Tuple as Unboxed.Rep.Tuple2.Addr.Lifted, Def.Sum as Unboxed.Rep.Sum2.Addr.Lifted, Def.Cons as Reps.Addr.Lifted) requires (H as AddrRep, T as Reps.Lifted), 238 | consdef (Def.Tuple as Unboxed.Rep.Tuple2.Double.Lifted, Def.Sum as Unboxed.Rep.Sum2.Double.Lifted, Def.Cons as Reps.Double.Lifted) requires (H as DoubleRep, T as Reps.Lifted), 239 | consdef (Def.Tuple as Unboxed.Rep.Tuple2.Float.Lifted, Def.Sum as Unboxed.Rep.Sum2.Float.Lifted, Def.Cons as Reps.Float.Lifted) requires (H as FloatRep, T as Reps.Lifted), 240 | consdef (Def.Tuple as Unboxed.Rep.Tuple2.Lifted.Lifted, Def.Sum as Unboxed.Rep.Sum2.Lifted.Lifted, Def.Cons as Reps.Lifted.Lifted) requires (H as LiftedRep, T as Reps.Lifted), 241 | consdef (Def.Tuple as Unboxed.Rep.Tuple2.Unlifted.Lifted, Def.Sum as Unboxed.Rep.Sum2.Unlifted.Lifted, Def.Cons as Reps.Unlifted.Lifted) requires (H as UnliftedRep, T as Reps.Lifted), 242 | consdef (Def.Tuple as Unboxed.Rep.Tuple2.Tuple0.Lifted, Def.Sum as Unboxed.Rep.Sum2.Tuple0.Lifted, Def.Cons as Reps.Tuple0.Lifted) requires (H as TupleRep, T as Reps.Lifted), 243 | consdef (Def.Tuple as Unboxed.Rep.Tuple2.Int.Lifted, Def.Sum as Unboxed.Rep.Sum2.Int.Lifted, Def.Cons as Reps.Int.Lifted) requires (H as IntRep, T as Reps.Lifted), 244 | consdef (Def.Tuple as Unboxed.Rep.Tuple2.Int8.Lifted, Def.Sum as Unboxed.Rep.Sum2.Int8.Lifted, Def.Cons as Reps.Int8.Lifted) requires (H as Int8Rep, T as Reps.Lifted), 245 | consdef (Def.Tuple as Unboxed.Rep.Tuple2.Int16.Lifted, Def.Sum as Unboxed.Rep.Sum2.Int16.Lifted, Def.Cons as Reps.Int16.Lifted) requires (H as Int16Rep, T as Reps.Lifted), 246 | consdef (Def.Tuple as Unboxed.Rep.Tuple2.Int32.Lifted, Def.Sum as Unboxed.Rep.Sum2.Int32.Lifted, Def.Cons as Reps.Int32.Lifted) requires (H as Int32Rep, T as Reps.Lifted), 247 | consdef (Def.Tuple as Unboxed.Rep.Tuple2.Int64.Lifted, Def.Sum as Unboxed.Rep.Sum2.Int64.Lifted, Def.Cons as Reps.Int64.Lifted) requires (H as Int64Rep, T as Reps.Lifted), 248 | consdef (Def.Tuple as Unboxed.Rep.Tuple2.Word.Lifted, Def.Sum as Unboxed.Rep.Sum2.Word.Lifted, Def.Cons as Reps.Word.Lifted) requires (H as WordRep, T as Reps.Lifted), 249 | consdef (Def.Tuple as Unboxed.Rep.Tuple2.Word8.Lifted, Def.Sum as Unboxed.Rep.Sum2.Word8.Lifted, Def.Cons as Reps.Word8.Lifted) requires (H as Word8Rep, T as Reps.Lifted), 250 | consdef (Def.Tuple as Unboxed.Rep.Tuple2.Word16.Lifted, Def.Sum as Unboxed.Rep.Sum2.Word16.Lifted, Def.Cons as Reps.Word16.Lifted) requires (H as Word16Rep, T as Reps.Lifted), 251 | consdef (Def.Tuple as Unboxed.Rep.Tuple2.Word32.Lifted, Def.Sum as Unboxed.Rep.Sum2.Word32.Lifted, Def.Cons as Reps.Word32.Lifted) requires (H as Word32Rep, T as Reps.Lifted), 252 | consdef (Def.Tuple as Unboxed.Rep.Tuple2.Word64.Lifted, Def.Sum as Unboxed.Rep.Sum2.Word64.Lifted, Def.Cons as Reps.Word64.Lifted) requires (H as Word64Rep, T as Reps.Lifted), 253 | 254 | consdef (Def.Tuple as Unboxed.Rep.Tuple2.Addr.Unlifted, Def.Sum as Unboxed.Rep.Sum2.Addr.Unlifted, Def.Cons as Reps.Addr.Unlifted) requires (H as AddrRep, T as Reps.Unlifted), 255 | consdef (Def.Tuple as Unboxed.Rep.Tuple2.Double.Unlifted, Def.Sum as Unboxed.Rep.Sum2.Double.Unlifted, Def.Cons as Reps.Double.Unlifted) requires (H as DoubleRep, T as Reps.Unlifted), 256 | consdef (Def.Tuple as Unboxed.Rep.Tuple2.Float.Unlifted, Def.Sum as Unboxed.Rep.Sum2.Float.Unlifted, Def.Cons as Reps.Float.Unlifted) requires (H as FloatRep, T as Reps.Unlifted), 257 | consdef (Def.Tuple as Unboxed.Rep.Tuple2.Lifted.Unlifted, Def.Sum as Unboxed.Rep.Sum2.Lifted.Unlifted, Def.Cons as Reps.Lifted.Unlifted) requires (H as LiftedRep, T as Reps.Unlifted), 258 | consdef (Def.Tuple as Unboxed.Rep.Tuple2.Unlifted.Unlifted, Def.Sum as Unboxed.Rep.Sum2.Unlifted.Unlifted, Def.Cons as Reps.Unlifted.Unlifted) requires (H as UnliftedRep, T as Reps.Unlifted), 259 | consdef (Def.Tuple as Unboxed.Rep.Tuple2.Tuple0.Unlifted, Def.Sum as Unboxed.Rep.Sum2.Tuple0.Unlifted, Def.Cons as Reps.Tuple0.Unlifted) requires (H as TupleRep, T as Reps.Unlifted), 260 | consdef (Def.Tuple as Unboxed.Rep.Tuple2.Int.Unlifted, Def.Sum as Unboxed.Rep.Sum2.Int.Unlifted, Def.Cons as Reps.Int.Unlifted) requires (H as IntRep, T as Reps.Unlifted), 261 | consdef (Def.Tuple as Unboxed.Rep.Tuple2.Int8.Unlifted, Def.Sum as Unboxed.Rep.Sum2.Int8.Unlifted, Def.Cons as Reps.Int8.Unlifted) requires (H as Int8Rep, T as Reps.Unlifted), 262 | consdef (Def.Tuple as Unboxed.Rep.Tuple2.Int16.Unlifted, Def.Sum as Unboxed.Rep.Sum2.Int16.Unlifted, Def.Cons as Reps.Int16.Unlifted) requires (H as Int16Rep, T as Reps.Unlifted), 263 | consdef (Def.Tuple as Unboxed.Rep.Tuple2.Int32.Unlifted, Def.Sum as Unboxed.Rep.Sum2.Int32.Unlifted, Def.Cons as Reps.Int32.Unlifted) requires (H as Int32Rep, T as Reps.Unlifted), 264 | consdef (Def.Tuple as Unboxed.Rep.Tuple2.Int64.Unlifted, Def.Sum as Unboxed.Rep.Sum2.Int64.Unlifted, Def.Cons as Reps.Int64.Unlifted) requires (H as Int64Rep, T as Reps.Unlifted), 265 | consdef (Def.Tuple as Unboxed.Rep.Tuple2.Word8.Unlifted, Def.Sum as Unboxed.Rep.Sum2.Word8.Unlifted, Def.Cons as Reps.Word8.Unlifted) requires (H as Word8Rep, T as Reps.Unlifted), 266 | consdef (Def.Tuple as Unboxed.Rep.Tuple2.Word16.Unlifted, Def.Sum as Unboxed.Rep.Sum2.Word16.Unlifted, Def.Cons as Reps.Word16.Unlifted) requires (H as Word16Rep, T as Reps.Unlifted), 267 | consdef (Def.Tuple as Unboxed.Rep.Tuple2.Word32.Unlifted, Def.Sum as Unboxed.Rep.Sum2.Word32.Unlifted, Def.Cons as Reps.Word32.Unlifted) requires (H as Word32Rep, T as Reps.Unlifted), 268 | consdef (Def.Tuple as Unboxed.Rep.Tuple2.Word64.Unlifted, Def.Sum as Unboxed.Rep.Sum2.Word64.Unlifted, Def.Cons as Reps.Word64.Unlifted) requires (H as Word64Rep, T as Reps.Unlifted), 269 | 270 | consdef (Def.Tuple as Unboxed.Rep.Tuple2.Addr.Tuple0, Def.Sum as Unboxed.Rep.Sum2.Addr.Tuple0, Def.Cons as Reps.Addr.Tuple0) requires (H as AddrRep, T as Reps.Tuple0), 271 | consdef (Def.Tuple as Unboxed.Rep.Tuple2.Double.Tuple0, Def.Sum as Unboxed.Rep.Sum2.Double.Tuple0, Def.Cons as Reps.Double.Tuple0) requires (H as DoubleRep, T as Reps.Tuple0), 272 | consdef (Def.Tuple as Unboxed.Rep.Tuple2.Float.Tuple0, Def.Sum as Unboxed.Rep.Sum2.Float.Tuple0, Def.Cons as Reps.Float.Tuple0) requires (H as FloatRep, T as Reps.Tuple0), 273 | consdef (Def.Tuple as Unboxed.Rep.Tuple2.Lifted.Tuple0, Def.Sum as Unboxed.Rep.Sum2.Lifted.Tuple0, Def.Cons as Reps.Lifted.Tuple0) requires (H as LiftedRep, T as Reps.Tuple0), 274 | consdef (Def.Tuple as Unboxed.Rep.Tuple2.Unlifted.Tuple0, Def.Sum as Unboxed.Rep.Sum2.Unlifted.Tuple0, Def.Cons as Reps.Unlifted.Tuple0) requires (H as UnliftedRep, T as Reps.Tuple0), 275 | consdef (Def.Tuple as Unboxed.Rep.Tuple2.Tuple0.Tuple0, Def.Sum as Unboxed.Rep.Sum2.Tuple0.Tuple0, Def.Cons as Reps.Tuple0.Tuple0) requires (H as TupleRep, T as Reps.Tuple0), 276 | consdef (Def.Tuple as Unboxed.Rep.Tuple2.Int.Tuple0, Def.Sum as Unboxed.Rep.Sum2.Int.Tuple0, Def.Cons as Reps.Int.Tuple0) requires (H as IntRep, T as Reps.Tuple0), 277 | consdef (Def.Tuple as Unboxed.Rep.Tuple2.Int8.Tuple0, Def.Sum as Unboxed.Rep.Sum2.Int8.Tuple0, Def.Cons as Reps.Int8.Tuple0) requires (H as Int8Rep, T as Reps.Tuple0), 278 | consdef (Def.Tuple as Unboxed.Rep.Tuple2.Int16.Tuple0, Def.Sum as Unboxed.Rep.Sum2.Int16.Tuple0, Def.Cons as Reps.Int16.Tuple0) requires (H as Int16Rep, T as Reps.Tuple0), 279 | consdef (Def.Tuple as Unboxed.Rep.Tuple2.Int32.Tuple0, Def.Sum as Unboxed.Rep.Sum2.Int32.Tuple0, Def.Cons as Reps.Int32.Tuple0) requires (H as Int32Rep, T as Reps.Tuple0), 280 | consdef (Def.Tuple as Unboxed.Rep.Tuple2.Int64.Tuple0, Def.Sum as Unboxed.Rep.Sum2.Int64.Tuple0, Def.Cons as Reps.Int64.Tuple0) requires (H as Int64Rep, T as Reps.Tuple0), 281 | consdef (Def.Tuple as Unboxed.Rep.Tuple2.Word.Tuple0, Def.Sum as Unboxed.Rep.Sum2.Word.Tuple0, Def.Cons as Reps.Word.Tuple0) requires (H as WordRep, T as Reps.Tuple0), 282 | consdef (Def.Tuple as Unboxed.Rep.Tuple2.Word8.Tuple0, Def.Sum as Unboxed.Rep.Sum2.Word8.Tuple0, Def.Cons as Reps.Word8.Tuple0) requires (H as Word8Rep, T as Reps.Tuple0), 283 | consdef (Def.Tuple as Unboxed.Rep.Tuple2.Word16.Tuple0, Def.Sum as Unboxed.Rep.Sum2.Word16.Tuple0, Def.Cons as Reps.Word16.Tuple0) requires (H as Word16Rep, T as Reps.Tuple0), 284 | consdef (Def.Tuple as Unboxed.Rep.Tuple2.Word32.Tuple0, Def.Sum as Unboxed.Rep.Sum2.Word32.Tuple0, Def.Cons as Reps.Word32.Tuple0) requires (H as Word32Rep, T as Reps.Tuple0), 285 | consdef (Def.Tuple as Unboxed.Rep.Tuple2.Word64.Tuple0, Def.Sum as Unboxed.Rep.Sum2.Word64.Tuple0, Def.Cons as Reps.Word64.Tuple0) requires (H as Word64Rep, T as Reps.Tuple0), 286 | 287 | consdef (Def.Tuple as Unboxed.Rep.Tuple2.Addr.Int, Def.Sum as Unboxed.Rep.Sum2.Addr.Int, Def.Cons as Reps.Addr.Int) requires (H as AddrRep, T as Reps.Int), 288 | consdef (Def.Tuple as Unboxed.Rep.Tuple2.Double.Int, Def.Sum as Unboxed.Rep.Sum2.Double.Int, Def.Cons as Reps.Double.Int) requires (H as DoubleRep, T as Reps.Int), 289 | consdef (Def.Tuple as Unboxed.Rep.Tuple2.Float.Int, Def.Sum as Unboxed.Rep.Sum2.Float.Int, Def.Cons as Reps.Float.Int) requires (H as FloatRep, T as Reps.Int), 290 | consdef (Def.Tuple as Unboxed.Rep.Tuple2.Lifted.Int, Def.Sum as Unboxed.Rep.Sum2.Lifted.Int, Def.Cons as Reps.Lifted.Int) requires (H as LiftedRep, T as Reps.Int), 291 | consdef (Def.Tuple as Unboxed.Rep.Tuple2.Unlifted.Int, Def.Sum as Unboxed.Rep.Sum2.Unlifted.Int, Def.Cons as Reps.Unlifted.Int) requires (H as UnliftedRep, T as Reps.Int), 292 | consdef (Def.Tuple as Unboxed.Rep.Tuple2.Tuple0.Int, Def.Sum as Unboxed.Rep.Sum2.Tuple0.Int, Def.Cons as Reps.Tuple0.Int) requires (H as TupleRep, T as Reps.Int), 293 | consdef (Def.Tuple as Unboxed.Rep.Tuple2.Int.Int, Def.Sum as Unboxed.Rep.Sum2.Int.Int, Def.Cons as Reps.Int.Int) requires (H as IntRep, T as Reps.Int), 294 | consdef (Def.Tuple as Unboxed.Rep.Tuple2.Int8.Int, Def.Sum as Unboxed.Rep.Sum2.Int8.Int, Def.Cons as Reps.Int8.Int) requires (H as Int8Rep, T as Reps.Int), 295 | consdef (Def.Tuple as Unboxed.Rep.Tuple2.Int16.Int, Def.Sum as Unboxed.Rep.Sum2.Int16.Int, Def.Cons as Reps.Int16.Int) requires (H as Int16Rep, T as Reps.Int), 296 | consdef (Def.Tuple as Unboxed.Rep.Tuple2.Int32.Int, Def.Sum as Unboxed.Rep.Sum2.Int32.Int, Def.Cons as Reps.Int32.Int) requires (H as Int32Rep, T as Reps.Int), 297 | consdef (Def.Tuple as Unboxed.Rep.Tuple2.Int64.Int, Def.Sum as Unboxed.Rep.Sum2.Int64.Int, Def.Cons as Reps.Int64.Int) requires (H as Int64Rep, T as Reps.Int), 298 | consdef (Def.Tuple as Unboxed.Rep.Tuple2.Word.Int, Def.Sum as Unboxed.Rep.Sum2.Word.Int, Def.Cons as Reps.Word.Int) requires (H as WordRep, T as Reps.Int), 299 | consdef (Def.Tuple as Unboxed.Rep.Tuple2.Word8.Int, Def.Sum as Unboxed.Rep.Sum2.Word8.Int, Def.Cons as Reps.Word8.Int) requires (H as Word8Rep, T as Reps.Int), 300 | consdef (Def.Tuple as Unboxed.Rep.Tuple2.Word16.Int, Def.Sum as Unboxed.Rep.Sum2.Word16.Int, Def.Cons as Reps.Word16.Int) requires (H as Word16Rep, T as Reps.Int), 301 | consdef (Def.Tuple as Unboxed.Rep.Tuple2.Word32.Int, Def.Sum as Unboxed.Rep.Sum2.Word32.Int, Def.Cons as Reps.Word32.Int) requires (H as Word32Rep, T as Reps.Int), 302 | consdef (Def.Tuple as Unboxed.Rep.Tuple2.Word64.Int, Def.Sum as Unboxed.Rep.Sum2.Word64.Int, Def.Cons as Reps.Word64.Int) requires (H as Word64Rep, T as Reps.Int), 303 | 304 | consdef (Def.Tuple as Unboxed.Rep.Tuple2.Addr.Int8, Def.Sum as Unboxed.Rep.Sum2.Addr.Int8, Def.Cons as Reps.Addr.Int8) requires (H as AddrRep, T as Reps.Int8), 305 | consdef (Def.Tuple as Unboxed.Rep.Tuple2.Double.Int8, Def.Sum as Unboxed.Rep.Sum2.Double.Int8, Def.Cons as Reps.Double.Int8) requires (H as DoubleRep, T as Reps.Int8), 306 | consdef (Def.Tuple as Unboxed.Rep.Tuple2.Float.Int8, Def.Sum as Unboxed.Rep.Sum2.Float.Int8, Def.Cons as Reps.Float.Int8) requires (H as FloatRep, T as Reps.Int8), 307 | consdef (Def.Tuple as Unboxed.Rep.Tuple2.Lifted.Int8, Def.Sum as Unboxed.Rep.Sum2.Lifted.Int8, Def.Cons as Reps.Lifted.Int8) requires (H as LiftedRep, T as Reps.Int8), 308 | consdef (Def.Tuple as Unboxed.Rep.Tuple2.Unlifted.Int8, Def.Sum as Unboxed.Rep.Sum2.Unlifted.Int8, Def.Cons as Reps.Unlifted.Int8) requires (H as UnliftedRep, T as Reps.Int8), 309 | consdef (Def.Tuple as Unboxed.Rep.Tuple2.Tuple0.Int8, Def.Sum as Unboxed.Rep.Sum2.Tuple0.Int8, Def.Cons as Reps.Tuple0.Int8) requires (H as TupleRep, T as Reps.Int8), 310 | consdef (Def.Tuple as Unboxed.Rep.Tuple2.Int.Int8, Def.Sum as Unboxed.Rep.Sum2.Int.Int8, Def.Cons as Reps.Int.Int8) requires (H as IntRep, T as Reps.Int8), 311 | consdef (Def.Tuple as Unboxed.Rep.Tuple2.Int8.Int8, Def.Sum as Unboxed.Rep.Sum2.Int8.Int8, Def.Cons as Reps.Int8.Int8) requires (H as Int8Rep, T as Reps.Int8), 312 | consdef (Def.Tuple as Unboxed.Rep.Tuple2.Int16.Int8, Def.Sum as Unboxed.Rep.Sum2.Int16.Int8, Def.Cons as Reps.Int16.Int8) requires (H as Int16Rep, T as Reps.Int8), 313 | consdef (Def.Tuple as Unboxed.Rep.Tuple2.Int32.Int8, Def.Sum as Unboxed.Rep.Sum2.Int32.Int8, Def.Cons as Reps.Int32.Int8) requires (H as Int32Rep, T as Reps.Int8), 314 | consdef (Def.Tuple as Unboxed.Rep.Tuple2.Int64.Int8, Def.Sum as Unboxed.Rep.Sum2.Int64.Int8, Def.Cons as Reps.Int64.Int8) requires (H as Int64Rep, T as Reps.Int8), 315 | consdef (Def.Tuple as Unboxed.Rep.Tuple2.Word.Int8, Def.Sum as Unboxed.Rep.Sum2.Word.Int8, Def.Cons as Reps.Word.Int8) requires (H as WordRep, T as Reps.Int8), 316 | consdef (Def.Tuple as Unboxed.Rep.Tuple2.Word8.Int8, Def.Sum as Unboxed.Rep.Sum2.Word8.Int8, Def.Cons as Reps.Word8.Int8) requires (H as Word8Rep, T as Reps.Int8), 317 | consdef (Def.Tuple as Unboxed.Rep.Tuple2.Word16.Int8, Def.Sum as Unboxed.Rep.Sum2.Word16.Int8, Def.Cons as Reps.Word16.Int8) requires (H as Word16Rep, T as Reps.Int8), 318 | consdef (Def.Tuple as Unboxed.Rep.Tuple2.Word32.Int8, Def.Sum as Unboxed.Rep.Sum2.Word32.Int8, Def.Cons as Reps.Word32.Int8) requires (H as Word32Rep, T as Reps.Int8), 319 | consdef (Def.Tuple as Unboxed.Rep.Tuple2.Word64.Int8, Def.Sum as Unboxed.Rep.Sum2.Word64.Int8, Def.Cons as Reps.Word64.Int8) requires (H as Word64Rep, T as Reps.Int8), 320 | 321 | consdef (Def.Tuple as Unboxed.Rep.Tuple2.Addr.Int16, Def.Sum as Unboxed.Rep.Sum2.Addr.Int16, Def.Cons as Reps.Addr.Int16) requires (H as AddrRep, T as Reps.Int16), 322 | consdef (Def.Tuple as Unboxed.Rep.Tuple2.Double.Int16, Def.Sum as Unboxed.Rep.Sum2.Double.Int16, Def.Cons as Reps.Double.Int16) requires (H as DoubleRep, T as Reps.Int16), 323 | consdef (Def.Tuple as Unboxed.Rep.Tuple2.Float.Int16, Def.Sum as Unboxed.Rep.Sum2.Float.Int16, Def.Cons as Reps.Float.Int16) requires (H as FloatRep, T as Reps.Int16), 324 | consdef (Def.Tuple as Unboxed.Rep.Tuple2.Lifted.Int16, Def.Sum as Unboxed.Rep.Sum2.Lifted.Int16, Def.Cons as Reps.Lifted.Int16) requires (H as LiftedRep, T as Reps.Int16), 325 | consdef (Def.Tuple as Unboxed.Rep.Tuple2.Unlifted.Int16, Def.Sum as Unboxed.Rep.Sum2.Unlifted.Int16, Def.Cons as Reps.Unlifted.Int16) requires (H as UnliftedRep, T as Reps.Int16), 326 | consdef (Def.Tuple as Unboxed.Rep.Tuple2.Tuple0.Int16, Def.Sum as Unboxed.Rep.Sum2.Tuple0.Int16, Def.Cons as Reps.Tuple0.Int16) requires (H as TupleRep, T as Reps.Int16), 327 | consdef (Def.Tuple as Unboxed.Rep.Tuple2.Int.Int16, Def.Sum as Unboxed.Rep.Sum2.Int.Int16, Def.Cons as Reps.Int.Int16) requires (H as IntRep, T as Reps.Int16), 328 | consdef (Def.Tuple as Unboxed.Rep.Tuple2.Int8.Int16, Def.Sum as Unboxed.Rep.Sum2.Int8.Int16, Def.Cons as Reps.Int8.Int16) requires (H as Int8Rep, T as Reps.Int16), 329 | consdef (Def.Tuple as Unboxed.Rep.Tuple2.Int16.Int16, Def.Sum as Unboxed.Rep.Sum2.Int16.Int16, Def.Cons as Reps.Int16.Int16) requires (H as Int16Rep, T as Reps.Int16), 330 | consdef (Def.Tuple as Unboxed.Rep.Tuple2.Int32.Int16, Def.Sum as Unboxed.Rep.Sum2.Int32.Int16, Def.Cons as Reps.Int32.Int16) requires (H as Int32Rep, T as Reps.Int16), 331 | consdef (Def.Tuple as Unboxed.Rep.Tuple2.Int64.Int16, Def.Sum as Unboxed.Rep.Sum2.Int64.Int16, Def.Cons as Reps.Int64.Int16) requires (H as Int64Rep, T as Reps.Int16), 332 | consdef (Def.Tuple as Unboxed.Rep.Tuple2.Word.Int16, Def.Sum as Unboxed.Rep.Sum2.Word.Int16, Def.Cons as Reps.Word.Int16) requires (H as WordRep, T as Reps.Int16), 333 | consdef (Def.Tuple as Unboxed.Rep.Tuple2.Word8.Int16, Def.Sum as Unboxed.Rep.Sum2.Word8.Int16, Def.Cons as Reps.Word8.Int16) requires (H as Word8Rep, T as Reps.Int16), 334 | consdef (Def.Tuple as Unboxed.Rep.Tuple2.Word16.Int16, Def.Sum as Unboxed.Rep.Sum2.Word16.Int16, Def.Cons as Reps.Word16.Int16) requires (H as Word16Rep, T as Reps.Int16), 335 | consdef (Def.Tuple as Unboxed.Rep.Tuple2.Word32.Int16, Def.Sum as Unboxed.Rep.Sum2.Word32.Int16, Def.Cons as Reps.Word32.Int16) requires (H as Word32Rep, T as Reps.Int16), 336 | consdef (Def.Tuple as Unboxed.Rep.Tuple2.Word64.Int16, Def.Sum as Unboxed.Rep.Sum2.Word64.Int16, Def.Cons as Reps.Word64.Int16) requires (H as Word64Rep, T as Reps.Int16), 337 | 338 | consdef (Def.Tuple as Unboxed.Rep.Tuple2.Addr.Int32, Def.Sum as Unboxed.Rep.Sum2.Addr.Int32, Def.Cons as Reps.Addr.Int32) requires (H as AddrRep, T as Reps.Int32), 339 | consdef (Def.Tuple as Unboxed.Rep.Tuple2.Double.Int32, Def.Sum as Unboxed.Rep.Sum2.Double.Int32, Def.Cons as Reps.Double.Int32) requires (H as DoubleRep, T as Reps.Int32), 340 | consdef (Def.Tuple as Unboxed.Rep.Tuple2.Float.Int32, Def.Sum as Unboxed.Rep.Sum2.Float.Int32, Def.Cons as Reps.Float.Int32) requires (H as FloatRep, T as Reps.Int32), 341 | consdef (Def.Tuple as Unboxed.Rep.Tuple2.Lifted.Int32, Def.Sum as Unboxed.Rep.Sum2.Lifted.Int32, Def.Cons as Reps.Lifted.Int32) requires (H as LiftedRep, T as Reps.Int32), 342 | consdef (Def.Tuple as Unboxed.Rep.Tuple2.Unlifted.Int32, Def.Sum as Unboxed.Rep.Sum2.Unlifted.Int32, Def.Cons as Reps.Unlifted.Int32) requires (H as UnliftedRep, T as Reps.Int32), 343 | consdef (Def.Tuple as Unboxed.Rep.Tuple2.Tuple0.Int32, Def.Sum as Unboxed.Rep.Sum2.Tuple0.Int32, Def.Cons as Reps.Tuple0.Int32) requires (H as TupleRep, T as Reps.Int32), 344 | consdef (Def.Tuple as Unboxed.Rep.Tuple2.Int.Int32, Def.Sum as Unboxed.Rep.Sum2.Int.Int32, Def.Cons as Reps.Int.Int32) requires (H as IntRep, T as Reps.Int32), 345 | consdef (Def.Tuple as Unboxed.Rep.Tuple2.Int8.Int32, Def.Sum as Unboxed.Rep.Sum2.Int8.Int32, Def.Cons as Reps.Int8.Int32) requires (H as Int8Rep, T as Reps.Int32), 346 | consdef (Def.Tuple as Unboxed.Rep.Tuple2.Int16.Int32, Def.Sum as Unboxed.Rep.Sum2.Int16.Int32, Def.Cons as Reps.Int16.Int32) requires (H as Int16Rep, T as Reps.Int32), 347 | consdef (Def.Tuple as Unboxed.Rep.Tuple2.Int32.Int32, Def.Sum as Unboxed.Rep.Sum2.Int32.Int32, Def.Cons as Reps.Int32.Int32) requires (H as Int32Rep, T as Reps.Int32), 348 | consdef (Def.Tuple as Unboxed.Rep.Tuple2.Int64.Int32, Def.Sum as Unboxed.Rep.Sum2.Int64.Int32, Def.Cons as Reps.Int64.Int32) requires (H as Int64Rep, T as Reps.Int32), 349 | consdef (Def.Tuple as Unboxed.Rep.Tuple2.Word.Int32, Def.Sum as Unboxed.Rep.Sum2.Word.Int32, Def.Cons as Reps.Word.Int32) requires (H as WordRep, T as Reps.Int32), 350 | consdef (Def.Tuple as Unboxed.Rep.Tuple2.Word8.Int32, Def.Sum as Unboxed.Rep.Sum2.Word8.Int32, Def.Cons as Reps.Word8.Int32) requires (H as Word8Rep, T as Reps.Int32), 351 | consdef (Def.Tuple as Unboxed.Rep.Tuple2.Word16.Int32, Def.Sum as Unboxed.Rep.Sum2.Word16.Int32, Def.Cons as Reps.Word16.Int32) requires (H as Word16Rep, T as Reps.Int32), 352 | consdef (Def.Tuple as Unboxed.Rep.Tuple2.Word32.Int32, Def.Sum as Unboxed.Rep.Sum2.Word32.Int32, Def.Cons as Reps.Word32.Int32) requires (H as Word32Rep, T as Reps.Int32), 353 | consdef (Def.Tuple as Unboxed.Rep.Tuple2.Word64.Int32, Def.Sum as Unboxed.Rep.Sum2.Word64.Int32, Def.Cons as Reps.Word64.Int32) requires (H as Word64Rep, T as Reps.Int32), 354 | 355 | consdef (Def.Tuple as Unboxed.Rep.Tuple2.Addr.Int64, Def.Sum as Unboxed.Rep.Sum2.Addr.Int64, Def.Cons as Reps.Addr.Int64) requires (H as AddrRep, T as Reps.Int64), 356 | consdef (Def.Tuple as Unboxed.Rep.Tuple2.Double.Int64, Def.Sum as Unboxed.Rep.Sum2.Double.Int64, Def.Cons as Reps.Double.Int64) requires (H as DoubleRep, T as Reps.Int64), 357 | consdef (Def.Tuple as Unboxed.Rep.Tuple2.Float.Int64, Def.Sum as Unboxed.Rep.Sum2.Float.Int64, Def.Cons as Reps.Float.Int64) requires (H as FloatRep, T as Reps.Int64), 358 | consdef (Def.Tuple as Unboxed.Rep.Tuple2.Lifted.Int64, Def.Sum as Unboxed.Rep.Sum2.Lifted.Int64, Def.Cons as Reps.Lifted.Int64) requires (H as LiftedRep, T as Reps.Int64), 359 | consdef (Def.Tuple as Unboxed.Rep.Tuple2.Unlifted.Int64, Def.Sum as Unboxed.Rep.Sum2.Unlifted.Int64, Def.Cons as Reps.Unlifted.Int64) requires (H as UnliftedRep, T as Reps.Int64), 360 | consdef (Def.Tuple as Unboxed.Rep.Tuple2.Tuple0.Int64, Def.Sum as Unboxed.Rep.Sum2.Tuple0.Int64, Def.Cons as Reps.Tuple0.Int64) requires (H as TupleRep, T as Reps.Int64), 361 | consdef (Def.Tuple as Unboxed.Rep.Tuple2.Int.Int64, Def.Sum as Unboxed.Rep.Sum2.Int.Int64, Def.Cons as Reps.Int.Int64) requires (H as IntRep, T as Reps.Int64), 362 | consdef (Def.Tuple as Unboxed.Rep.Tuple2.Int8.Int64, Def.Sum as Unboxed.Rep.Sum2.Int8.Int64, Def.Cons as Reps.Int8.Int64) requires (H as Int8Rep, T as Reps.Int64), 363 | consdef (Def.Tuple as Unboxed.Rep.Tuple2.Int16.Int64, Def.Sum as Unboxed.Rep.Sum2.Int16.Int64, Def.Cons as Reps.Int16.Int64) requires (H as Int16Rep, T as Reps.Int64), 364 | consdef (Def.Tuple as Unboxed.Rep.Tuple2.Int32.Int64, Def.Sum as Unboxed.Rep.Sum2.Int32.Int64, Def.Cons as Reps.Int32.Int64) requires (H as Int32Rep, T as Reps.Int64), 365 | consdef (Def.Tuple as Unboxed.Rep.Tuple2.Int64.Int64, Def.Sum as Unboxed.Rep.Sum2.Int64.Int64, Def.Cons as Reps.Int64.Int64) requires (H as Int64Rep, T as Reps.Int64), 366 | consdef (Def.Tuple as Unboxed.Rep.Tuple2.Word.Int64, Def.Sum as Unboxed.Rep.Sum2.Word.Int64, Def.Cons as Reps.Word.Int64) requires (H as WordRep, T as Reps.Int64), 367 | consdef (Def.Tuple as Unboxed.Rep.Tuple2.Word8.Int64, Def.Sum as Unboxed.Rep.Sum2.Word8.Int64, Def.Cons as Reps.Word8.Int64) requires (H as Word8Rep, T as Reps.Int64), 368 | consdef (Def.Tuple as Unboxed.Rep.Tuple2.Word16.Int64, Def.Sum as Unboxed.Rep.Sum2.Word16.Int64, Def.Cons as Reps.Word16.Int64) requires (H as Word16Rep, T as Reps.Int64), 369 | consdef (Def.Tuple as Unboxed.Rep.Tuple2.Word32.Int64, Def.Sum as Unboxed.Rep.Sum2.Word32.Int64, Def.Cons as Reps.Word32.Int64) requires (H as Word32Rep, T as Reps.Int64), 370 | consdef (Def.Tuple as Unboxed.Rep.Tuple2.Word64.Int64, Def.Sum as Unboxed.Rep.Sum2.Word64.Int64, Def.Cons as Reps.Word64.Int64) requires (H as Word64Rep, T as Reps.Int64), 371 | 372 | consdef (Def.Tuple as Unboxed.Rep.Tuple2.Addr.Word, Def.Sum as Unboxed.Rep.Sum2.Addr.Word, Def.Cons as Reps.Addr.Word) requires (H as AddrRep, T as Reps.Word), 373 | consdef (Def.Tuple as Unboxed.Rep.Tuple2.Double.Word, Def.Sum as Unboxed.Rep.Sum2.Double.Word, Def.Cons as Reps.Double.Word) requires (H as DoubleRep, T as Reps.Word), 374 | consdef (Def.Tuple as Unboxed.Rep.Tuple2.Float.Word, Def.Sum as Unboxed.Rep.Sum2.Float.Word, Def.Cons as Reps.Float.Word) requires (H as FloatRep, T as Reps.Word), 375 | consdef (Def.Tuple as Unboxed.Rep.Tuple2.Lifted.Word, Def.Sum as Unboxed.Rep.Sum2.Lifted.Word, Def.Cons as Reps.Lifted.Word) requires (H as LiftedRep, T as Reps.Word), 376 | consdef (Def.Tuple as Unboxed.Rep.Tuple2.Unlifted.Word, Def.Sum as Unboxed.Rep.Sum2.Unlifted.Word, Def.Cons as Reps.Unlifted.Word) requires (H as UnliftedRep, T as Reps.Word), 377 | consdef (Def.Tuple as Unboxed.Rep.Tuple2.Tuple0.Word, Def.Sum as Unboxed.Rep.Sum2.Tuple0.Word, Def.Cons as Reps.Tuple0.Word) requires (H as TupleRep, T as Reps.Word), 378 | consdef (Def.Tuple as Unboxed.Rep.Tuple2.Int.Word, Def.Sum as Unboxed.Rep.Sum2.Int.Word, Def.Cons as Reps.Int.Word) requires (H as IntRep, T as Reps.Word), 379 | consdef (Def.Tuple as Unboxed.Rep.Tuple2.Int8.Word, Def.Sum as Unboxed.Rep.Sum2.Int8.Word, Def.Cons as Reps.Int8.Word) requires (H as Int8Rep, T as Reps.Word), 380 | consdef (Def.Tuple as Unboxed.Rep.Tuple2.Int16.Word, Def.Sum as Unboxed.Rep.Sum2.Int16.Word, Def.Cons as Reps.Int16.Word) requires (H as Int16Rep, T as Reps.Word), 381 | consdef (Def.Tuple as Unboxed.Rep.Tuple2.Int32.Word, Def.Sum as Unboxed.Rep.Sum2.Int32.Word, Def.Cons as Reps.Int32.Word) requires (H as Int32Rep, T as Reps.Word), 382 | consdef (Def.Tuple as Unboxed.Rep.Tuple2.Int64.Word, Def.Sum as Unboxed.Rep.Sum2.Int64.Word, Def.Cons as Reps.Int64.Word) requires (H as Int64Rep, T as Reps.Word), 383 | consdef (Def.Tuple as Unboxed.Rep.Tuple2.Word.Word, Def.Sum as Unboxed.Rep.Sum2.Word.Word, Def.Cons as Reps.Word.Word) requires (H as WordRep, T as Reps.Word), 384 | consdef (Def.Tuple as Unboxed.Rep.Tuple2.Word8.Word, Def.Sum as Unboxed.Rep.Sum2.Word8.Word, Def.Cons as Reps.Word8.Word) requires (H as Word8Rep, T as Reps.Word), 385 | consdef (Def.Tuple as Unboxed.Rep.Tuple2.Word16.Word, Def.Sum as Unboxed.Rep.Sum2.Word16.Word, Def.Cons as Reps.Word16.Word) requires (H as Word16Rep, T as Reps.Word), 386 | consdef (Def.Tuple as Unboxed.Rep.Tuple2.Word32.Word, Def.Sum as Unboxed.Rep.Sum2.Word32.Word, Def.Cons as Reps.Word32.Word) requires (H as Word32Rep, T as Reps.Word), 387 | consdef (Def.Tuple as Unboxed.Rep.Tuple2.Word64.Word, Def.Sum as Unboxed.Rep.Sum2.Word64.Word, Def.Cons as Reps.Word64.Word) requires (H as Word64Rep, T as Reps.Word), 388 | 389 | consdef (Def.Tuple as Unboxed.Rep.Tuple2.Addr.Word8, Def.Sum as Unboxed.Rep.Sum2.Addr.Word8, Def.Cons as Reps.Addr.Word8) requires (H as AddrRep, T as Reps.Word8), 390 | consdef (Def.Tuple as Unboxed.Rep.Tuple2.Double.Word8, Def.Sum as Unboxed.Rep.Sum2.Double.Word8, Def.Cons as Reps.Double.Word8) requires (H as DoubleRep, T as Reps.Word8), 391 | consdef (Def.Tuple as Unboxed.Rep.Tuple2.Float.Word8, Def.Sum as Unboxed.Rep.Sum2.Float.Word8, Def.Cons as Reps.Float.Word8) requires (H as FloatRep, T as Reps.Word8), 392 | consdef (Def.Tuple as Unboxed.Rep.Tuple2.Lifted.Word8, Def.Sum as Unboxed.Rep.Sum2.Lifted.Word8, Def.Cons as Reps.Lifted.Word8) requires (H as LiftedRep, T as Reps.Word8), 393 | consdef (Def.Tuple as Unboxed.Rep.Tuple2.Unlifted.Word8, Def.Sum as Unboxed.Rep.Sum2.Unlifted.Word8, Def.Cons as Reps.Unlifted.Word8) requires (H as UnliftedRep, T as Reps.Word8), 394 | consdef (Def.Tuple as Unboxed.Rep.Tuple2.Tuple0.Word8, Def.Sum as Unboxed.Rep.Sum2.Tuple0.Word8, Def.Cons as Reps.Tuple0.Word8) requires (H as TupleRep, T as Reps.Word8), 395 | consdef (Def.Tuple as Unboxed.Rep.Tuple2.Int.Word8, Def.Sum as Unboxed.Rep.Sum2.Int.Word8, Def.Cons as Reps.Int.Word8) requires (H as IntRep, T as Reps.Word8), 396 | consdef (Def.Tuple as Unboxed.Rep.Tuple2.Int8.Word8, Def.Sum as Unboxed.Rep.Sum2.Int8.Word8, Def.Cons as Reps.Int8.Word8) requires (H as Int8Rep, T as Reps.Word8), 397 | consdef (Def.Tuple as Unboxed.Rep.Tuple2.Int16.Word8, Def.Sum as Unboxed.Rep.Sum2.Int16.Word8, Def.Cons as Reps.Int16.Word8) requires (H as Int16Rep, T as Reps.Word8), 398 | consdef (Def.Tuple as Unboxed.Rep.Tuple2.Int32.Word8, Def.Sum as Unboxed.Rep.Sum2.Int32.Word8, Def.Cons as Reps.Int32.Word8) requires (H as Int32Rep, T as Reps.Word8), 399 | consdef (Def.Tuple as Unboxed.Rep.Tuple2.Int64.Word8, Def.Sum as Unboxed.Rep.Sum2.Int64.Word8, Def.Cons as Reps.Int64.Word8) requires (H as Int64Rep, T as Reps.Word8), 400 | consdef (Def.Tuple as Unboxed.Rep.Tuple2.Word.Word8, Def.Sum as Unboxed.Rep.Sum2.Word.Word8, Def.Cons as Reps.Word.Word8) requires (H as WordRep, T as Reps.Word8), 401 | consdef (Def.Tuple as Unboxed.Rep.Tuple2.Word8.Word8, Def.Sum as Unboxed.Rep.Sum2.Word8.Word8, Def.Cons as Reps.Word8.Word8) requires (H as Word8Rep, T as Reps.Word8), 402 | consdef (Def.Tuple as Unboxed.Rep.Tuple2.Word16.Word8, Def.Sum as Unboxed.Rep.Sum2.Word16.Word8, Def.Cons as Reps.Word16.Word8) requires (H as Word16Rep, T as Reps.Word8), 403 | consdef (Def.Tuple as Unboxed.Rep.Tuple2.Word32.Word8, Def.Sum as Unboxed.Rep.Sum2.Word32.Word8, Def.Cons as Reps.Word32.Word8) requires (H as Word32Rep, T as Reps.Word8), 404 | consdef (Def.Tuple as Unboxed.Rep.Tuple2.Word64.Word8, Def.Sum as Unboxed.Rep.Sum2.Word64.Word8, Def.Cons as Reps.Word64.Word8) requires (H as Word64Rep, T as Reps.Word8), 405 | 406 | consdef (Def.Tuple as Unboxed.Rep.Tuple2.Addr.Word16, Def.Sum as Unboxed.Rep.Sum2.Addr.Word16, Def.Cons as Reps.Addr.Word16) requires (H as AddrRep, T as Reps.Word16), 407 | consdef (Def.Tuple as Unboxed.Rep.Tuple2.Double.Word16, Def.Sum as Unboxed.Rep.Sum2.Double.Word16, Def.Cons as Reps.Double.Word16) requires (H as DoubleRep, T as Reps.Word16), 408 | consdef (Def.Tuple as Unboxed.Rep.Tuple2.Float.Word16, Def.Sum as Unboxed.Rep.Sum2.Float.Word16, Def.Cons as Reps.Float.Word16) requires (H as FloatRep, T as Reps.Word16), 409 | consdef (Def.Tuple as Unboxed.Rep.Tuple2.Lifted.Word16, Def.Sum as Unboxed.Rep.Sum2.Lifted.Word16, Def.Cons as Reps.Lifted.Word16) requires (H as LiftedRep, T as Reps.Word16), 410 | consdef (Def.Tuple as Unboxed.Rep.Tuple2.Unlifted.Word16, Def.Sum as Unboxed.Rep.Sum2.Unlifted.Word16, Def.Cons as Reps.Unlifted.Word16) requires (H as UnliftedRep, T as Reps.Word16), 411 | consdef (Def.Tuple as Unboxed.Rep.Tuple2.Tuple0.Word16, Def.Sum as Unboxed.Rep.Sum2.Tuple0.Word16, Def.Cons as Reps.Tuple0.Word16) requires (H as TupleRep, T as Reps.Word16), 412 | consdef (Def.Tuple as Unboxed.Rep.Tuple2.Int.Word16, Def.Sum as Unboxed.Rep.Sum2.Int.Word16, Def.Cons as Reps.Int.Word16) requires (H as IntRep, T as Reps.Word16), 413 | consdef (Def.Tuple as Unboxed.Rep.Tuple2.Int8.Word16, Def.Sum as Unboxed.Rep.Sum2.Int8.Word16, Def.Cons as Reps.Int8.Word16) requires (H as Int8Rep, T as Reps.Word16), 414 | consdef (Def.Tuple as Unboxed.Rep.Tuple2.Int16.Word16, Def.Sum as Unboxed.Rep.Sum2.Int16.Word16, Def.Cons as Reps.Int16.Word16) requires (H as Int16Rep, T as Reps.Word16), 415 | consdef (Def.Tuple as Unboxed.Rep.Tuple2.Int32.Word16, Def.Sum as Unboxed.Rep.Sum2.Int32.Word16, Def.Cons as Reps.Int32.Word16) requires (H as Int32Rep, T as Reps.Word16), 416 | consdef (Def.Tuple as Unboxed.Rep.Tuple2.Int64.Word16, Def.Sum as Unboxed.Rep.Sum2.Int64.Word16, Def.Cons as Reps.Int64.Word16) requires (H as Int64Rep, T as Reps.Word16), 417 | consdef (Def.Tuple as Unboxed.Rep.Tuple2.Word.Word16, Def.Sum as Unboxed.Rep.Sum2.Word.Word16, Def.Cons as Reps.Word.Word16) requires (H as WordRep, T as Reps.Word16), 418 | consdef (Def.Tuple as Unboxed.Rep.Tuple2.Word8.Word16, Def.Sum as Unboxed.Rep.Sum2.Word8.Word16, Def.Cons as Reps.Word8.Word16) requires (H as Word8Rep, T as Reps.Word16), 419 | consdef (Def.Tuple as Unboxed.Rep.Tuple2.Word16.Word16, Def.Sum as Unboxed.Rep.Sum2.Word16.Word16, Def.Cons as Reps.Word16.Word16) requires (H as Word16Rep, T as Reps.Word16), 420 | consdef (Def.Tuple as Unboxed.Rep.Tuple2.Word32.Word16, Def.Sum as Unboxed.Rep.Sum2.Word32.Word16, Def.Cons as Reps.Word32.Word16) requires (H as Word32Rep, T as Reps.Word16), 421 | consdef (Def.Tuple as Unboxed.Rep.Tuple2.Word64.Word16, Def.Sum as Unboxed.Rep.Sum2.Word64.Word16, Def.Cons as Reps.Word64.Word16) requires (H as Word64Rep, T as Reps.Word16), 422 | 423 | consdef (Def.Tuple as Unboxed.Rep.Tuple2.Addr.Word32, Def.Sum as Unboxed.Rep.Sum2.Addr.Word32, Def.Cons as Reps.Addr.Word32) requires (H as AddrRep, T as Reps.Word32), 424 | consdef (Def.Tuple as Unboxed.Rep.Tuple2.Double.Word32, Def.Sum as Unboxed.Rep.Sum2.Double.Word32, Def.Cons as Reps.Double.Word32) requires (H as DoubleRep, T as Reps.Word32), 425 | consdef (Def.Tuple as Unboxed.Rep.Tuple2.Float.Word32, Def.Sum as Unboxed.Rep.Sum2.Float.Word32, Def.Cons as Reps.Float.Word32) requires (H as FloatRep, T as Reps.Word32), 426 | consdef (Def.Tuple as Unboxed.Rep.Tuple2.Lifted.Word32, Def.Sum as Unboxed.Rep.Sum2.Lifted.Word32, Def.Cons as Reps.Lifted.Word32) requires (H as LiftedRep, T as Reps.Word32), 427 | consdef (Def.Tuple as Unboxed.Rep.Tuple2.Unlifted.Word32, Def.Sum as Unboxed.Rep.Sum2.Unlifted.Word32, Def.Cons as Reps.Unlifted.Word32) requires (H as UnliftedRep, T as Reps.Word32), 428 | consdef (Def.Tuple as Unboxed.Rep.Tuple2.Tuple0.Word32, Def.Sum as Unboxed.Rep.Sum2.Tuple0.Word32, Def.Cons as Reps.Tuple0.Word32) requires (H as TupleRep, T as Reps.Word32), 429 | consdef (Def.Tuple as Unboxed.Rep.Tuple2.Int.Word32, Def.Sum as Unboxed.Rep.Sum2.Int.Word32, Def.Cons as Reps.Int.Word32) requires (H as IntRep, T as Reps.Word32), 430 | consdef (Def.Tuple as Unboxed.Rep.Tuple2.Int8.Word32, Def.Sum as Unboxed.Rep.Sum2.Int8.Word32, Def.Cons as Reps.Int8.Word32) requires (H as Int8Rep, T as Reps.Word32), 431 | consdef (Def.Tuple as Unboxed.Rep.Tuple2.Int16.Word32, Def.Sum as Unboxed.Rep.Sum2.Int16.Word32, Def.Cons as Reps.Int16.Word32) requires (H as Int16Rep, T as Reps.Word32), 432 | consdef (Def.Tuple as Unboxed.Rep.Tuple2.Int32.Word32, Def.Sum as Unboxed.Rep.Sum2.Int32.Word32, Def.Cons as Reps.Int32.Word32) requires (H as Int32Rep, T as Reps.Word32), 433 | consdef (Def.Tuple as Unboxed.Rep.Tuple2.Int64.Word32, Def.Sum as Unboxed.Rep.Sum2.Int64.Word32, Def.Cons as Reps.Int64.Word32) requires (H as Int64Rep, T as Reps.Word32), 434 | consdef (Def.Tuple as Unboxed.Rep.Tuple2.Word.Word32, Def.Sum as Unboxed.Rep.Sum2.Word.Word32, Def.Cons as Reps.Word.Word32) requires (H as WordRep, T as Reps.Word32), 435 | consdef (Def.Tuple as Unboxed.Rep.Tuple2.Word8.Word32, Def.Sum as Unboxed.Rep.Sum2.Word8.Word32, Def.Cons as Reps.Word8.Word32) requires (H as Word8Rep, T as Reps.Word32), 436 | consdef (Def.Tuple as Unboxed.Rep.Tuple2.Word16.Word32, Def.Sum as Unboxed.Rep.Sum2.Word16.Word32, Def.Cons as Reps.Word16.Word32) requires (H as Word16Rep, T as Reps.Word32), 437 | consdef (Def.Tuple as Unboxed.Rep.Tuple2.Word32.Word32, Def.Sum as Unboxed.Rep.Sum2.Word32.Word32, Def.Cons as Reps.Word32.Word32) requires (H as Word32Rep, T as Reps.Word32), 438 | consdef (Def.Tuple as Unboxed.Rep.Tuple2.Word64.Word32, Def.Sum as Unboxed.Rep.Sum2.Word64.Word32, Def.Cons as Reps.Word64.Word32) requires (H as Word64Rep, T as Reps.Word32), 439 | 440 | consdef (Def.Tuple as Unboxed.Rep.Tuple2.Addr.Word64, Def.Sum as Unboxed.Rep.Sum2.Addr.Word64, Def.Cons as Reps.Addr.Word64) requires (H as AddrRep, T as Reps.Word64), 441 | consdef (Def.Tuple as Unboxed.Rep.Tuple2.Double.Word64, Def.Sum as Unboxed.Rep.Sum2.Double.Word64, Def.Cons as Reps.Double.Word64) requires (H as DoubleRep, T as Reps.Word64), 442 | consdef (Def.Tuple as Unboxed.Rep.Tuple2.Float.Word64, Def.Sum as Unboxed.Rep.Sum2.Float.Word64, Def.Cons as Reps.Float.Word64) requires (H as FloatRep, T as Reps.Word64), 443 | consdef (Def.Tuple as Unboxed.Rep.Tuple2.Lifted.Word64, Def.Sum as Unboxed.Rep.Sum2.Lifted.Word64, Def.Cons as Reps.Lifted.Word64) requires (H as LiftedRep, T as Reps.Word64), 444 | consdef (Def.Tuple as Unboxed.Rep.Tuple2.Unlifted.Word64, Def.Sum as Unboxed.Rep.Sum2.Unlifted.Word64, Def.Cons as Reps.Unlifted.Word64) requires (H as UnliftedRep, T as Reps.Word64), 445 | consdef (Def.Tuple as Unboxed.Rep.Tuple2.Tuple0.Word64, Def.Sum as Unboxed.Rep.Sum2.Tuple0.Word64, Def.Cons as Reps.Tuple0.Word64) requires (H as TupleRep, T as Reps.Word64), 446 | consdef (Def.Tuple as Unboxed.Rep.Tuple2.Int.Word64, Def.Sum as Unboxed.Rep.Sum2.Int.Word64, Def.Cons as Reps.Int.Word64) requires (H as IntRep, T as Reps.Word64), 447 | consdef (Def.Tuple as Unboxed.Rep.Tuple2.Int8.Word64, Def.Sum as Unboxed.Rep.Sum2.Int8.Word64, Def.Cons as Reps.Int8.Word64) requires (H as Int8Rep, T as Reps.Word64), 448 | consdef (Def.Tuple as Unboxed.Rep.Tuple2.Int16.Word64, Def.Sum as Unboxed.Rep.Sum2.Int16.Word64, Def.Cons as Reps.Int16.Word64) requires (H as Int16Rep, T as Reps.Word64), 449 | consdef (Def.Tuple as Unboxed.Rep.Tuple2.Int32.Word64, Def.Sum as Unboxed.Rep.Sum2.Int32.Word64, Def.Cons as Reps.Int32.Word64) requires (H as Int32Rep, T as Reps.Word64), 450 | consdef (Def.Tuple as Unboxed.Rep.Tuple2.Int64.Word64, Def.Sum as Unboxed.Rep.Sum2.Int64.Word64, Def.Cons as Reps.Int64.Word64) requires (H as Int64Rep, T as Reps.Word64), 451 | consdef (Def.Tuple as Unboxed.Rep.Tuple2.Word.Word64, Def.Sum as Unboxed.Rep.Sum2.Word.Word64, Def.Cons as Reps.Word.Word64) requires (H as WordRep, T as Reps.Word64), 452 | consdef (Def.Tuple as Unboxed.Rep.Tuple2.Word8.Word64, Def.Sum as Unboxed.Rep.Sum2.Word8.Word64, Def.Cons as Reps.Word8.Word64) requires (H as Word8Rep, T as Reps.Word64), 453 | consdef (Def.Tuple as Unboxed.Rep.Tuple2.Word16.Word64, Def.Sum as Unboxed.Rep.Sum2.Word16.Word64, Def.Cons as Reps.Word16.Word64) requires (H as Word16Rep, T as Reps.Word64), 454 | consdef (Def.Tuple as Unboxed.Rep.Tuple2.Word32.Word64, Def.Sum as Unboxed.Rep.Sum2.Word32.Word64, Def.Cons as Reps.Word32.Word64) requires (H as Word32Rep, T as Reps.Word64), 455 | consdef (Def.Tuple as Unboxed.Rep.Tuple2.Word64.Word64, Def.Sum as Unboxed.Rep.Sum2.Word64.Word64, Def.Cons as Reps.Word64.Word64) requires (H as Word64Rep, T as Reps.Word64) 456 | 457 | reexported-modules: 458 | Unboxed.Rep.Sum2.Addr.Addr, 459 | Unboxed.Rep.Sum2.Double.Addr, 460 | Unboxed.Rep.Sum2.Float.Addr, 461 | Unboxed.Rep.Sum2.Int.Addr, 462 | Unboxed.Rep.Sum2.Int8.Addr, 463 | Unboxed.Rep.Sum2.Int16.Addr, 464 | Unboxed.Rep.Sum2.Int32.Addr, 465 | Unboxed.Rep.Sum2.Int64.Addr, 466 | Unboxed.Rep.Sum2.Lifted.Addr, 467 | Unboxed.Rep.Sum2.Tuple0.Addr, 468 | Unboxed.Rep.Sum2.Unlifted.Addr, 469 | Unboxed.Rep.Sum2.Word.Addr, 470 | Unboxed.Rep.Sum2.Word8.Addr, 471 | Unboxed.Rep.Sum2.Word16.Addr, 472 | Unboxed.Rep.Sum2.Word32.Addr, 473 | Unboxed.Rep.Sum2.Word64.Addr, 474 | Unboxed.Rep.Tuple2.Addr.Addr, 475 | Unboxed.Rep.Tuple2.Double.Addr, 476 | Unboxed.Rep.Tuple2.Float.Addr, 477 | Unboxed.Rep.Tuple2.Int.Addr, 478 | Unboxed.Rep.Tuple2.Int8.Addr, 479 | Unboxed.Rep.Tuple2.Int16.Addr, 480 | Unboxed.Rep.Tuple2.Int32.Addr, 481 | Unboxed.Rep.Tuple2.Int64.Addr, 482 | Unboxed.Rep.Tuple2.Lifted.Addr, 483 | Unboxed.Rep.Tuple2.Tuple0.Addr, 484 | Unboxed.Rep.Tuple2.Unlifted.Addr, 485 | Unboxed.Rep.Tuple2.Word.Addr, 486 | Unboxed.Rep.Tuple2.Word8.Addr, 487 | Unboxed.Rep.Tuple2.Word16.Addr, 488 | Unboxed.Rep.Tuple2.Word32.Addr, 489 | Unboxed.Rep.Tuple2.Word64.Addr, 490 | 491 | Unboxed.Rep.Sum2.Addr.Double, 492 | Unboxed.Rep.Sum2.Double.Double, 493 | Unboxed.Rep.Sum2.Float.Double, 494 | Unboxed.Rep.Sum2.Int.Double, 495 | Unboxed.Rep.Sum2.Int8.Double, 496 | Unboxed.Rep.Sum2.Int16.Double, 497 | Unboxed.Rep.Sum2.Int32.Double, 498 | Unboxed.Rep.Sum2.Int64.Double, 499 | Unboxed.Rep.Sum2.Lifted.Double, 500 | Unboxed.Rep.Sum2.Tuple0.Double, 501 | Unboxed.Rep.Sum2.Unlifted.Double, 502 | Unboxed.Rep.Sum2.Word.Double, 503 | Unboxed.Rep.Sum2.Word8.Double, 504 | Unboxed.Rep.Sum2.Word16.Double, 505 | Unboxed.Rep.Sum2.Word32.Double, 506 | Unboxed.Rep.Sum2.Word64.Double, 507 | Unboxed.Rep.Tuple2.Addr.Double, 508 | Unboxed.Rep.Tuple2.Double.Double, 509 | Unboxed.Rep.Tuple2.Float.Double, 510 | Unboxed.Rep.Tuple2.Int.Double, 511 | Unboxed.Rep.Tuple2.Int8.Double, 512 | Unboxed.Rep.Tuple2.Int16.Double, 513 | Unboxed.Rep.Tuple2.Int32.Double, 514 | Unboxed.Rep.Tuple2.Int64.Double, 515 | Unboxed.Rep.Tuple2.Lifted.Double, 516 | Unboxed.Rep.Tuple2.Tuple0.Double, 517 | Unboxed.Rep.Tuple2.Unlifted.Double, 518 | Unboxed.Rep.Tuple2.Word.Double, 519 | Unboxed.Rep.Tuple2.Word8.Double, 520 | Unboxed.Rep.Tuple2.Word16.Double, 521 | Unboxed.Rep.Tuple2.Word32.Double, 522 | Unboxed.Rep.Tuple2.Word64.Double, 523 | 524 | Unboxed.Rep.Sum2.Addr.Float, 525 | Unboxed.Rep.Sum2.Double.Float, 526 | Unboxed.Rep.Sum2.Float.Float, 527 | Unboxed.Rep.Sum2.Int.Float, 528 | Unboxed.Rep.Sum2.Int8.Float, 529 | Unboxed.Rep.Sum2.Int16.Float, 530 | Unboxed.Rep.Sum2.Int32.Float, 531 | Unboxed.Rep.Sum2.Int64.Float, 532 | Unboxed.Rep.Sum2.Lifted.Float, 533 | Unboxed.Rep.Sum2.Tuple0.Float, 534 | Unboxed.Rep.Sum2.Unlifted.Float, 535 | Unboxed.Rep.Sum2.Word.Float, 536 | Unboxed.Rep.Sum2.Word8.Float, 537 | Unboxed.Rep.Sum2.Word16.Float, 538 | Unboxed.Rep.Sum2.Word32.Float, 539 | Unboxed.Rep.Sum2.Word64.Float, 540 | Unboxed.Rep.Tuple2.Addr.Float, 541 | Unboxed.Rep.Tuple2.Double.Float, 542 | Unboxed.Rep.Tuple2.Float.Float, 543 | Unboxed.Rep.Tuple2.Int.Float, 544 | Unboxed.Rep.Tuple2.Int8.Float, 545 | Unboxed.Rep.Tuple2.Int16.Float, 546 | Unboxed.Rep.Tuple2.Int32.Float, 547 | Unboxed.Rep.Tuple2.Int64.Float, 548 | Unboxed.Rep.Tuple2.Lifted.Float, 549 | Unboxed.Rep.Tuple2.Tuple0.Float, 550 | Unboxed.Rep.Tuple2.Unlifted.Float, 551 | Unboxed.Rep.Tuple2.Word.Float, 552 | Unboxed.Rep.Tuple2.Word8.Float, 553 | Unboxed.Rep.Tuple2.Word16.Float, 554 | Unboxed.Rep.Tuple2.Word32.Float, 555 | Unboxed.Rep.Tuple2.Word64.Float, 556 | 557 | Unboxed.Rep.Sum2.Addr.Int, 558 | Unboxed.Rep.Sum2.Double.Int, 559 | Unboxed.Rep.Sum2.Float.Int, 560 | Unboxed.Rep.Sum2.Int.Int, 561 | Unboxed.Rep.Sum2.Int8.Int, 562 | Unboxed.Rep.Sum2.Int16.Int, 563 | Unboxed.Rep.Sum2.Int32.Int, 564 | Unboxed.Rep.Sum2.Int64.Int, 565 | Unboxed.Rep.Sum2.Lifted.Int, 566 | Unboxed.Rep.Sum2.Tuple0.Int, 567 | Unboxed.Rep.Sum2.Unlifted.Int, 568 | Unboxed.Rep.Sum2.Word.Int, 569 | Unboxed.Rep.Sum2.Word8.Int, 570 | Unboxed.Rep.Sum2.Word16.Int, 571 | Unboxed.Rep.Sum2.Word32.Int, 572 | Unboxed.Rep.Sum2.Word64.Int, 573 | Unboxed.Rep.Tuple2.Addr.Int, 574 | Unboxed.Rep.Tuple2.Double.Int, 575 | Unboxed.Rep.Tuple2.Float.Int, 576 | Unboxed.Rep.Tuple2.Int.Int, 577 | Unboxed.Rep.Tuple2.Int8.Int, 578 | Unboxed.Rep.Tuple2.Int16.Int, 579 | Unboxed.Rep.Tuple2.Int32.Int, 580 | Unboxed.Rep.Tuple2.Int64.Int, 581 | Unboxed.Rep.Tuple2.Lifted.Int, 582 | Unboxed.Rep.Tuple2.Tuple0.Int, 583 | Unboxed.Rep.Tuple2.Unlifted.Int, 584 | Unboxed.Rep.Tuple2.Word.Int, 585 | Unboxed.Rep.Tuple2.Word8.Int, 586 | Unboxed.Rep.Tuple2.Word16.Int, 587 | Unboxed.Rep.Tuple2.Word32.Int, 588 | Unboxed.Rep.Tuple2.Word64.Int, 589 | 590 | Unboxed.Rep.Sum2.Addr.Int8, 591 | Unboxed.Rep.Sum2.Double.Int8, 592 | Unboxed.Rep.Sum2.Float.Int8, 593 | Unboxed.Rep.Sum2.Int.Int8, 594 | Unboxed.Rep.Sum2.Int8.Int8, 595 | Unboxed.Rep.Sum2.Int16.Int8, 596 | Unboxed.Rep.Sum2.Int32.Int8, 597 | Unboxed.Rep.Sum2.Int64.Int8, 598 | Unboxed.Rep.Sum2.Lifted.Int8, 599 | Unboxed.Rep.Sum2.Tuple0.Int8, 600 | Unboxed.Rep.Sum2.Unlifted.Int8, 601 | Unboxed.Rep.Sum2.Word.Int8, 602 | Unboxed.Rep.Sum2.Word8.Int8, 603 | Unboxed.Rep.Sum2.Word16.Int8, 604 | Unboxed.Rep.Sum2.Word32.Int8, 605 | Unboxed.Rep.Sum2.Word64.Int8, 606 | Unboxed.Rep.Tuple2.Addr.Int8, 607 | Unboxed.Rep.Tuple2.Double.Int8, 608 | Unboxed.Rep.Tuple2.Float.Int8, 609 | Unboxed.Rep.Tuple2.Int.Int8, 610 | Unboxed.Rep.Tuple2.Int8.Int8, 611 | Unboxed.Rep.Tuple2.Int16.Int8, 612 | Unboxed.Rep.Tuple2.Int32.Int8, 613 | Unboxed.Rep.Tuple2.Int64.Int8, 614 | Unboxed.Rep.Tuple2.Lifted.Int8, 615 | Unboxed.Rep.Sum2.Tuple0.Int16, 616 | Unboxed.Rep.Sum2.Unlifted.Int16, 617 | Unboxed.Rep.Sum2.Word.Int16, 618 | Unboxed.Rep.Sum2.Word8.Int16, 619 | Unboxed.Rep.Sum2.Word16.Int16, 620 | Unboxed.Rep.Sum2.Word32.Int16, 621 | Unboxed.Rep.Sum2.Word64.Int16, 622 | Unboxed.Rep.Tuple2.Addr.Int16, 623 | Unboxed.Rep.Tuple2.Double.Int16, 624 | Unboxed.Rep.Tuple2.Float.Int16, 625 | Unboxed.Rep.Tuple2.Int.Int16, 626 | Unboxed.Rep.Tuple2.Int8.Int16, 627 | Unboxed.Rep.Tuple2.Int16.Int16, 628 | Unboxed.Rep.Tuple2.Int32.Int16, 629 | Unboxed.Rep.Tuple2.Int64.Int16, 630 | Unboxed.Rep.Tuple2.Lifted.Int16, 631 | Unboxed.Rep.Tuple2.Tuple0.Int16, 632 | Unboxed.Rep.Tuple2.Unlifted.Int16, 633 | Unboxed.Rep.Tuple2.Word.Int16, 634 | Unboxed.Rep.Tuple2.Word8.Int16, 635 | Unboxed.Rep.Tuple2.Word16.Int16, 636 | Unboxed.Rep.Tuple2.Word32.Int16, 637 | Unboxed.Rep.Tuple2.Word64.Int16, 638 | 639 | Unboxed.Rep.Sum2.Addr.Int32, 640 | Unboxed.Rep.Sum2.Double.Int32, 641 | Unboxed.Rep.Sum2.Float.Int32, 642 | Unboxed.Rep.Sum2.Int.Int32, 643 | Unboxed.Rep.Sum2.Int8.Int32, 644 | Unboxed.Rep.Sum2.Int16.Int32, 645 | Unboxed.Rep.Sum2.Int32.Int32, 646 | Unboxed.Rep.Sum2.Int64.Int32, 647 | Unboxed.Rep.Sum2.Lifted.Int32, 648 | Unboxed.Rep.Sum2.Tuple0.Int32, 649 | Unboxed.Rep.Sum2.Unlifted.Int32, 650 | Unboxed.Rep.Sum2.Word.Int32, 651 | Unboxed.Rep.Sum2.Word8.Int32, 652 | Unboxed.Rep.Sum2.Word16.Int32, 653 | Unboxed.Rep.Sum2.Word32.Int32, 654 | Unboxed.Rep.Sum2.Word64.Int32, 655 | Unboxed.Rep.Tuple2.Addr.Int32, 656 | Unboxed.Rep.Tuple2.Double.Int32, 657 | Unboxed.Rep.Tuple2.Float.Int32, 658 | Unboxed.Rep.Tuple2.Int.Int32, 659 | Unboxed.Rep.Tuple2.Int8.Int32, 660 | Unboxed.Rep.Tuple2.Int16.Int32, 661 | Unboxed.Rep.Tuple2.Int32.Int32, 662 | Unboxed.Rep.Tuple2.Int64.Int32, 663 | Unboxed.Rep.Tuple2.Lifted.Int32, 664 | Unboxed.Rep.Tuple2.Tuple0.Int32, 665 | Unboxed.Rep.Tuple2.Unlifted.Int32, 666 | Unboxed.Rep.Tuple2.Word.Int32, 667 | Unboxed.Rep.Tuple2.Word8.Int32, 668 | Unboxed.Rep.Tuple2.Word16.Int32, 669 | Unboxed.Rep.Tuple2.Word32.Int32, 670 | Unboxed.Rep.Tuple2.Word64.Int32, 671 | 672 | Unboxed.Rep.Sum2.Addr.Int64, 673 | Unboxed.Rep.Sum2.Double.Int64, 674 | Unboxed.Rep.Sum2.Float.Int64, 675 | Unboxed.Rep.Sum2.Int.Int64, 676 | Unboxed.Rep.Sum2.Int8.Int64, 677 | Unboxed.Rep.Sum2.Int16.Int64, 678 | Unboxed.Rep.Sum2.Int32.Int64, 679 | Unboxed.Rep.Sum2.Int64.Int64, 680 | Unboxed.Rep.Sum2.Lifted.Int64, 681 | Unboxed.Rep.Sum2.Tuple0.Int64, 682 | Unboxed.Rep.Sum2.Unlifted.Int64, 683 | Unboxed.Rep.Sum2.Word.Int64, 684 | Unboxed.Rep.Sum2.Word8.Int64, 685 | Unboxed.Rep.Sum2.Word16.Int64, 686 | Unboxed.Rep.Sum2.Word32.Int64, 687 | Unboxed.Rep.Sum2.Word64.Int64, 688 | Unboxed.Rep.Tuple2.Addr.Int64, 689 | Unboxed.Rep.Tuple2.Double.Int64, 690 | Unboxed.Rep.Tuple2.Float.Int64, 691 | Unboxed.Rep.Tuple2.Int.Int64, 692 | Unboxed.Rep.Tuple2.Int8.Int64, 693 | Unboxed.Rep.Tuple2.Int16.Int64, 694 | Unboxed.Rep.Tuple2.Int32.Int64, 695 | Unboxed.Rep.Tuple2.Int64.Int64, 696 | Unboxed.Rep.Tuple2.Lifted.Int64, 697 | Unboxed.Rep.Tuple2.Tuple0.Int64, 698 | Unboxed.Rep.Tuple2.Unlifted.Int64, 699 | Unboxed.Rep.Tuple2.Word.Int64, 700 | Unboxed.Rep.Tuple2.Word8.Int64, 701 | Unboxed.Rep.Tuple2.Word16.Int64, 702 | Unboxed.Rep.Tuple2.Word32.Int64, 703 | Unboxed.Rep.Tuple2.Word64.Int64, 704 | 705 | Unboxed.Rep.Sum2.Addr.Lifted, 706 | Unboxed.Rep.Sum2.Double.Lifted, 707 | Unboxed.Rep.Sum2.Float.Lifted, 708 | Unboxed.Rep.Sum2.Int.Lifted, 709 | Unboxed.Rep.Sum2.Int8.Lifted, 710 | Unboxed.Rep.Sum2.Int16.Lifted, 711 | Unboxed.Rep.Sum2.Int32.Lifted, 712 | Unboxed.Rep.Sum2.Int64.Lifted, 713 | Unboxed.Rep.Sum2.Lifted.Lifted, 714 | Unboxed.Rep.Sum2.Tuple0.Lifted, 715 | Unboxed.Rep.Sum2.Unlifted.Lifted, 716 | Unboxed.Rep.Sum2.Word.Lifted, 717 | Unboxed.Rep.Sum2.Word8.Lifted, 718 | Unboxed.Rep.Sum2.Word16.Lifted, 719 | Unboxed.Rep.Sum2.Word32.Lifted, 720 | Unboxed.Rep.Sum2.Word64.Lifted, 721 | Unboxed.Rep.Tuple2.Addr.Lifted, 722 | Unboxed.Rep.Tuple2.Double.Lifted, 723 | Unboxed.Rep.Tuple2.Float.Lifted, 724 | Unboxed.Rep.Tuple2.Int.Lifted, 725 | Unboxed.Rep.Tuple2.Int8.Lifted, 726 | Unboxed.Rep.Tuple2.Int16.Lifted, 727 | Unboxed.Rep.Tuple2.Int32.Lifted, 728 | Unboxed.Rep.Tuple2.Int64.Lifted, 729 | Unboxed.Rep.Tuple2.Lifted.Lifted, 730 | Unboxed.Rep.Tuple2.Tuple0.Lifted, 731 | Unboxed.Rep.Tuple2.Unlifted.Lifted, 732 | Unboxed.Rep.Tuple2.Word.Lifted, 733 | Unboxed.Rep.Tuple2.Word8.Lifted, 734 | Unboxed.Rep.Tuple2.Word16.Lifted, 735 | Unboxed.Rep.Tuple2.Word32.Lifted, 736 | Unboxed.Rep.Tuple2.Word64.Lifted, 737 | 738 | Unboxed.Rep.Sum2.Addr.Tuple0, 739 | Unboxed.Rep.Sum2.Double.Tuple0, 740 | Unboxed.Rep.Sum2.Float.Tuple0, 741 | Unboxed.Rep.Sum2.Int.Tuple0, 742 | Unboxed.Rep.Sum2.Int8.Tuple0, 743 | Unboxed.Rep.Sum2.Int16.Tuple0, 744 | Unboxed.Rep.Sum2.Int32.Tuple0, 745 | Unboxed.Rep.Sum2.Int64.Tuple0, 746 | Unboxed.Rep.Sum2.Lifted.Tuple0, 747 | Unboxed.Rep.Sum2.Tuple0.Tuple0, 748 | Unboxed.Rep.Sum2.Unlifted.Tuple0, 749 | Unboxed.Rep.Sum2.Word.Tuple0, 750 | Unboxed.Rep.Sum2.Word8.Tuple0, 751 | Unboxed.Rep.Sum2.Word16.Tuple0, 752 | Unboxed.Rep.Sum2.Word32.Tuple0, 753 | Unboxed.Rep.Sum2.Word64.Tuple0, 754 | Unboxed.Rep.Tuple2.Addr.Tuple0, 755 | Unboxed.Rep.Tuple2.Double.Tuple0, 756 | Unboxed.Rep.Tuple2.Float.Tuple0, 757 | Unboxed.Rep.Tuple2.Int.Tuple0, 758 | Unboxed.Rep.Tuple2.Int8.Tuple0, 759 | Unboxed.Rep.Tuple2.Int16.Tuple0, 760 | Unboxed.Rep.Tuple2.Int32.Tuple0, 761 | Unboxed.Rep.Tuple2.Int64.Tuple0, 762 | Unboxed.Rep.Tuple2.Lifted.Tuple0, 763 | Unboxed.Rep.Tuple2.Tuple0.Tuple0, 764 | Unboxed.Rep.Tuple2.Unlifted.Tuple0, 765 | Unboxed.Rep.Tuple2.Word.Tuple0, 766 | Unboxed.Rep.Tuple2.Word8.Tuple0, 767 | Unboxed.Rep.Tuple2.Word16.Tuple0, 768 | Unboxed.Rep.Tuple2.Word32.Tuple0, 769 | Unboxed.Rep.Tuple2.Word64.Tuple0, 770 | 771 | Unboxed.Rep.Sum2.Addr.Unlifted, 772 | Unboxed.Rep.Sum2.Double.Unlifted, 773 | Unboxed.Rep.Sum2.Float.Unlifted, 774 | Unboxed.Rep.Sum2.Int.Unlifted, 775 | Unboxed.Rep.Sum2.Int8.Unlifted, 776 | Unboxed.Rep.Sum2.Int16.Unlifted, 777 | Unboxed.Rep.Sum2.Int32.Unlifted, 778 | Unboxed.Rep.Sum2.Int64.Unlifted, 779 | Unboxed.Rep.Sum2.Lifted.Unlifted, 780 | Unboxed.Rep.Sum2.Tuple0.Unlifted, 781 | Unboxed.Rep.Sum2.Unlifted.Unlifted, 782 | Unboxed.Rep.Sum2.Word.Unlifted, 783 | Unboxed.Rep.Sum2.Word8.Unlifted, 784 | Unboxed.Rep.Sum2.Word16.Unlifted, 785 | Unboxed.Rep.Sum2.Word32.Unlifted, 786 | Unboxed.Rep.Sum2.Word64.Unlifted, 787 | Unboxed.Rep.Tuple2.Addr.Unlifted, 788 | Unboxed.Rep.Tuple2.Double.Unlifted, 789 | Unboxed.Rep.Tuple2.Float.Unlifted, 790 | Unboxed.Rep.Tuple2.Int.Unlifted, 791 | Unboxed.Rep.Tuple2.Int8.Unlifted, 792 | Unboxed.Rep.Tuple2.Int16.Unlifted, 793 | Unboxed.Rep.Tuple2.Int32.Unlifted, 794 | Unboxed.Rep.Tuple2.Int64.Unlifted, 795 | Unboxed.Rep.Tuple2.Lifted.Unlifted, 796 | Unboxed.Rep.Tuple2.Tuple0.Unlifted, 797 | Unboxed.Rep.Tuple2.Unlifted.Unlifted, 798 | Unboxed.Rep.Tuple2.Word8.Unlifted, 799 | Unboxed.Rep.Tuple2.Word16.Unlifted, 800 | Unboxed.Rep.Tuple2.Word32.Unlifted, 801 | Unboxed.Rep.Tuple2.Word64.Unlifted, 802 | 803 | Unboxed.Rep.Sum2.Addr.Word, 804 | Unboxed.Rep.Sum2.Double.Word, 805 | Unboxed.Rep.Sum2.Float.Word, 806 | Unboxed.Rep.Sum2.Int.Word, 807 | Unboxed.Rep.Sum2.Int8.Word, 808 | Unboxed.Rep.Sum2.Int16.Word, 809 | Unboxed.Rep.Sum2.Int32.Word, 810 | Unboxed.Rep.Sum2.Int64.Word, 811 | Unboxed.Rep.Sum2.Lifted.Word, 812 | Unboxed.Rep.Sum2.Tuple0.Word, 813 | Unboxed.Rep.Sum2.Unlifted.Word, 814 | Unboxed.Rep.Sum2.Word.Word, 815 | Unboxed.Rep.Sum2.Word8.Word, 816 | Unboxed.Rep.Sum2.Word16.Word, 817 | Unboxed.Rep.Sum2.Word32.Word, 818 | Unboxed.Rep.Sum2.Word64.Word, 819 | Unboxed.Rep.Tuple2.Addr.Word, 820 | Unboxed.Rep.Tuple2.Double.Word, 821 | Unboxed.Rep.Tuple2.Float.Word, 822 | Unboxed.Rep.Tuple2.Int.Word, 823 | Unboxed.Rep.Tuple2.Int8.Word, 824 | Unboxed.Rep.Tuple2.Int16.Word, 825 | Unboxed.Rep.Tuple2.Int32.Word, 826 | Unboxed.Rep.Tuple2.Int64.Word, 827 | Unboxed.Rep.Tuple2.Lifted.Word, 828 | Unboxed.Rep.Tuple2.Tuple0.Word, 829 | Unboxed.Rep.Tuple2.Unlifted.Word, 830 | Unboxed.Rep.Tuple2.Word.Word, 831 | Unboxed.Rep.Tuple2.Word8.Word, 832 | Unboxed.Rep.Tuple2.Word16.Word, 833 | Unboxed.Rep.Tuple2.Word32.Word, 834 | Unboxed.Rep.Tuple2.Word64.Word, 835 | 836 | Unboxed.Rep.Sum2.Addr.Word8, 837 | Unboxed.Rep.Sum2.Double.Word8, 838 | Unboxed.Rep.Sum2.Float.Word8, 839 | Unboxed.Rep.Sum2.Int.Word8, 840 | Unboxed.Rep.Sum2.Int8.Word8, 841 | Unboxed.Rep.Sum2.Int16.Word8, 842 | Unboxed.Rep.Sum2.Int32.Word8, 843 | Unboxed.Rep.Sum2.Int64.Word8, 844 | Unboxed.Rep.Sum2.Lifted.Word8, 845 | Unboxed.Rep.Sum2.Tuple0.Word8, 846 | Unboxed.Rep.Sum2.Unlifted.Word8, 847 | Unboxed.Rep.Sum2.Word.Word8, 848 | Unboxed.Rep.Sum2.Word8.Word8, 849 | Unboxed.Rep.Sum2.Word16.Word8, 850 | Unboxed.Rep.Sum2.Word32.Word8, 851 | Unboxed.Rep.Sum2.Word64.Word8, 852 | Unboxed.Rep.Tuple2.Addr.Word8, 853 | Unboxed.Rep.Tuple2.Double.Word8, 854 | Unboxed.Rep.Tuple2.Float.Word8, 855 | Unboxed.Rep.Tuple2.Int.Word8, 856 | Unboxed.Rep.Tuple2.Int8.Word8, 857 | Unboxed.Rep.Tuple2.Int16.Word8, 858 | Unboxed.Rep.Tuple2.Int32.Word8, 859 | Unboxed.Rep.Tuple2.Int64.Word8, 860 | Unboxed.Rep.Tuple2.Lifted.Word8, 861 | Unboxed.Rep.Tuple2.Tuple0.Word8, 862 | Unboxed.Rep.Tuple2.Unlifted.Word8, 863 | Unboxed.Rep.Tuple2.Word.Word8, 864 | Unboxed.Rep.Tuple2.Word8.Word8, 865 | Unboxed.Rep.Tuple2.Word16.Word8, 866 | Unboxed.Rep.Tuple2.Word32.Word8, 867 | Unboxed.Rep.Tuple2.Word64.Word8, 868 | 869 | Unboxed.Rep.Sum2.Addr.Word16, 870 | Unboxed.Rep.Sum2.Double.Word16, 871 | Unboxed.Rep.Sum2.Float.Word16, 872 | Unboxed.Rep.Sum2.Int.Word16, 873 | Unboxed.Rep.Sum2.Int8.Word16, 874 | Unboxed.Rep.Sum2.Int16.Word16, 875 | Unboxed.Rep.Sum2.Int32.Word16, 876 | Unboxed.Rep.Sum2.Int64.Word16, 877 | Unboxed.Rep.Sum2.Lifted.Word16, 878 | Unboxed.Rep.Sum2.Tuple0.Word16, 879 | Unboxed.Rep.Sum2.Unlifted.Word16, 880 | Unboxed.Rep.Sum2.Word.Word16, 881 | Unboxed.Rep.Sum2.Word8.Word16, 882 | Unboxed.Rep.Sum2.Word16.Word16, 883 | Unboxed.Rep.Sum2.Word32.Word16, 884 | Unboxed.Rep.Sum2.Word64.Word16, 885 | Unboxed.Rep.Tuple2.Addr.Word16, 886 | Unboxed.Rep.Tuple2.Double.Word16, 887 | Unboxed.Rep.Tuple2.Float.Word16, 888 | Unboxed.Rep.Tuple2.Int.Word16, 889 | Unboxed.Rep.Tuple2.Int8.Word16, 890 | Unboxed.Rep.Tuple2.Int16.Word16, 891 | Unboxed.Rep.Tuple2.Int32.Word16, 892 | Unboxed.Rep.Tuple2.Int64.Word16, 893 | Unboxed.Rep.Tuple2.Lifted.Word16, 894 | Unboxed.Rep.Tuple2.Tuple0.Word16, 895 | Unboxed.Rep.Tuple2.Unlifted.Word16, 896 | Unboxed.Rep.Tuple2.Word.Word16, 897 | Unboxed.Rep.Tuple2.Word8.Word16, 898 | Unboxed.Rep.Tuple2.Word16.Word16, 899 | Unboxed.Rep.Tuple2.Word32.Word16, 900 | Unboxed.Rep.Tuple2.Word64.Word16, 901 | 902 | Unboxed.Rep.Sum2.Addr.Word32, 903 | Unboxed.Rep.Sum2.Double.Word32, 904 | Unboxed.Rep.Sum2.Float.Word32, 905 | Unboxed.Rep.Sum2.Int.Word32, 906 | Unboxed.Rep.Sum2.Int8.Word32, 907 | Unboxed.Rep.Sum2.Int16.Word32, 908 | Unboxed.Rep.Sum2.Int32.Word32, 909 | Unboxed.Rep.Sum2.Int64.Word32, 910 | Unboxed.Rep.Sum2.Lifted.Word32, 911 | Unboxed.Rep.Sum2.Tuple0.Word32, 912 | Unboxed.Rep.Sum2.Unlifted.Word32, 913 | Unboxed.Rep.Sum2.Word.Word32, 914 | Unboxed.Rep.Sum2.Word8.Word32, 915 | Unboxed.Rep.Sum2.Word16.Word32, 916 | Unboxed.Rep.Sum2.Word32.Word32, 917 | Unboxed.Rep.Sum2.Word64.Word32, 918 | Unboxed.Rep.Tuple2.Addr.Word32, 919 | Unboxed.Rep.Tuple2.Double.Word32, 920 | Unboxed.Rep.Tuple2.Float.Word32, 921 | Unboxed.Rep.Tuple2.Int.Word32, 922 | Unboxed.Rep.Tuple2.Int8.Word32, 923 | Unboxed.Rep.Tuple2.Int16.Word32, 924 | Unboxed.Rep.Tuple2.Int32.Word32, 925 | Unboxed.Rep.Tuple2.Int64.Word32, 926 | Unboxed.Rep.Tuple2.Lifted.Word32, 927 | Unboxed.Rep.Tuple2.Tuple0.Word32, 928 | Unboxed.Rep.Tuple2.Unlifted.Word32, 929 | Unboxed.Rep.Tuple2.Word.Word32, 930 | Unboxed.Rep.Tuple2.Word8.Word32, 931 | Unboxed.Rep.Tuple2.Word16.Word32, 932 | Unboxed.Rep.Tuple2.Word32.Word32, 933 | Unboxed.Rep.Tuple2.Word64.Word32, 934 | 935 | Unboxed.Rep.Sum2.Addr.Word64, 936 | Unboxed.Rep.Sum2.Double.Word64, 937 | Unboxed.Rep.Sum2.Float.Word64, 938 | Unboxed.Rep.Sum2.Int.Word64, 939 | Unboxed.Rep.Sum2.Int8.Word64, 940 | Unboxed.Rep.Sum2.Int16.Word64, 941 | Unboxed.Rep.Sum2.Int32.Word64, 942 | Unboxed.Rep.Sum2.Int64.Word64, 943 | Unboxed.Rep.Sum2.Lifted.Word64, 944 | Unboxed.Rep.Sum2.Tuple0.Word64, 945 | Unboxed.Rep.Sum2.Unlifted.Word64, 946 | Unboxed.Rep.Sum2.Word.Word64, 947 | Unboxed.Rep.Sum2.Word8.Word64, 948 | Unboxed.Rep.Sum2.Word16.Word64, 949 | Unboxed.Rep.Sum2.Word32.Word64, 950 | Unboxed.Rep.Sum2.Word64.Word64, 951 | Unboxed.Rep.Tuple2.Addr.Word64, 952 | Unboxed.Rep.Tuple2.Double.Word64, 953 | Unboxed.Rep.Tuple2.Float.Word64, 954 | Unboxed.Rep.Tuple2.Int.Word64, 955 | Unboxed.Rep.Tuple2.Int8.Word64, 956 | Unboxed.Rep.Tuple2.Int16.Word64, 957 | Unboxed.Rep.Tuple2.Int32.Word64, 958 | Unboxed.Rep.Tuple2.Int64.Word64, 959 | Unboxed.Rep.Tuple2.Lifted.Word64, 960 | Unboxed.Rep.Tuple2.Tuple0.Word64, 961 | Unboxed.Rep.Tuple2.Unlifted.Word64, 962 | Unboxed.Rep.Tuple2.Word.Word64, 963 | Unboxed.Rep.Tuple2.Word8.Word64, 964 | Unboxed.Rep.Tuple2.Word16.Word64, 965 | Unboxed.Rep.Tuple2.Word32.Word64, 966 | Unboxed.Rep.Tuple2.Word64.Word64 967 | 968 | library measurement 969 | import: base 970 | ghc-options: -O2 971 | build-depends: criterion-measurement 972 | hs-source-dirs: measurement 973 | exposed-modules: Whnf Internal 974 | 975 | benchmark bench-nat 976 | import: minimal 977 | type: exitcode-stdio-1.0 978 | ghc-options: -O2 979 | main-is: nat.hs 980 | build-depends: base, ghc-prim, unboxed, criterion, measurement 981 | hs-source-dirs: bench 982 | --------------------------------------------------------------------------------