opentheory-stream (empty) → 1.42
raw patch · 4 files changed
+74/−0 lines, 4 filesdep +QuickCheckdep +basedep +opentheorysetup-changed
Dependencies added: QuickCheck, base, opentheory, opentheory-primitive
Files
- LICENSE +17/−0
- Setup.hs +6/−0
- opentheory-stream.cabal +27/−0
- src/OpenTheory/Stream.hs +24/−0
+ LICENSE view
@@ -0,0 +1,17 @@+Permission is hereby granted, free of charge, to any person obtaining a copy+of this software and associated documentation files (the "Software"), to deal+in the Software without restriction, including without limitation the rights+to use, copy, modify, merge, publish, distribute, sublicense, and/or sell+copies of the Software, and to permit persons to whom the Software is+furnished to do so, subject to the following conditions:++The above copyright notice and this permission notice shall be included in+all copies or substantial portions of the Software.++THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR+IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,+FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE+AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER+LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,+OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN+THE SOFTWARE.
+ Setup.hs view
@@ -0,0 +1,6 @@+module Main(main)++import Distribution.Simple++main :: IO ()+main = defaultMain
+ opentheory-stream.cabal view
@@ -0,0 +1,27 @@+name: opentheory-stream+version: 1.42+category: List+synopsis: Infinite stream types+license: MIT+license-file: LICENSE+cabal-version: >= 1.8.0.2+build-type: Simple+author: Joe Leslie-Hurd <joe@gilith.com>+maintainer: Joe Leslie-Hurd <joe@gilith.com>+description:+ Infinite stream types - this package was automatically generated from the+ OpenTheory package stream-1.42++library+ build-depends:+ base >= 4.0 && < 5.0,+ QuickCheck >= 2.4.0.1 && < 3.0,+ opentheory-primitive >= 1.3 && < 2.0,+ opentheory >= 1.193 && < 1.196++ hs-source-dirs: src++ ghc-options: -Wall++ exposed-modules:+ OpenTheory.Stream
+ src/OpenTheory/Stream.hs view
@@ -0,0 +1,24 @@+{- |+module: $Header$+description: Infinite stream types+license: MIT++maintainer: Joe Leslie-Hurd <joe@gilith.com>+stability: provisional+portability: portable+-}++module OpenTheory.Stream+where++import qualified OpenTheory.Primitive.Natural as Natural++nth :: [a] -> Natural.Natural -> a+nth s n = if n == 0 then head s else nth (tail s) (n - 1)++naturalTake :: [a] -> Natural.Natural -> [a]+naturalTake s n =+ if n == 0 then [] else head s : naturalTake (tail s) (n - 1)++unfold :: (b -> (a, b)) -> b -> [a]+unfold f b = let (a, b') = f b in a : unfold f b'