mirror of
https://github.com/ilyakooo0/semi-iso-optics.git
synced 2024-10-26 08:19:54 +03:00
parent
3344a29fdc
commit
d57c98798d
53
.gitignore
vendored
53
.gitignore
vendored
@ -1,48 +1,23 @@
|
||||
# Created by https://www.gitignore.io
|
||||
|
||||
### Haskell ###
|
||||
dist
|
||||
dist-*
|
||||
cabal-dev
|
||||
*.o
|
||||
*.hi
|
||||
*.hie
|
||||
*.chi
|
||||
*.chs.h
|
||||
.virtualenv
|
||||
*.dyn_o
|
||||
*.dyn_hi
|
||||
.hpc
|
||||
.hsenv
|
||||
.cabal-sandbox/
|
||||
cabal.sandbox.config
|
||||
cabal.config
|
||||
|
||||
|
||||
### Emacs ###
|
||||
# -*- mode: gitignore; -*-
|
||||
*~
|
||||
\#*\#
|
||||
/.emacs.desktop
|
||||
/.emacs.desktop.lock
|
||||
*.elc
|
||||
auto-save-list
|
||||
tramp
|
||||
.\#*
|
||||
|
||||
# Org-mode
|
||||
.org-id-locations
|
||||
*_archive
|
||||
|
||||
# flymake-mode
|
||||
*_flymake.*
|
||||
|
||||
# eshell files
|
||||
/eshell/history
|
||||
/eshell/lastdir
|
||||
|
||||
# elpa packages
|
||||
/elpa/
|
||||
|
||||
# reftex files
|
||||
*.rel
|
||||
|
||||
# AUCTeX auto folder
|
||||
/auto/
|
||||
|
||||
.stack-work
|
||||
*.prof
|
||||
*.aux
|
||||
*.hp
|
||||
*.eventlog
|
||||
.stack-work/
|
||||
cabal.project.local
|
||||
cabal.project.local~
|
||||
.HTF/
|
||||
.ghc.environment.*
|
||||
|
1
LICENSE
1
LICENSE
@ -1,4 +1,5 @@
|
||||
Copyright (c) 2014 Paweł Nowak
|
||||
Copyright (c) 2019 Ilya Kostyuchenko
|
||||
|
||||
Permission is hereby granted, free of charge, to any person obtaining
|
||||
a copy of this software and associated documentation files (the
|
||||
|
45
package.yaml
Normal file
45
package.yaml
Normal file
@ -0,0 +1,45 @@
|
||||
name: semi-iso
|
||||
version: 0.1.0.0
|
||||
github: "ilyakooo0/semi-iso-optics"
|
||||
license: MIT
|
||||
author: "Ilya Kostyuchenko"
|
||||
maintainer: "ilyakooo0@gmail.com"
|
||||
copyright: "2019 Ilya Kostyuchenko, 2014 Paweł Nowak"
|
||||
|
||||
extra-source-files: []
|
||||
|
||||
# Metadata used when publishing your package
|
||||
# synopsis: Short description of your package
|
||||
# category: Web
|
||||
|
||||
# To avoid duplicated efforts in documentation and dealing with the
|
||||
# complications of embedding Haddock markup inside cabal files, it is
|
||||
# common to point users to the README.md file.
|
||||
description: Please see the README on GitHub at <https://github.com/ilyakooo0/semi-iso-optics#readme>
|
||||
|
||||
dependencies:
|
||||
- base >= 4.7 && < 5
|
||||
- profunctors
|
||||
- transformers
|
||||
- lens
|
||||
- semigroupoids
|
||||
|
||||
library:
|
||||
source-dirs: src
|
||||
exposed-modules:
|
||||
- Control.Lens.SemiIso
|
||||
- Control.Lens.Internal.SemiIso
|
||||
- Control.SIArrow
|
||||
- Control.Category.Reader
|
||||
- Control.Category.Structures
|
||||
- Data.Profunctor.Exposed
|
||||
ghc-options:
|
||||
- -Wall
|
||||
- -Wincomplete-uni-patterns
|
||||
- -Wincomplete-record-updates
|
||||
- -Wpartial-fields
|
||||
- -Werror=missing-home-modules
|
||||
- -Wmissing-home-modules
|
||||
- -Widentities
|
||||
- -Wredundant-constraints
|
||||
- -Wmissing-export-lists
|
111
semi-iso.cabal
111
semi-iso.cabal
@ -1,77 +1,44 @@
|
||||
name: semi-iso
|
||||
version: 1.0.0.0
|
||||
synopsis: Weakened partial isomorphisms, reversible computations.
|
||||
description:
|
||||
Semi-isomorphisms are partial isomorphisms with weakened iso laws. They are a basic
|
||||
building block of reversible computations. And they work with Iso and Prism from @lens@!
|
||||
.
|
||||
The module "Control.Lens.SemiIso" defines semi-isomorphisms and provides some
|
||||
basic semi-isos and combinators. A @SemiIso' a b@ can be applied in both directions
|
||||
to get a @a -> Either String b@ and @b -> Either String a@. SemiIsos can be composed
|
||||
with Isos and Prisms (to get another SemiIso). Isos and Prisms can be directly
|
||||
used as SemiIsos.
|
||||
.
|
||||
Semi-isomorphisms obey weaker laws then isomorphisms. We require only
|
||||
.
|
||||
> apply f >=> unapply f >=> apply f = apply f
|
||||
> unapply f >=> apply f >=> unapply f = unapply f
|
||||
.
|
||||
instead of
|
||||
.
|
||||
> apply f >=> unapply f = f
|
||||
> unapply f >=> apply f = f
|
||||
.
|
||||
Modules "Control.SIArrow" and "Control.Category.Structures" define an @Arrow@-like class
|
||||
hierarchy. Unfortunately "Control.Arrow" cannot be used, as it is too restrictive (the
|
||||
dreaded @arr@).
|
||||
cabal-version: 1.12
|
||||
|
||||
SIArrow abstracts categories of reversible computations (with reversible side effects). In
|
||||
the case of parsing and pretty-printing using the "syntax" library if we have an arrow
|
||||
@SIArrow cat => cat a b@ then we can:
|
||||
.
|
||||
* Evaluate it from left to right, turning a value of type @a@ into a value of type @b@,
|
||||
with the side effect of consuming a sequence. (Parsing)
|
||||
.
|
||||
* Evaluate it from right to left, turning a value of type @b@ into a value of type @a@,
|
||||
with the side effect of generating a sequence. (Pretty-printing)
|
||||
.
|
||||
In the particular case of parsing/pretty-printing the type @a@ will be usually @()@, e.g.
|
||||
we just produce a value during parsing and just consume a value during pretty-printing.
|
||||
To support this style we define a functor and applicative structure on @cat () b@, for example
|
||||
'/*/' (equivalent of '<*>') has type @(\/*\/) :: SIArrow cat => cat () a -> cat () b -> cat () (a, b)@.
|
||||
.
|
||||
When more power then applicative is needed - for example when the syntax depends on the
|
||||
parsed value - we turn back to arrow composition.
|
||||
.
|
||||
Module "Control.Category.Reader" defines a Reader category transformer. It is like a monad
|
||||
transformer, but for categories. The next version will include some more transformers and
|
||||
mtl-style classes.
|
||||
license: MIT
|
||||
license-file: LICENSE
|
||||
author: Paweł Nowak
|
||||
maintainer: Paweł Nowak <pawel834@gmail.com>
|
||||
copyright: Paweł Nowak 2014
|
||||
category: Control, Data
|
||||
build-type: Simple
|
||||
cabal-version: >=1.11
|
||||
Tested-with: GHC==8.0.2, GHC==8.2.2, GHC==8.4.3, GHC==8.6.1
|
||||
-- This file has been generated from package.yaml by hpack version 0.31.2.
|
||||
--
|
||||
-- see: https://github.com/sol/hpack
|
||||
--
|
||||
-- hash: 9fe627e0673c25d1622d6bbc274fa58649b56cc4796f5b740e346f1496b40f1a
|
||||
|
||||
name: semi-iso
|
||||
version: 0.1.0.0
|
||||
description: Please see the README on GitHub at <https://github.com/ilyakooo0/semi-iso-optics#readme>
|
||||
homepage: https://github.com/ilyakooo0/semi-iso-optics#readme
|
||||
bug-reports: https://github.com/ilyakooo0/semi-iso-optics/issues
|
||||
author: Ilya Kostyuchenko
|
||||
maintainer: ilyakooo0@gmail.com
|
||||
copyright: 2019 Ilya Kostyuchenko, 2014 Paweł Nowak
|
||||
license: MIT
|
||||
license-file: LICENSE
|
||||
build-type: Simple
|
||||
|
||||
source-repository head
|
||||
type: git
|
||||
location: git@github.com:Pawel834/semi-iso.git
|
||||
type: git
|
||||
location: https://github.com/ilyakooo0/semi-iso-optics
|
||||
|
||||
library
|
||||
exposed-modules: Control.Lens.SemiIso
|
||||
Control.Lens.Internal.SemiIso
|
||||
Control.SIArrow
|
||||
Control.Category.Reader
|
||||
Control.Category.Structures
|
||||
Data.Profunctor.Exposed
|
||||
Control.Tuple.Morph
|
||||
build-depends: base >= 4.9 && <4.13
|
||||
, profunctors == 5.*
|
||||
, transformers
|
||||
, lens == 4.*
|
||||
, semigroupoids
|
||||
default-language: Haskell2010
|
||||
ghc-options: -Wall
|
||||
exposed-modules:
|
||||
Control.Lens.SemiIso
|
||||
Control.Lens.Internal.SemiIso
|
||||
Control.SIArrow
|
||||
Control.Category.Reader
|
||||
Control.Category.Structures
|
||||
Data.Profunctor.Exposed
|
||||
other-modules:
|
||||
Paths_semi_iso
|
||||
hs-source-dirs:
|
||||
src
|
||||
ghc-options: -Wall -Wincomplete-uni-patterns -Wincomplete-record-updates -Wpartial-fields -Werror=missing-home-modules -Wmissing-home-modules -Widentities -Wredundant-constraints -Wmissing-export-lists
|
||||
build-depends:
|
||||
base >=4.7 && <5
|
||||
, lens
|
||||
, profunctors
|
||||
, semigroupoids
|
||||
, transformers
|
||||
default-language: Haskell2010
|
||||
|
69
stack.yaml
Normal file
69
stack.yaml
Normal file
@ -0,0 +1,69 @@
|
||||
# This file was automatically generated by 'stack init'
|
||||
#
|
||||
# Some commonly used options have been documented as comments in this file.
|
||||
# For advanced use and comprehensive documentation of the format, please see:
|
||||
# https://docs.haskellstack.org/en/stable/yaml_configuration/
|
||||
|
||||
# Resolver to choose a 'specific' stackage snapshot or a compiler version.
|
||||
# A snapshot resolver dictates the compiler version and the set of packages
|
||||
# to be used for project dependencies. For example:
|
||||
#
|
||||
# resolver: lts-3.5
|
||||
# resolver: nightly-2015-09-21
|
||||
# resolver: ghc-7.10.2
|
||||
#
|
||||
# The location of a snapshot can be provided as a file or url. Stack assumes
|
||||
# a snapshot provided as a file might change, whereas a url resource does not.
|
||||
#
|
||||
# resolver: ./custom-snapshot.yaml
|
||||
# resolver: https://example.com/snapshots/2018-01-01.yaml
|
||||
resolver: lts-14.6
|
||||
|
||||
# User packages to be built.
|
||||
# Various formats can be used as shown in the example below.
|
||||
#
|
||||
# packages:
|
||||
# - some-directory
|
||||
# - https://example.com/foo/bar/baz-0.0.2.tar.gz
|
||||
# subdirs:
|
||||
# - auto-update
|
||||
# - wai
|
||||
packages:
|
||||
- .
|
||||
# Dependency packages to be pulled from upstream that are not in the resolver.
|
||||
# These entries can reference officially published versions as well as
|
||||
# forks / in-progress versions pinned to a git hash. For example:
|
||||
#
|
||||
# extra-deps:
|
||||
# - acme-missiles-0.3
|
||||
# - git: https://github.com/commercialhaskell/stack.git
|
||||
# commit: e7b331f14bcffb8367cd58fbfc8b40ec7642100a
|
||||
#
|
||||
# extra-deps: []
|
||||
|
||||
# Override default flag values for local packages and extra-deps
|
||||
# flags: {}
|
||||
|
||||
# Extra package databases containing global packages
|
||||
# extra-package-dbs: []
|
||||
|
||||
# Control whether we use the GHC we find on the path
|
||||
# system-ghc: true
|
||||
#
|
||||
# Require a specific version of stack, using version ranges
|
||||
# require-stack-version: -any # Default
|
||||
# require-stack-version: ">=2.1"
|
||||
#
|
||||
# Override the architecture used by stack, especially useful on Windows
|
||||
# arch: i386
|
||||
# arch: x86_64
|
||||
#
|
||||
# Extra directories used by stack for building
|
||||
# extra-include-dirs: [/path/to/dir]
|
||||
# extra-lib-dirs: [/path/to/dir]
|
||||
#
|
||||
# Allow a newer minor version of GHC than the snapshot specifies
|
||||
# compiler-check: newer-minor
|
||||
|
||||
ghc-options:
|
||||
"$locals": -ddump-to-file -ddump-hi -fwarn-unused-binds -fwarn-unused-imports
|
Loading…
Reference in New Issue
Block a user