CPL 0.0.8 → 0.0.9
raw patch · 11 files changed
+138/−57 lines, 11 files
Files
- .travis.yml +28/−9
- CPL.cabal +14/−2
- README.markdown +2/−2
- appveyor.yml +33/−36
- build_bdist_linux.sh +1/−1
- misc/build_zip.hs +53/−0
- src/Main.hs +3/−3
- src/Subst.hs +1/−1
- src/Typing.hs +1/−1
- windows/CPL.wxs +1/−1
- windows/build_zip.hs +1/−1
.travis.yml view
@@ -12,15 +12,18 @@ matrix: include:- - env: CABALVER=1.16 GHCVER=7.6.3- compiler: ": #GHC 7.6.3"- addons: {apt: {packages: [cabal-install-1.16,ghc-7.6.3,alex-3.1.4,happy-1.19.5], sources: [hvr-ghc]}}- - env: CABALVER=1.18 GHCVER=7.8.3 COVERAGE=1- compiler: ": #GHC 7.8.3"- addons: {apt: {packages: [cabal-install-1.18,ghc-7.8.3,alex-3.1.4,happy-1.19.5], sources: [hvr-ghc]}}- - env: CABALVER=1.22 GHCVER=7.10.2- compiler: ": #GHC 7.10.2"- addons: {apt: {packages: [cabal-install-1.22,ghc-7.10.2,alex-3.1.4,happy-1.19.5], sources: [hvr-ghc]}}+ - env: CABALVER=1.18 GHCVER=7.8.4 COVERAGE=1+ compiler: ": #GHC 7.8.4"+ addons: {apt: {packages: [cabal-install-1.18,ghc-7.8.4,alex-3.1.4,happy-1.19.5], sources: [hvr-ghc]}}+ - env: CABALVER=1.22 GHCVER=7.10.3+ compiler: ": #GHC 7.10.3"+ addons: {apt: {packages: [cabal-install-1.22,ghc-7.10.3,alex-3.1.4,happy-1.19.5], sources: [hvr-ghc]}}+ - env: CABALVER=1.24 GHCVER=8.0.2+ compiler: ": #GHC 8.0.2"+ addons: {apt: {packages: [cabal-install-1.24,ghc-8.0.2,alex-3.1.4,happy-1.19.5], sources: [hvr-ghc]}}+ - env: CABALVER=2.0 GHCVER=8.2.2+ compiler: ": #GHC 8.2.2"+ addons: {apt: {packages: [cabal-install-2.0,ghc-8.2.2,alex-3.1.7,happy-1.19.5], sources: [hvr-ghc]}} before_install: - unset CC@@ -77,3 +80,19 @@ # `cabal install --force-reinstalls dist/*-*.tar.gz` - SRC_TGZ=$(cabal info . | awk '{print $2;exit}').tar.gz && (cd dist && cabal install --force-reinstalls "$SRC_TGZ")++before_deploy:+ - cp dist/build/cpl/cpl ./+ - cabal install turtle+ - runghc misc/build_zip.hs++deploy:+ provider: releases+ api_key:+ secure: "hBzyr9MKoa7xYcxjiiEEa+EgOmD/Fi314ojXB0zz6urcxTXzljLQt705r6Ev+2xlRpXlcpxPbpIAz/Quyzrt7grvuHv1K43ZGEh1QrzUQ7X+ke6gjfgwUAOe37BHUtYR5Dd+THJ2HfAJ5nndFbzfnK5tkkxFk+BuDlUVQlIGw00="+ file_glob: true+ file: '*.zip'+ skip_cleanup: true+ on:+ tags: true+ condition: "$GHCVER = 8.2.2"
CPL.cabal view
@@ -1,13 +1,24 @@ Name: CPL-Version: 0.0.8+Version: 0.0.9 License: BSD3 License-File: COPYING Author: Masahiro Sakai (masahiro.sakai@gmail.com) Maintainer: masahiro.sakai@gmail.com Category: Compilers/Interpreters Cabal-Version: >=1.10+Homepage: https://github.com/msakai/cpl Synopsis: An interpreter of Hagino's Categorical Programming Language (CPL).-Description: An interpreter of Hagino's Categorical Programming Language (CPL).+Description:+ CPL is a functional programming language based on category+ theory. Data types are declared in a categorical manner by+ adjunctions. Data types that can be handled include the terminal+ object, the initial object, the binary product functor, the binary+ coproduct functor, the exponential functor, the natural number object,+ the functor for finite lists, and the functor for infinite lists.+ Each data type is declared with its basic operations or+ morphisms. Programs consist of these morphisms, and execution of+ programs is the reduction of elements (i.e. special morphisms) to+ their canonical form. Extra-Source-Files: README.markdown, CHANGELOG.markdown,@@ -29,6 +40,7 @@ windows/CPL.wxs, windows/build_msi.hs, windows/build_zip.hs,+ misc/build_zip.hs, build_bdist_linux.sh Build-Type: Simple
README.markdown view
@@ -1,7 +1,7 @@ An implementation of "A Categorical Programing Language" ======================================================== -[](http://travis-ci.org/msakai/cpl) [](https://ci.appveyor.com/project/msakai/cpl/branch/master) [](https://hackage.haskell.org/package/CPL)+[](http://travis-ci.org/msakai/cpl) [](https://ci.appveyor.com/project/msakai/cpl/branch/master) [](https://hackage.haskell.org/package/CPL) This package is an implementation of "A Categorical Programing Language" (CPL for short)[1][2] written in Haskell.@@ -53,7 +53,7 @@ (1) Tatsuya Hagino, “A Categorical Programming Languge”. Ph.D. Thesis, University of Edinburgh, 1987- available at <http://www.tom.sfc.keio.ac.jp/~hagino/index.html.en>+ available at <http://web.sfc.keio.ac.jp/~hagino/index.html.en> (2) Tatsuya Hagino, “Categorical Functional Programming Language”. Computer Software, Vol 7, No.1.
appveyor.yml view
@@ -1,56 +1,53 @@+cache:+- "c:\\sr" # stack root, short paths == less problems++# to disable automatic builds+#build: off+ platform: - x86 - x64 +environment:+ global:+ STACK_ROOT: "c:\\sr"+ install:+- if %PLATFORM%==x86 (curl -ostack.zip -L --insecure http://www.stackage.org/stack/windows-i386) else (curl -ostack.zip -L --insecure http://www.stackage.org/stack/windows-x86_64)+- 7z x stack.zip stack.exe+- stack --resolver=lts-9.21 setup > nul - ps: |- # This is necessary because AppVeyor uses 64 bit environemnt even if "platform: x86" is specified.- # see also <http://help.appveyor.com/discussions/questions/213-platform-x86-is-not-32-bit>- if ("x86".Equals(${env:PLATFORM})) {- $env:HPChocoOptions = "--x86"- $env:HPPath = "${env:ProgramFiles(x86)}\Haskell Platform\7.10.3"- Invoke-WebRequest -Uri https://haskell.org/platform/download/7.10.3/HaskellPlatform-7.10.3-i386-setup.exe -OutFile HaskellPlatform-7.10.3-i386-setup.exe- .\HaskellPlatform-7.10.3-i386-setup.exe /S- } else {- $env:HPChocoOptions = ""- $env:HPPath = "${env:ProgramFiles}\Haskell Platform\7.10.3"- Invoke-WebRequest -Uri https://haskell.org/platform/download/7.10.3/HaskellPlatform-7.10.3-x86_64-setup.exe -OutFile HaskellPlatform-7.10.3-x86_64-setup.exe- .\HaskellPlatform-7.10.3-x86_64-setup.exe /S- }- # choco install ${env:HPChocoOptions} haskellplatform -version 2014.2.0.0 -y- # Haskell Platfrom package doesn't update PATH for the current shell instance- $env:Path += ";${env:HPPath}\bin"- $env:Path += ";${env:HPPath}\lib\extralibs\bin"- $env:Path += ";${env:HPPath}\mingw\bin"- $env:Path += ";.\.cabal-sandbox\bin"- choco install wixtoolset -version 3.10.1.2213 -y- $env:Path += ";${env:ProgramFiles}\WiX Toolset v3.10\bin"- $env:Path += ";${env:ProgramFiles(x86)}\WiX Toolset v3.10\bin"-- cabal sandbox init-- cabal update-- cabal install --only-dependencies --enable-tests --enable-benchmarks -fHaskeline -f-Readline+ choco --no-progress install wixtoolset -version 3.11.1 -y+ $env:Path += ";${env:ProgramFiles}\WiX Toolset v3.11\bin"+ $env:Path += ";${env:ProgramFiles(x86)}\WiX Toolset v3.11\bin" build_script:-- cabal configure --enable-tests --enable-benchmarks -fHaskeline -f-Readline -v2 # -v2 provides useful information for debugging-- cabal build+# The ugly echo "" hack is to avoid complaints about 0 being an invalid file+# descriptor+- echo "" | stack --resolver=lts-9.21 --no-terminal test --bench --no-run-benchmarks --flag CPL:Haskeline --flag CPL:-Readline -after_build:+after_test:+- ps: cp "$(./stack --resolver=lts-9.21 path --local-install-root)/bin/cpl.exe" cpl.exe - cmd: | cd windows echo Creating msi...- runhaskell build_msi.hs+ ..\stack --resolver=lts-9.21 runhaskell --package turtle build_msi.hs echo Creating zip...- cabal install turtle- runhaskell build_zip.hs+ ..\stack --resolver=lts-9.21 runhaskell --package turtle build_zip.hs cd .. -test_script:-- cabal test-- cabal check-- cabal sdist- artifacts: - path: windows\*.msi name: Windows Installer - path: windows\*.zip name: Portable Binary Package++deploy:+- provider: GitHub+ auth_token:+ secure: F8cldz47mQ0lW3O9uCEneU5LRklWcKw8JbPuh5BDYA2TfyeqC//GO8vl8/wmBy3Z+ artifact: Windows Installer, Portable Binary Package+ force_update: true+ release: $(appveyor_repo_tag_name)+ on:+ appveyor_repo_tag: true
build_bdist_linux.sh view
@@ -12,7 +12,7 @@ cabal sandbox init cabal update-cabal install -p --only-dependencies -f-Haskeline -f-Readline+cabal install --only-dependencies -f-Haskeline -f-Readline cabal configure -fLinuxStatic -f-Haskeline -f-Readline cabal build
+ misc/build_zip.hs view
@@ -0,0 +1,53 @@+{-# OPTIONS_GHC -Wall #-}+{-# LANGUAGE ScopedTypeVariables, OverloadedStrings #-}+import Control.Exception+import Control.Monad+import Data.String+import Distribution.Package+import Distribution.PackageDescription+import Distribution.PackageDescription.Parse+import Distribution.Verbosity+import Distribution.Version+import qualified System.Info as SysInfo+import System.Process+import Turtle hiding (FilePath)++getGitHash :: IO (Maybe String)+getGitHash =+ liftM (Just . takeWhile (/='\n')) (readProcess "git" ["rev-parse", "--short", "HEAD"] "")+ `catch` \(_::SomeException) -> return Nothing++getVersion :: FilePath -> IO Version+getVersion cabalFile = do+ pkg <- readPackageDescription silent cabalFile+ return $ pkgVersion $ package $ packageDescription $ pkg++main :: IO ()+main = do+ gitHashMaybe <- getGitHash+ version <- getVersion "CPL.cabal"+ let suffix_githash =+ case gitHashMaybe of+ Nothing -> ""+ Just gitHash -> "_" ++ gitHash+ dir :: IsString a => a+ dir = fromString $ "CPL-" ++ showVersion version ++ suffix_githash ++ "-" ++ SysInfo.os ++ "-" ++ SysInfo.arch++ let binDir = dir </> "bin"+ samplesDir = dir </> "samples"+ zipFile :: IsString a => a+ zipFile = fromString (dir ++ ".zip")+ testfile zipFile >>= \b -> when b (rm zipFile)+ testfile dir >>= \b -> when b (rmtree dir)+ mktree dir+ mktree binDir+ mktree samplesDir+ cp ("cpl") (binDir </> "cpl")+ sh $ do+ fpath <- ls "samples"+ cp fpath (samplesDir </> filename fpath)+ cp "COPYING" (dir </> "COPYING")+ cp "README.markdown" (dir </> "README.markdown")+ cp "CHANGELOG.markdown" (dir </> "CHANGELOG.markdown")+ procs "zip" ["-r", zipFile, dir] empty+ return ()
src/Main.hs view
@@ -30,7 +30,7 @@ import System.Environment import System.Exit import System.IO-import Control.Monad.Error+import Control.Monad.Except import Control.Monad.State.Strict -- haskeline's MonadException requries strict version import System.Console.GetOpt #if defined(USE_READLINE_PACKAGE)@@ -85,7 +85,7 @@ ---------------------------------------------------------------------------- -type UI a = ErrorT String (StateT UIState Console) a+type UI a = ExceptT String (StateT UIState Console) a readLine :: String -> UI String readLine prompt = lift $ lift $ readLine' prompt@@ -388,7 +388,7 @@ | ShowVersion `elem` opts -> putStrLn $ showVersion version (opts,files,[]) -> runConsole $ flip evalStateT initialState $ do- ret <- runErrorT $ do+ ret <- runExceptT $ do printLines banner mapM_ processOpt opts mapM_ cmdLoad files
src/Subst.hs view
@@ -28,7 +28,7 @@ import FE import {-# SOURCE #-} CDT (_eqCDT) -import Control.Monad.Error+import Control.Monad.Except import Data.List (nub, intersect) import Data.Maybe (fromMaybe)
src/Typing.hs view
@@ -25,7 +25,7 @@ import Data.List (nub) import Control.Applicative-import Control.Monad.Error+import Control.Monad.Except import Control.Monad.RWS import qualified Data.Map as Map
windows/CPL.wxs view
@@ -17,7 +17,7 @@ <Directory Id="INSTALLDIR" Name="CPL"> <Directory Id="BINDIR" Name="bin"> <Component Id="MainExecutable" Guid="6E979ACB-D17F-4C9D-8BA0-041FD0D5E987"> - <File Id="cplEXE" Name="cpl.exe" Source="..\dist\build\cpl\cpl.exe" /> + <File Id="cplEXE" Name="cpl.exe" Source="..\cpl.exe" /> </Component> </Directory> <Directory Id="SAMPLES" Name="samples">
windows/build_zip.hs view
@@ -42,7 +42,7 @@ mktree dir mktree binDir mktree samplesDir- cp "../dist/build/cpl/cpl.exe" (binDir </> "cpl.exe")+ cp ("../cpl.exe") (binDir </> "cpl.exe") sh $ do fpath <- ls "../samples" cp fpath (samplesDir </> filename fpath)