From: Julien Moutinho Date: Sat, 14 Mar 2020 05:43:06 +0000 (+0100) Subject: Rename Htirage -> Relotophile X-Git-Url: https://git.sourcephile.fr/reloto.git/commitdiff_plain Rename Htirage -> Relotophile --- diff --git a/GNUmakefile b/GNUmakefile index d35a9e1..e842788 100644 --- a/GNUmakefile +++ b/GNUmakefile @@ -36,7 +36,7 @@ doc: 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 diff --git a/Htirage.hs b/Htirage.hs deleted file mode 100644 index 3ba67be..0000000 --- a/Htirage.hs +++ /dev/null @@ -1,14 +0,0 @@ --- | 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 diff --git a/Relotophile.hs b/Relotophile.hs new file mode 100644 index 0000000..39c4d46 --- /dev/null +++ b/Relotophile.hs @@ -0,0 +1,14 @@ +-- | 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 diff --git a/Htirage/Bits.hs b/Relotophile/Bits.hs similarity index 98% rename from Htirage/Bits.hs rename to Relotophile/Bits.hs index 53906c1..9f688c8 100644 --- a/Htirage/Bits.hs +++ b/Relotophile/Bits.hs @@ -1,5 +1,5 @@ -- | Manipulation de bits. -module Htirage.Bits where +module Relotophile.Bits where import Data.Bool import Data.Eq (Eq(..)) diff --git a/Htirage/Combin.hs b/Relotophile/Combin.hs similarity index 98% rename from Htirage/Combin.hs rename to Relotophile/Combin.hs index ccb0e14..b510022 100644 --- a/Htirage/Combin.hs +++ b/Relotophile/Combin.hs @@ -1,5 +1,5 @@ -- | Calculs de combinaisons. -module Htirage.Combin where +module Relotophile.Combin where import Data.Bool import Data.Eq (Eq(..)) diff --git a/Htirage/Draw.hs b/Relotophile/Draw.hs similarity index 87% rename from Htirage/Draw.hs rename to Relotophile/Draw.hs index cee7f44..c34cc66 100644 --- a/Htirage/Draw.hs +++ b/Relotophile/Draw.hs @@ -1,13 +1,13 @@ -- | 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'. diff --git a/Htirage/HLint.hs b/Relotophile/HLint.hs similarity index 100% rename from Htirage/HLint.hs rename to Relotophile/HLint.hs diff --git a/Htirage/Random.hs b/Relotophile/Random.hs similarity index 95% rename from Htirage/Random.hs rename to Relotophile/Random.hs index 024d5dc..63934bf 100644 --- a/Htirage/Random.hs +++ b/Relotophile/Random.hs @@ -9,7 +9,7 @@ -- 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(..)) @@ -19,9 +19,9 @@ import Data.List ((++), length, nub, sort) 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]@. @@ -123,6 +123,8 @@ randomOf6aus49 (n1,n2,n3,n4,n5,n6) nc = randomOfCombin 49 6 [n1,n2,n3,n4,n5,n6] 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] @@ -150,6 +152,8 @@ randomOfOrderedEuroMillions (n1,n2,n3,n4,n5) (nc1,nc2) = randomOfSequence 50 5 [ 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] diff --git a/Htirage/Sequence.hs b/Relotophile/Sequence.hs similarity index 97% rename from Htirage/Sequence.hs rename to Relotophile/Sequence.hs index 90abaa8..15adbcf 100644 --- a/Htirage/Sequence.hs +++ b/Relotophile/Sequence.hs @@ -1,5 +1,5 @@ -- | Calculs d’arrangements. -module Htirage.Sequence where +module Relotophile.Sequence where import Data.Bool import Data.Foldable (any, foldr) diff --git a/Htirage/Tutorial.lhs b/Relotophile/Tutorial.lhs similarity index 95% rename from Htirage/Tutorial.lhs rename to Relotophile/Tutorial.lhs index 9213fa2..5d610e1 100644 --- a/Htirage/Tutorial.lhs +++ b/Relotophile/Tutorial.lhs @@ -4,8 +4,8 @@ Tutoriel de htirage 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) diff --git a/htirage.cabal b/relotophile.cabal similarity index 72% rename from htirage.cabal rename to relotophile.cabal index a122d7a..d95aa41 100644 --- a/htirage.cabal +++ b/relotophile.cabal @@ -1,4 +1,4 @@ -name: htirage +name: relotophile -- PVP: +-+------- breaking API changes -- | | +----- non-breaking API additions -- | | | +--- code changes with no API change @@ -10,30 +10,30 @@ extra-doc-files: license: GPL-3 license-file: COPYING stability: experimental -author: Julien Moutinho -maintainer: Julien Moutinho -bug-reports: Julien Moutinho +author: Julien Moutinho +maintainer: Julien Moutinho +bug-reports: Julien Moutinho 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 @@ -46,7 +46,7 @@ Library build-depends: base >= 4.6 && < 5 -Test-Suite htirage-test +Test-Suite relotophile-test type: exitcode-stdio-1.0 default-language: Haskell2010 default-extensions: @@ -56,7 +56,7 @@ Test-Suite htirage-test other-modules: QuickCheck build-depends: - htirage + relotophile , base >= 4.6 && < 5 , containers >= 0.5 , QuickCheck >= 2.0 diff --git a/stack.yaml b/stack.yaml index 21adc4a..7131b77 100644 --- a/stack.yaml +++ b/stack.yaml @@ -1,3 +1 @@ -resolver: lts-12.25 -packages: -- '.' +resolver: lts-15.3 diff --git a/test/Main.hs b/test/Main.hs index bad16d4..4fbd8e0 100644 --- a/test/Main.hs +++ b/test/Main.hs @@ -6,6 +6,6 @@ import QuickCheck main :: IO () main = defaultMain $ - testGroup "Htirage" + testGroup "Relotophile" [ quickchecks ] diff --git a/test/QuickCheck.hs b/test/QuickCheck.hs index 509bfe5..4fc0a35 100644 --- a/test/QuickCheck.hs +++ b/test/QuickCheck.hs @@ -10,7 +10,7 @@ import Test.Tasty.QuickCheck import qualified Data.List as List import qualified Data.Set as Set -import Htirage +import Relotophile quickchecks :: TestTree quickchecks =