packages feed

random-eff 0.1.0.0 → 0.1.0.1

raw patch · 2 files changed

+11/−15 lines, 2 filesdep ~extensible-effects

Dependency ranges changed: extensible-effects

Files

Control/Eff/Random.hs view
@@ -1,7 +1,7 @@-{-# LANGUAGE DeriveDataTypeable, DeriveFunctor, ExistentialQuantification #-}-{-# LANGUAGE FlexibleContexts, MultiParamTypeClasses                      #-}-{-# LANGUAGE NoMonomorphismRestriction, ScopedTypeVariables               #-}-{-# LANGUAGE StandaloneDeriving, TypeOperators                            #-}+{-# LANGUAGE CPP, DeriveDataTypeable, DeriveFunctor                 #-}+{-# LANGUAGE ExistentialQuantification, FlexibleContexts            #-}+{-# LANGUAGE MultiParamTypeClasses, NoMonomorphismRestriction       #-}+{-# LANGUAGE ScopedTypeVariables, StandaloneDeriving, TypeOperators #-} {-# OPTIONS_GHC -fno-warn-orphans #-} module Control.Eff.Random (module System.Random,                            Rand, Generator(..),@@ -18,18 +18,20 @@ import Control.Eff.Lift (Lift, lift) import Control.Monad    (liftM) import Data.Typeable    (Typeable (..), mkTyCon3, mkTyConApp)-import Data.Typeable    (Typeable1 (..), typeOfDefault) import System.Random  -- | Wrapper Type for 'RandomGen' types -- -- Since 0.1.0.0 data Generator = forall g. RandomGen g => Generator g-+#if MIN_VERSION_base(4,7,0)+                 deriving (Typeable)+#else instance Typeable Generator where   typeOf _ = mkTyConApp gen []     where       gen = mkTyCon3 "random-eff" "Control.Eff.Random" "Generator"+#endif  -- | This behaves exactly as same as the original, un-quantified instance. --@@ -45,16 +47,11 @@ -- -- Since 0.1.0.0 data Rand a = Rand (Generator -> (a, Generator))+              deriving (Typeable)  instance Functor Rand where   fmap g (Rand f) = Rand (first g . f) -instance Typeable1 Rand where-  typeOf1 _ = mkTyConApp (mkTyCon3 "package" "Control.Eff.Random" "Rand") []--instance Typeable a => Typeable (Rand a) where-  typeOf = typeOfDefault- -- | Return a randomly-selected value of type a. See 'random' for details. -- -- Since 0.1.0.0@@ -85,7 +82,6 @@ getRandomRs :: (Typeable a, Random a, Member Rand r) => (a, a) -> Eff r [a] getRandomRs bd = send $ \k ->   inj $ Rand (\(Generator g) -> let (g', g'') = split g in (k (randomRs bd g'), Generator g''))-  -- | Sample a random value from a weighted list. The total weight of all elements must not be 0. --
random-eff.cabal view
@@ -2,7 +2,7 @@ -- documentation, see http://haskell.org/cabal/users-guide/  name:                random-eff-version:             0.1.0.0+version:             0.1.0.1 synopsis:            A simple random generator library for extensible-effects description:         A simple random generator library for extensible-effects license:             BSD3@@ -23,6 +23,6 @@   exposed-modules:     Control.Eff.Random   other-extensions:    DeriveDataTypeable, DeriveFunctor, ExistentialQuantification, FlexibleContexts, MultiParamTypeClasses, NoMonomorphismRestriction, ScopedTypeVariables   build-depends:       base               >=4   && <5-               ,       extensible-effects >=1.2 && <1.3+               ,       extensible-effects >=1.2 && <1.4                ,       random             >=1.0 && <1.1   default-language:    Haskell2010