HLint.hs: $(shell find . -name '*.hs' -not -name 'HLint.hs')
sed -i -e '/^-- BEGIN: generated hints/,/^-- END: Generated by hlint/d' HLint.hs
echo '-- BEGIN: generated hints' >> HLint.hs
- hlint --find . | grep '^'infix | sort -u >> HLint.hs
+ hlint --find . | sed -ne 's/^- infix: \(.*\)/\1/p' | sort -u >>HLint.hs
echo '-- END: generated hints' >> HLint.hs
lint: HLint.hs
+++ /dev/null
--- | Tirage au sort équiprobable par aléa publiquement vérifiable.
-module Htirage
- ( module Htirage.Bits
- , module Htirage.Combin
- , module Htirage.Sequence
- , module Htirage.Draw
- , module Htirage.Random
- ) where
-
-import Htirage.Bits
-import Htirage.Combin
-import Htirage.Sequence
-import Htirage.Draw
-import Htirage.Random
--- /dev/null
+-- | Tirage au sort équiprobable par aléa publiquement vérifiable.
+module Relotophile
+ ( module Relotophile.Bits
+ , module Relotophile.Combin
+ , module Relotophile.Sequence
+ , module Relotophile.Draw
+ , module Relotophile.Random
+ ) where
+
+import Relotophile.Bits
+import Relotophile.Combin
+import Relotophile.Sequence
+import Relotophile.Draw
+import Relotophile.Random
-- | Manipulation de bits.
-module Htirage.Bits where
+module Relotophile.Bits where
import Data.Bool
import Data.Eq (Eq(..))
-- | Calculs de combinaisons.
-module Htirage.Combin where
+module Relotophile.Combin where
import Data.Bool
import Data.Eq (Eq(..))
-- | Tirages.
-module Htirage.Draw where
+module Relotophile.Draw where
import Data.Bool
import Prelude (Integer, Integral(..), Num(..))
import Data.List (length, map)
-import Htirage.Bits
-import Htirage.Combin
-import Htirage.Sequence
+import Relotophile.Bits
+import Relotophile.Combin
+import Relotophile.Sequence
-- | @unorderedDraw k xs bs@ retourne 'k' choix (sans ordre ni répétition) parmi 'xs'
-- déterminés par l’entropie 'bs'.
-- Car il n’y a que @2^n@ combinaisons de @n@ bits.
-- Et que parmi ces combinaisons un bit a une probabilité
-- de @2^(n-1)@ sur @2^n@ soit de @1/2@ d’être à 'True', et autant d’être à 'False'.
-module Htirage.Random where
+module Relotophile.Random where
import Data.Bool
import Data.Eq (Eq(..))
import Data.Ord (Ord(..))
import Prelude (Integer, Num(..), undefined, (^))
-import Htirage.Bits
-import Htirage.Combin
-import Htirage.Sequence
+import Relotophile.Bits
+import Relotophile.Combin
+import Relotophile.Sequence
-- | @equiprobableBits n@ retourne le nombre maximal de bits de 'i'
-- équiprobables quand @i@ parcourt @[0..n-1]@.
randomOfEuroMillions :: (Integer,Integer,Integer,Integer,Integer) -> (Integer,Integer) -> [Bool]
randomOfEuroMillions (n1,n2,n3,n4,n5) (nc1,nc2) = randomOfCombin 50 5 [n1,n2,n3,n4,n5] ++
randomOfCombin 12 2 [nc1,nc2]
+-- | @34@ bits équiprobables en allant voir l’ordre du tirage :
+-- @'sum' $ 'equiprobableBits' '<$>' [50\`nAk\`5, 12\`nAk\`2]@
randomOfOrderedEuroMillions :: (Integer,Integer,Integer,Integer,Integer) -> (Integer,Integer) -> [Bool]
randomOfOrderedEuroMillions (n1,n2,n3,n4,n5) (nc1,nc2) = randomOfSequence 50 5 [n1,n2,n3,n4,n5] ++
randomOfSequence 12 2 [nc1,nc2]
randomOfFrenchLoto :: (Integer,Integer,Integer,Integer,Integer) -> Integer -> [Bool]
randomOfFrenchLoto (n1,n2,n3,n4,n5) nc = randomOfCombin 49 5 [n1,n2,n3,n4,n5] ++
randomOfCombin 10 1 [nc]
+-- | @30@ bits équiprobables en allant voir l’ordre du tirage :
+-- @'sum' $ 'equiprobableBits' '<$>' [49\`nAk\`5, 10\`nAk\`1]@
randomOfOrderedFrenchLoto :: (Integer,Integer,Integer,Integer,Integer) -> Integer -> [Bool]
randomOfOrderedFrenchLoto (n1,n2,n3,n4,n5) nc = randomOfSequence 49 5 [n1,n2,n3,n4,n5] ++
randomOfSequence 10 1 [nc]
-- | Calculs d’arrangements.
-module Htirage.Sequence where
+module Relotophile.Sequence where
import Data.Bool
import Data.Foldable (any, foldr)
On commence par les entêtes nécessaires au compilateur :
> {-# OPTIONS_GHC -fno-warn-missing-signatures #-}
-> module Htirage.Tutorial where
-> import Htirage
+> module Relotophile.Tutorial where
+> import Relotophile
> import Prelude (toInteger)
> import Data.List ((++), length, sort)
-name: htirage
+name: relotophile
-- PVP: +-+------- breaking API changes
-- | | +----- non-breaking API additions
-- | | | +--- code changes with no API change
license: GPL-3
license-file: COPYING
stability: experimental
-author: Julien Moutinho <julm+htirage@autogeree.net>
-maintainer: Julien Moutinho <julm+htirage@autogeree.net>
-bug-reports: Julien Moutinho <julm+htirage@autogeree.net>
+author: Julien Moutinho <julm+relotophile@autogeree.net>
+maintainer: Julien Moutinho <julm+relotophile@autogeree.net>
+bug-reports: Julien Moutinho <julm+relotophile@autogeree.net>
build-type: Simple
cabal-version: >= 1.10
-tested-with: GHC==8.4.3
+tested-with: GHC==8.6.5
extra-source-files:
stack.yaml
extra-tmp-files:
source-repository head
- location: git://git.autogeree.net/htirage
+ location: git://git.autogeree.net/relotophile
type: git
Library
exposed-modules:
- Htirage
- Htirage.Bits
- Htirage.Combin
- Htirage.Draw
- Htirage.Random
- Htirage.Sequence
- Htirage.Tutorial
+ Relotophile
+ Relotophile.Bits
+ Relotophile.Combin
+ Relotophile.Draw
+ Relotophile.Random
+ Relotophile.Sequence
+ Relotophile.Tutorial
default-language: Haskell2010
default-extensions:
NoImplicitPrelude
build-depends:
base >= 4.6 && < 5
-Test-Suite htirage-test
+Test-Suite relotophile-test
type: exitcode-stdio-1.0
default-language: Haskell2010
default-extensions:
other-modules:
QuickCheck
build-depends:
- htirage
+ relotophile
, base >= 4.6 && < 5
, containers >= 0.5
, QuickCheck >= 2.0
-resolver: lts-12.25
-packages:
-- '.'
+resolver: lts-15.3
main :: IO ()
main =
defaultMain $
- testGroup "Htirage"
+ testGroup "Relotophile"
[ quickchecks
]
import qualified Data.List as List
import qualified Data.Set as Set
-import Htirage
+import Relotophile
quickchecks :: TestTree
quickchecks =