lub 0.1.6 → 0.1.7
raw patch · 6 files changed
+2/−89 lines, 6 filesPVP: major bump suggested
API removals or changes: PVP suggests a major version bump
API changes (from Hackage documentation)
- Data.Glb: class HasGlb a
+ Data.Glb: class HasGlb a where glbs1 = foldr1 glb
- Data.Lub: class HasLub a
+ Data.Lub: class HasLub a where lubs = foldr lub undefined
- Data.Lub: ptimes :: (HasLub a, Num a) => a -> a -> a
+ Data.Lub: ptimes :: (HasLub a, Eq a, Num a) => a -> a -> a
Files
- Makefile +0/−1
- README +0/−8
- lub.cabal +1/−1
- src/Data/AssocRepr.hs +0/−60
- src/Data/Lub.hs +1/−1
- wikipage.tw +0/−18
− Makefile
@@ -1,1 +0,0 @@-include ../cho-home-cabal-make.inc
− README
@@ -1,8 +0,0 @@-See http://haskell.org/haskellwiki/lub for a description of the lub package.--You can configure, build, and install all in the usual way with Cabal-commands.-- runhaskell Setup.lhs configure- runhaskell Setup.lhs build- runhaskell Setup.lhs install
lub.cabal view
@@ -1,5 +1,5 @@ Name: lub-Version: 0.1.6+Version: 0.1.7 Cabal-Version: >= 1.2 Synopsis: information operators: least upper bound (lub) and greatest lower bound (glb) Category: Concurrency, Data, Other
− src/Data/AssocRepr.hs
@@ -1,60 +0,0 @@-{-# LANGUAGE TypeFamilies, FlexibleContexts #-}-{-# OPTIONS_GHC -Wall #-}-------------------------------------------------------------------------- |--- Module : Data.AssocRepr--- Copyright : (c) Conal Elliott 2008--- License : BSD3--- --- Maintainer : conal@conal.net--- Stability : experimental--- --- Compute least upper bounds (lub / join) of two values--- --- This version uses associated types for HasRepr-------------------------------------------------------------------------module Data.AssocRepr (HasRepr(..), onRepr, onRepr2) where---- Reprs. TODO: find & use a simple, standard generic programming framework.--class HasRepr t where- type Repr t- repr :: t -> Repr t- unrepr :: Repr t -> t---- | Apply a binary function on a repr-onRepr :: (HasRepr a, HasRepr b) =>- (Repr a -> Repr b)- -> (a -> b)-onRepr h = unrepr . h . repr---- | Apply a binary function on a repr-onRepr2 :: (HasRepr a, HasRepr b, HasRepr c) =>- (Repr a -> Repr b -> Repr c)- -> (a -> b -> c)-onRepr2 op a b = unrepr (repr a `op` repr b)----- Repr instances--instance HasRepr (Maybe a) where- type Repr (Maybe a) = Either () a- - repr Nothing = (Left ())- repr (Just a) = (Right a)- - unrepr (Left ()) = Nothing- unrepr (Right a) = (Just a)- --instance HasRepr [a] where- type Repr [a] = Either () (a,[a])- - repr [] = (Left ())- repr (a:as) = (Right (a,as))- - unrepr (Left ()) = []- unrepr (Right (a,as)) = (a:as)---- ...
src/Data/Lub.hs view
@@ -149,7 +149,7 @@ -- | Multiplication optimized for either argument being zero or one, where -- the other might be expensive/delayed.-ptimes :: (HasLub a, Num a) => a -> a -> a+ptimes :: (HasLub a, Eq a, Num a) => a -> a -> a ptimes = parCommute times where 0 `times` _ = 0
− wikipage.tw
@@ -1,18 +0,0 @@-[[Category:Packages]]-[[Category:Concurrency]]--== Abstract ==--Lub is an experiment in computing least upper information bounds on (partially defined) functional values.-It provides a <hask>lub</hask> function that is consistent with the [[unamb]] operator but has a more liberal precondition.-Where <hask>unamb</hask> requires its arguments to equal when neither is bottom, <hask>lub</hask> is able to synthesize a value from the partial information contained in both of its arguments, which is useful with non-flat types.--Besides this wiki page, here are more ways to find out about lub:-* Read the blog post ''[http://conal.net/blog/posts/merging-partial-values/ Merging partial values]''-* Visit the [http://hackage.haskell.org/cgi-bin/hackage-scripts/package/lub Hackage page] for library documentation and to download & install.-* Or install with <tt>cabal install lub</tt>.-* Get the code repository: <tt>darcs get http://code.haskell.org/lub</tt>.-<!-- * See the [[lub/Versions| version history]]. -->-<!-- Please leave comments at the [[Talk:lub|Talk page]]. -->--I got inspired for this package after [http://tunes.org/~nef/logs/haskell/08.11.17 stimulating discussions] with Thomas Davie, Russell O'Connor others in the #haskell gang.