packages feed

ftcqueue (empty) → 0.1.0.0

raw patch · 7 files changed

+168/−0 lines, 7 filesdep +basedep +ftcqueuesetup-changed

Dependencies added: base, ftcqueue

Files

+ CHANGELOG.md view
@@ -0,0 +1,11 @@+# Changelog for `ftcqueue`++All notable changes to this project will be documented in this file.++The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/),+and this project adheres to the+[Haskell Package Versioning Policy](https://pvp.haskell.org/).++## Unreleased++## 0.1.0.0 - YYYY-MM-DD
+ LICENSE view
@@ -0,0 +1,26 @@+Copyright 2025 Yoshikuni Jujo++Redistribution and use in source and binary forms, with or without+modification, are permitted provided that the following conditions are met:++1.  Redistributions of source code must retain the above copyright notice, this+    list of conditions and the following disclaimer.++2.  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.++3.  Neither the name of the copyright holder nor the names of its 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 HOLDER 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,32 @@+# ftcqueue++## See++https://okmij.org/ftp/Haskell/zseq.pdf++## Sample Code++```Haskell+module Main (main) where++import Data.Time+import Data.FTCQueue++import Lib++main :: IO ()+main = foo `apply` ()++foo :: Q IO () ()+foo = singleton (const getLine) |> addTime |> putStrLn++addTime :: String -> IO String+addTime msg = do+	ct <- getCurrentTime+	pure $ msg ++ " (" ++ show ct ++ ")"++apply :: Monad t => Q t a b -> a -> t b+q `apply` x = case viewl q of+	One f -> f x+	f :| q' -> f x >>= (q' `apply`)+```
+ Setup.hs view
@@ -0,0 +1,2 @@+import Distribution.Simple+main = defaultMain
+ ftcqueue.cabal view
@@ -0,0 +1,53 @@+cabal-version: 2.2++-- This file has been generated from package.yaml by hpack version 0.38.1.+--+-- see: https://github.com/sol/hpack++name:           ftcqueue+version:        0.1.0.0+description:    Please see the README on GitHub at <https://github.com/YoshikuniJujo/ftcqueue#readme>+homepage:       https://github.com/YoshikuniJujo/ftcqueue#readme+bug-reports:    https://github.com/YoshikuniJujo/ftcqueue/issues+author:         Yoshikuni Jujo+maintainer:     yoshikuni.jujo@gmail.com+copyright:      (c) 2025 Yoshikuni Jujo+license:        BSD-3-Clause+license-file:   LICENSE+build-type:     Simple+extra-source-files:+    README.md+    CHANGELOG.md++source-repository head+  type: git+  location: https://github.com/YoshikuniJujo/ftcqueue++library+  exposed-modules:+      Data.FTCQueue+  other-modules:+      Paths_ftcqueue+  autogen-modules:+      Paths_ftcqueue+  hs-source-dirs:+      src+  ghc-options: -Wall -Wcompat -Widentities -Wincomplete-record-updates -Wincomplete-uni-patterns -Wmissing-export-lists -Wmissing-home-modules -Wpartial-fields -Wredundant-constraints+  build-depends:+      base >=4.7 && <5+  default-language: Haskell2010++test-suite ftcqueue-test+  type: exitcode-stdio-1.0+  main-is: Spec.hs+  other-modules:+      Paths_ftcqueue+  autogen-modules:+      Paths_ftcqueue+  hs-source-dirs:+      test+  ghc-options: -Wall -Wcompat -Widentities -Wincomplete-record-updates -Wincomplete-uni-patterns -Wmissing-export-lists -Wmissing-home-modules -Wpartial-fields -Wredundant-constraints -threaded -rtsopts -with-rtsopts=-N+  build-depends:+      base >=4.7 && <5+    , ftcqueue+  default-language: Haskell2010
+ src/Data/FTCQueue.hs view
@@ -0,0 +1,42 @@+{-# LANGUAGE ExistentialQuantification #-}+{-# OPTIONS_GHC -Wall -fno-warn-tabs #-}++module Data.FTCQueue (++	-- * Q TYPE++	Q,++	-- * CONSTRUCTION++	singleton, (|>), (><),++	-- * VIEW++	viewl, ViewL(..)++	) where++data Q t a b = Leaf (a -> t b) | forall x . Node !(Q t a x) !(Q t x b)++singleton :: (a -> t b) -> Q t a b+singleton = Leaf++infixl 5 |>+infixr 5 ><, :|++(|>) :: Q t a b -> (b -> t c) -> Q t a c+(|>) = (. Leaf) . Node++(><) :: Q t a b -> Q t b c -> Q t a c+(><) = Node++data ViewL t a b = One (a -> t b) | forall x . (a -> t x) :| !(Q t x b)++viewl :: Q t a b -> ViewL t a b+viewl (Leaf f) = One f+viewl (Node l0 r0) = go l0 r0+	where+	go :: Q t a x -> Q t x b -> ViewL t a b+	go (Leaf f) r = f :| r+	go (Node ll lr) r = go ll (Node lr r)
+ test/Spec.hs view
@@ -0,0 +1,2 @@+main :: IO ()+main = putStrLn "Test suite not yet implemented"