├── .gitignore ├── Setup.hs ├── ChangeLog.md ├── test └── Spec.hs ├── src └── Lib.hs ├── README.md ├── package.yaml ├── LICENSE ├── app └── Main.hs └── stack.yaml /.gitignore: -------------------------------------------------------------------------------- 1 | .stack-work/ 2 | concat-test.cabal 3 | *~ -------------------------------------------------------------------------------- /Setup.hs: -------------------------------------------------------------------------------- 1 | import Distribution.Simple 2 | main = defaultMain 3 | -------------------------------------------------------------------------------- /ChangeLog.md: -------------------------------------------------------------------------------- 1 | # Changelog for concat-test 2 | 3 | ## Unreleased changes 4 | -------------------------------------------------------------------------------- /test/Spec.hs: -------------------------------------------------------------------------------- 1 | main :: IO () 2 | main = putStrLn "Test suite not yet implemented" 3 | -------------------------------------------------------------------------------- /src/Lib.hs: -------------------------------------------------------------------------------- 1 | module Lib 2 | ( someFunc 3 | ) where 4 | 5 | someFunc :: IO () 6 | someFunc = putStrLn "someFunc" 7 | -------------------------------------------------------------------------------- /README.md: -------------------------------------------------------------------------------- 1 | # concat-test 2 | A basic repo with stack setup to use Conal Elliott's compiling to categories plugin 3 | 1. Add extra-deps to point to his repo 4 | 2. Add plugin and optimization ghc flags to package.yaml 5 | 3. import plugins 6 | 7 | Changed the lts to one that uses ghc 8.0.2 8 | I iteratively added extra-deps trying to get it to compile. I dunno. 9 | -------------------------------------------------------------------------------- /package.yaml: -------------------------------------------------------------------------------- 1 | name: concat-test 2 | version: 0.1.0.0 3 | github: "githubuser/concat-test" 4 | license: BSD3 5 | author: "Author name here" 6 | maintainer: "example@example.com" 7 | copyright: "2018 Author name here" 8 | 9 | extra-source-files: 10 | - README.md 11 | - ChangeLog.md 12 | 13 | # Metadata used when publishing your package 14 | # synopsis: Short description of your package 15 | # category: Web 16 | 17 | # To avoid duplicated efforts in documentation and dealing with the 18 | # complications of embedding Haddock markup inside cabal files, it is 19 | # common to point users to the README.md file. 20 | description: Please see the README on GitHub at 21 | 22 | dependencies: 23 | - base >= 4.7 && < 5 24 | 25 | library: 26 | source-dirs: src 27 | 28 | executables: 29 | concat-test-exe: 30 | main: Main.hs 31 | source-dirs: app 32 | ghc-options: 33 | - -threaded 34 | - -rtsopts 35 | - -with-rtsopts=-N 36 | - -O 37 | - -fplugin=ConCat.Plugin 38 | dependencies: 39 | - concat-test 40 | - concat-plugin 41 | - concat-satisfy 42 | - concat-classes 43 | - ghc-prim 44 | 45 | tests: 46 | concat-test-test: 47 | main: Spec.hs 48 | source-dirs: test 49 | ghc-options: 50 | - -threaded 51 | - -rtsopts 52 | - -with-rtsopts=-N 53 | dependencies: 54 | - concat-test 55 | -------------------------------------------------------------------------------- /LICENSE: -------------------------------------------------------------------------------- 1 | Copyright Author name here (c) 2018 2 | 3 | All rights reserved. 4 | 5 | Redistribution and use in source and binary forms, with or without 6 | modification, are permitted provided that the following conditions are met: 7 | 8 | * Redistributions of source code must retain the above copyright 9 | notice, this list of conditions and the following disclaimer. 10 | 11 | * Redistributions in binary form must reproduce the above 12 | copyright notice, this list of conditions and the following 13 | disclaimer in the documentation and/or other materials provided 14 | with the distribution. 15 | 16 | * Neither the name of Author name here nor the names of other 17 | contributors may be used to endorse or promote products derived 18 | from this software without specific prior written permission. 19 | 20 | THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS 21 | "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT 22 | LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR 23 | A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT 24 | OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, 25 | SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT 26 | LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, 27 | DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY 28 | THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT 29 | (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE 30 | OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. 31 | -------------------------------------------------------------------------------- /app/Main.hs: -------------------------------------------------------------------------------- 1 | {-#LANGUAGE GADTs, KindSignatures, TypeFamilies #-} 2 | module Main where 3 | 4 | import Lib 5 | import ConCat.AltCat 6 | import qualified ConCat.Category 7 | import ConCat.Rebox 8 | import Prelude hiding (id,(.),curry,uncurry,const,unzip) 9 | 10 | 11 | data FreeCat a b where 12 | Id :: FreeCat a a 13 | Comp :: FreeCat b c -> FreeCat a b -> FreeCat a c 14 | Par :: FreeCat a b -> FreeCat c d -> FreeCat (a,c) (b,d) 15 | Exl :: FreeCat (a,b) a 16 | Exr :: FreeCat (a,b) b 17 | Dup :: FreeCat a (a,a) 18 | 19 | data FreeCat' a b = Id' deriving Show 20 | 21 | instance Show (FreeCat a b) where 22 | show Id = "Id" 23 | show (Comp f g) = "(Comp" ++ (show f) ++ " " ++ (show g) ++ ")" 24 | show _ = "" 25 | 26 | instance Category (FreeCat) where 27 | -- type Ok (FreeCat) = () 28 | id = Id 29 | (.) = Comp 30 | 31 | instance Category (FreeCat') where 32 | -- type Ok (FreeCat) = () 33 | id = Id' 34 | (.) = undefined 35 | 36 | 37 | instance MonoidalPCat (FreeCat) where 38 | (***) = Par -- or default 39 | 40 | instance AssociativePCat (FreeCat) 41 | instance BraidedPCat (FreeCat) 42 | 43 | instance ProductCat (FreeCat) where 44 | -- type Prod (:>) = (:*) 45 | exl = Exl 46 | exr = Exr 47 | dup = Dup 48 | 49 | --instance UnitCat (FreeCat) 50 | 51 | -- instance OpCon (:+) (Sat GenBuses) where inOp = Entail (Sub Dict) 52 | 53 | -- instance CoproductCat (:>) where 54 | -- inl = namedC "inl" 55 | -- inr = namedC "inr" 56 | -- f ||| g = namedC "|||" 57 | {- 58 | instance CoproductPCat (:>) where 59 | inlP = namedC "inlP" 60 | inrP = namedC "inrP" 61 | jamP = namedC "jamP" 62 | -} 63 | 64 | freecat :: FreeCat a b -> FreeCat a b 65 | freecat = id 66 | 67 | main :: IO () 68 | main = do 69 | putStrLn $ show $ (toCcc' (\(x, y) -> (y, x))) ("larry", "fred")-- Conversion of lambda to itself. Seems to work 70 | -- putStrLn $ show $ freecat $ ((toCcc' (\x -> x))) -- Does not work 71 | putStrLn $ show $ (((toCcc' (\x -> x))) :: FreeCat a a ) -- does not work 72 | putStrLn $ show $ (id :: FreeCat' a a) -- works 73 | putStrLn $ show $ (id :: FreeCat a a) -- works 74 | -------------------------------------------------------------------------------- /stack.yaml: -------------------------------------------------------------------------------- 1 | # This file was automatically generated by 'stack init' 2 | # 3 | # Some commonly used options have been documented as comments in this file. 4 | # For advanced use and comprehensive documentation of the format, please see: 5 | # https://docs.haskellstack.org/en/stable/yaml_configuration/ 6 | 7 | # Resolver to choose a 'specific' stackage snapshot or a compiler version. 8 | # A snapshot resolver dictates the compiler version and the set of packages 9 | # to be used for project dependencies. For example: 10 | # 11 | # resolver: lts-3.5 12 | # resolver: nightly-2015-09-21 13 | # resolver: ghc-7.10.2 14 | # resolver: ghcjs-0.1.0_ghc-7.10.2 15 | # resolver: 16 | # name: custom-snapshot 17 | # location: "./custom-snapshot.yaml" 18 | resolver: lts-9.20 # lts-11.15 19 | 20 | # User packages to be built. 21 | # Various formats can be used as shown in the example below. 22 | # 23 | #packages: 24 | # - some-directory 25 | # - https://example.com/foo/bar/baz-0.0.2.tar.gz 26 | #- location: 27 | 28 | # - location: https://github.com/commercialhaskell/stack/commit/e7b331f14bcffb8367cd58fbfc8b40ec7642100a 29 | # extra-dep: true 30 | # subdirs: 31 | # - auto-update 32 | # - wai 33 | # 34 | # A package marked 'extra-dep: true' will only be built if demanded by a 35 | # non-dependency (i.e. a user package), and its test suites and benchmarks 36 | # will not be run. This is useful for tweaking upstream packages. 37 | packages: 38 | - . 39 | #- git: git@github.com/conal/concat 40 | # Dependency packages to be pulled from upstream that are not in the resolver 41 | # (e.g., acme-missiles-0.3) 42 | extra-deps: 43 | - git: https://github.com/conal/concat 44 | commit: 838b5a866c9932dc85996ba1391e72177df94cd7 45 | subdirs: 46 | - plugin 47 | - satisfy 48 | - classes 49 | - inline 50 | - vector-sized-1.0.3.0 51 | - indexed-list-literals-0.2.1.1 52 | - newtype-generics-0.5.3 53 | - pointed-5.0.1 54 | - keys-3.12 55 | - ghc-prim-0.5.2.0 56 | 57 | 58 | # Override default flag values for local packages and extra-deps 59 | # flags: {} 60 | 61 | # Extra package databases containing global packages 62 | # extra-package-dbs: [] 63 | 64 | # Control whether we use the GHC we find on the path 65 | # system-ghc: true 66 | # 67 | # Require a specific version of stack, using version ranges 68 | # require-stack-version: -any # Default 69 | # require-stack-version: ">=1.6" 70 | # 71 | # Override the architecture used by stack, especially useful on Windows 72 | # arch: i386 73 | # arch: x86_64 74 | # 75 | # Extra directories used by stack for building 76 | # extra-include-dirs: [/path/to/dir] 77 | # extra-lib-dirs: [/path/to/dir] 78 | # 79 | # Allow a newer minor version of GHC than the snapshot specifies 80 | # compiler-check: newer-minor --------------------------------------------------------------------------------