type-flip (empty) → 0.1.0.0
raw patch · 7 files changed
+124/−0 lines, 7 filesdep +basedep +type-flipsetup-changed
Dependencies added: base, type-flip
Files
- ChangeLog.md +3/−0
- LICENSE +30/−0
- README.md +2/−0
- Setup.hs +2/−0
- src/Data/Type/Flip.hs +34/−0
- test/Spec.hs +2/−0
- type-flip.cabal +51/−0
+ ChangeLog.md view
@@ -0,0 +1,3 @@+# Changelog for type-flip++## Unreleased changes
+ LICENSE view
@@ -0,0 +1,30 @@+Copyright Author name here (c) 2020++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 Author name here 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.
+ README.md view
@@ -0,0 +1,2 @@+# type-flip+Flip Foo a b = Foo b a
+ Setup.hs view
@@ -0,0 +1,2 @@+import Distribution.Simple+main = defaultMain
+ src/Data/Type/Flip.hs view
@@ -0,0 +1,34 @@+{-# LANGUAGE FlexibleContexts #-}+{-# OPTIONS_GHC -Wall -fno-warn-tabs #-}++module Data.Type.Flip where++newtype Flip t a b = Flip { unflip :: t b a } deriving Show++infixl 4 <$%>, <*%>++ffmap, (<$%>) :: Functor (Flip t c) => (a -> b) -> t a c -> t b c+ffmap f = unflip . fmap f . Flip+(<$%>) = ffmap++fpure :: Applicative (Flip t b) => a -> t a b+fpure = unflip . pure++(<*%>) :: Applicative (Flip t c) => t (a -> b) c -> t a c -> t b c+mf <*%> mx = unflip $ Flip mf <*> Flip mx++infixl 1 >>=%++(>>=%) :: Monad (Flip t c) => t a c -> (a -> t b c) -> t b c+m >>=% f = unflip $ Flip m >>= Flip . f++infixr 1 =<<%++(=<<%) :: Monad (Flip t c) => (a -> t b c) -> t a c -> t b c+(=<<%) = flip (>>=%)++ftraverse :: (Applicative (Flip s c), Traversable t) => (a -> s b c) -> t a -> s (t b) c+ftraverse f t = unflip $ traverse (Flip . f) t++fsequence :: (Applicative (Flip s c), Traversable t) => t (s a c) -> s (t a) c+fsequence tf = unflip . sequenceA $ Flip <$> tf
+ test/Spec.hs view
@@ -0,0 +1,2 @@+main :: IO ()+main = putStrLn "Test suite not yet implemented"
+ type-flip.cabal view
@@ -0,0 +1,51 @@+cabal-version: 1.12++-- This file has been generated from package.yaml by hpack version 0.35.2.+--+-- see: https://github.com/sol/hpack+--+-- hash: c0f44803f74add22aa0bb537e94694de4cc32d950abfbf2ad8d03fbe50e6fb75++name: type-flip+version: 0.1.0.0+description: Please see the README on GitHub at <https://github.com/githubuser/type-flip#readme>+category: Control+homepage: https://github.com/YoshikuniJujo/type-flip#readme+bug-reports: https://github.com/YoshikuniJujo/type-flip/issues+author: Yoshikuni Jujo+maintainer: yoshikuni.jujo@gmail.com+copyright: 2020 Yoshikuni Jujo+license: BSD3+license-file: LICENSE+build-type: Simple+extra-source-files:+ README.md+ ChangeLog.md++source-repository head+ type: git+ location: https://github.com/YoshikuniJujo/type-flip++library+ exposed-modules:+ Data.Type.Flip+ other-modules:+ Paths_type_flip+ hs-source-dirs:+ src+ build-depends:+ base >=4.7 && <5+ default-language: Haskell2010++test-suite type-flip-test+ type: exitcode-stdio-1.0+ main-is: Spec.hs+ other-modules:+ Paths_type_flip+ hs-source-dirs:+ test+ ghc-options: -threaded -rtsopts -with-rtsopts=-N+ build-depends:+ base >=4.7 && <5+ , type-flip+ default-language: Haskell2010