mirror of
https://github.com/maciej-bendkowski/generic-boltzmann-brain.git
synced 2024-08-17 08:30:30 +03:00
Default instance for constructor frequencies
This commit is contained in:
parent
72c8ec1508
commit
11dcdc4920
@ -43,6 +43,7 @@ library
|
||||
QuickCheck >=2.14.2
|
||||
, base >=4.7 && <5
|
||||
, containers >=0.6.4
|
||||
, data-default >=0.7.1.1
|
||||
, mtl >=2.2.2
|
||||
, paganini-hs >=0.3.0.0
|
||||
, random >=1.2.0
|
||||
@ -69,6 +70,7 @@ executable binTreeProfile
|
||||
QuickCheck >=2.14.2
|
||||
, base >=4.7 && <5
|
||||
, containers >=0.6.4
|
||||
, data-default >=0.7.1.1
|
||||
, generic-boltzmann-brain
|
||||
, mtl >=2.2.2
|
||||
, paganini-hs >=0.3.0.0
|
||||
@ -96,6 +98,7 @@ executable lambdaProfile
|
||||
QuickCheck >=2.14.2
|
||||
, base >=4.7 && <5
|
||||
, containers >=0.6.4
|
||||
, data-default >=0.7.1.1
|
||||
, generic-boltzmann-brain
|
||||
, mtl >=2.2.2
|
||||
, paganini-hs >=0.3.0.0
|
||||
@ -123,6 +126,7 @@ executable treeProfile
|
||||
QuickCheck >=2.14.2
|
||||
, base >=4.7 && <5
|
||||
, containers >=0.6.4
|
||||
, data-default >=0.7.1.1
|
||||
, generic-boltzmann-brain
|
||||
, mtl >=2.2.2
|
||||
, paganini-hs >=0.3.0.0
|
||||
@ -151,6 +155,7 @@ test-suite generic-boltzmann-brain-test
|
||||
QuickCheck >=2.14.2
|
||||
, base >=4.7 && <5
|
||||
, containers >=0.6.4
|
||||
, data-default >=0.7.1.1
|
||||
, generic-boltzmann-brain
|
||||
, mtl >=2.2.2
|
||||
, paganini-hs >=0.3.0.0
|
||||
|
@ -32,6 +32,7 @@ dependencies:
|
||||
- paganini-hs >= 0.3.0.0
|
||||
- QuickCheck >= 2.14.2
|
||||
- splitmix >= 0.1.0.4
|
||||
- data-default >= 0.7.1.1
|
||||
|
||||
library:
|
||||
source-dirs: src
|
||||
|
@ -6,11 +6,11 @@ import Control.Monad (replicateM)
|
||||
import Data.Boltzmann.BitOracle (evalIO)
|
||||
import Data.Boltzmann.Sampler (BoltzmannSampler (..), rejectionSampler')
|
||||
import Data.Boltzmann.System (
|
||||
ConstructorFrequencies (MkConstructorFrequencies),
|
||||
ConstructorWeights (MkConstructorWeights),
|
||||
System (..),
|
||||
)
|
||||
import Data.Boltzmann.System.TH (mkBoltzmannSampler)
|
||||
import Data.Default (Default (def))
|
||||
import System.Random.SplitMix (SMGen)
|
||||
|
||||
data BinTree
|
||||
@ -22,7 +22,7 @@ mkBoltzmannSampler
|
||||
System
|
||||
{ targetType = ''BinTree
|
||||
, meanSize = 1000
|
||||
, frequencies = MkConstructorFrequencies []
|
||||
, frequencies = def
|
||||
, weights =
|
||||
MkConstructorWeights
|
||||
[ ('Leaf, 0)
|
||||
|
@ -11,6 +11,7 @@ import Data.Boltzmann.System (
|
||||
System (..),
|
||||
)
|
||||
import Data.Boltzmann.System.TH (mkBoltzmannSampler)
|
||||
import Data.Default (Default (def))
|
||||
import System.Random.SplitMix (SMGen)
|
||||
|
||||
data DeBruijn
|
||||
@ -28,7 +29,7 @@ mkBoltzmannSampler
|
||||
System
|
||||
{ targetType = ''Lambda
|
||||
, meanSize = 10_000
|
||||
, frequencies = MkConstructorFrequencies []
|
||||
, frequencies = def
|
||||
, weights =
|
||||
MkConstructorWeights
|
||||
[ -- De Bruijn
|
||||
|
@ -6,11 +6,11 @@ import Control.Monad (replicateM)
|
||||
import Data.Boltzmann.BitOracle (evalIO)
|
||||
import Data.Boltzmann.Sampler (BoltzmannSampler (..), rejectionSampler')
|
||||
import Data.Boltzmann.System (
|
||||
ConstructorFrequencies (MkConstructorFrequencies),
|
||||
ConstructorWeights (MkConstructorWeights),
|
||||
System (..),
|
||||
)
|
||||
import Data.Boltzmann.System.TH (mkBoltzmannSampler)
|
||||
import Data.Default (Default (def))
|
||||
import System.Random.SplitMix (SMGen)
|
||||
|
||||
data Tree = T [Tree]
|
||||
@ -20,7 +20,7 @@ mkBoltzmannSampler
|
||||
System
|
||||
{ targetType = ''Tree
|
||||
, meanSize = 1000
|
||||
, frequencies = MkConstructorFrequencies []
|
||||
, frequencies = def
|
||||
, weights =
|
||||
MkConstructorWeights
|
||||
[ ('T, 1)
|
||||
@ -38,7 +38,7 @@ mkBoltzmannSampler
|
||||
System
|
||||
{ targetType = ''Tree'
|
||||
, meanSize = 2000
|
||||
, frequencies = MkConstructorFrequencies []
|
||||
, frequencies = def
|
||||
, weights =
|
||||
MkConstructorWeights
|
||||
[ ('T, 1)
|
||||
|
@ -44,6 +44,7 @@ import Language.Haskell.TH.Datatype (
|
||||
)
|
||||
|
||||
import Data.Coerce (coerce)
|
||||
import Data.Default (Default (def))
|
||||
import Prelude hiding (seq)
|
||||
|
||||
newtype ConstructorWeights = MkConstructorWeights
|
||||
@ -54,6 +55,9 @@ newtype ConstructorFrequencies = MkConstructorFrequencies
|
||||
{unConstructorFrequencies :: [(Name, Int)]}
|
||||
deriving (Show) via [(Name, Int)]
|
||||
|
||||
instance Default ConstructorFrequencies where
|
||||
def = MkConstructorFrequencies []
|
||||
|
||||
data System = System
|
||||
{ targetType :: Name
|
||||
, meanSize :: Int
|
||||
|
Loading…
Reference in New Issue
Block a user