forked from polysemy-research/polysemy
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
0 parents
commit 9c8162a
Showing
12 changed files
with
526 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,3 @@ | ||
.stack-work/ | ||
too-fast-too-free.cabal | ||
*~ |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,3 @@ | ||
# Changelog for too-fast-too-free | ||
|
||
## Unreleased changes |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,30 @@ | ||
Copyright Sandy Maguire (c) 2019 | ||
|
||
All rights reserved. | ||
|
||
Redistribution and use in source and binary forms, with or without | ||
modification, are permitted provided that the following conditions are met: | ||
|
||
* Redistributions of source code must retain the above copyright | ||
notice, this list of conditions and the following disclaimer. | ||
|
||
* Redistributions in binary form must reproduce the above | ||
copyright notice, this list of conditions and the following | ||
disclaimer in the documentation and/or other materials provided | ||
with the distribution. | ||
|
||
* Neither the name of Sandy Maguire nor the names of other | ||
contributors may be used to endorse or promote products derived | ||
from this software without specific prior written permission. | ||
|
||
THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS | ||
"AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT | ||
LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR | ||
A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT | ||
OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, | ||
SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT | ||
LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, | ||
DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY | ||
THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT | ||
(INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE | ||
OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
# too-fast-too-free |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,2 @@ | ||
import Distribution.Simple | ||
main = defaultMain |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,6 @@ | ||
module Main where | ||
|
||
import Lib | ||
|
||
main :: IO () | ||
main = someFunc |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,48 @@ | ||
name: too-fast-too-free | ||
version: 0.1.0.0 | ||
github: "isovector/too-fast-too-free" | ||
license: BSD3 | ||
author: "Sandy Maguire" | ||
maintainer: "[email protected]" | ||
copyright: "2019 Sandy Maguire" | ||
|
||
extra-source-files: | ||
- README.md | ||
- ChangeLog.md | ||
|
||
# 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/isovector/too-fast-too-free#readme> | ||
|
||
dependencies: | ||
- base >= 4.7 && < 5 | ||
|
||
library: | ||
source-dirs: src | ||
|
||
executables: | ||
too-fast-too-free-exe: | ||
main: Main.hs | ||
source-dirs: app | ||
ghc-options: | ||
- -threaded | ||
- -rtsopts | ||
- -with-rtsopts=-N | ||
dependencies: | ||
- too-fast-too-free | ||
|
||
tests: | ||
too-fast-too-free-test: | ||
main: Spec.hs | ||
source-dirs: test | ||
ghc-options: | ||
- -threaded | ||
- -rtsopts | ||
- -with-rtsopts=-N | ||
dependencies: | ||
- too-fast-too-free |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,81 @@ | ||
{-# LANGUAGE DataKinds #-} | ||
{-# LANGUAGE FlexibleInstances #-} | ||
{-# LANGUAGE FunctionalDependencies #-} | ||
{-# LANGUAGE MultiParamTypeClasses #-} | ||
{-# LANGUAGE PolyKinds #-} | ||
{-# LANGUAGE TypeApplications #-} | ||
{-# LANGUAGE TypeFamilies #-} | ||
{-# LANGUAGE TypeOperators #-} | ||
{-# LANGUAGE UndecidableInstances #-} | ||
|
||
-- | | ||
-- Module: Data.OpenUnion | ||
-- Description: Open unions (type-indexed co-products) for extensible effects. | ||
-- Copyright: (c) 2016 Allele Dev; 2017 Ixperta Solutions s.r.o.; 2017 Alexis King | ||
-- License: BSD3 | ||
-- Maintainer: Alexis King <[email protected]> | ||
-- Stability: experimental | ||
-- Portability: GHC specific language extensions. | ||
-- | ||
-- Open unions (type-indexed co-products, i.e. type-indexed sums) for | ||
-- extensible effects All operations are constant-time. | ||
module Data.OpenUnion | ||
( -- * Open Union | ||
Union | ||
|
||
-- * Open Union Operations | ||
, Weakens(..) | ||
, (:++:) | ||
, decomp | ||
, weaken | ||
, extract | ||
|
||
-- * Open Union Membership Constraints | ||
, Member(..) | ||
, Members | ||
, LastMember | ||
) where | ||
|
||
import Data.Kind (Constraint) | ||
|
||
import Data.OpenUnion.Internal | ||
( Member(inj, prj) | ||
, Union | ||
, Weakens(weakens) | ||
, (:++:) | ||
, decomp | ||
, extract | ||
, weaken | ||
) | ||
|
||
-- | A shorthand constraint that represents a combination of multiple 'Member' | ||
-- constraints. That is, the following 'Members' constraint: | ||
-- | ||
-- @ | ||
-- 'Members' '[Foo, Bar, Baz] effs | ||
-- @ | ||
-- | ||
-- …is equivalent to the following set of 'Member' constraints: | ||
-- | ||
-- @ | ||
-- ('Member' Foo effs, 'Member' Bar effs, 'Member' baz effs) | ||
-- @ | ||
-- | ||
-- Note that, since each effect is translated into a separate 'Member' | ||
-- constraint, the order of the effects does /not/ matter. | ||
type family Members effs effs' :: Constraint where | ||
Members (eff ': effs) effs' = (Member eff effs', Members effs effs') | ||
Members '[] effs' = () | ||
|
||
-- | Like 'Member', @'LastMember' eff effs@ is a constraint that requires that | ||
-- @eff@ is in the type-level list @effs@. However, /unlike/ 'Member', | ||
-- 'LastMember' requires @m@ be the __final__ effect in @effs@. | ||
-- | ||
-- Generally, this is not especially useful, since it is preferable for | ||
-- computations to be agnostic to the order of effects, but it is quite useful | ||
-- in combination with 'Control.Monad.Freer.sendM' or | ||
-- 'Control.Monad.Base.liftBase' to embed ordinary monadic effects within an | ||
-- 'Control.Monad.Freer.Eff' computation. | ||
class Member m effs => LastMember m effs | effs -> m | ||
instance {-# OVERLAPPABLE #-} LastMember m effs => LastMember m (eff ': effs) | ||
instance LastMember m (m ': '[]) |
Oops, something went wrong.