import Data.Ratio
main = do
[[6], [6,4,8,7,7,2,6], [4,8,7,7,2,6], [6,8,7,7,5,4]]
dicePosteriors suite xxs = f xxs
where
f
(x:xs
) = let zs
= foldr p
(p x
[1,1..]) xs
in map (/ sum zs
) zs
f _ = []
p x priors
= zipWith (*) priors
$ map (likelihood x
) suite
likelihood x hypo = if hypo < x then 0 else 1 % hypo
aW1wb3J0IERhdGEuUmF0aW8KbWFpbiA6OiBJTyAoKQptYWluID0gZG8KICBtYXBNXyAocHJpbnQgLiBtYXAgZnJvbVJhdGlvbmFsIC4gZGljZVBvc3RlcmlvcnMgWzQsNiw4LDEyLDIwXSkKICAgICAgICBbWzZdLCBbNiw0LDgsNyw3LDIsNl0sIFs0LDgsNyw3LDIsNl0sIFs2LDgsNyw3LDUsNF1dCmRpY2VQb3N0ZXJpb3JzIDo6IFtJbnRlZ2VyXSAtPiBbSW50ZWdlcl0gLT4gW1JhdGlvIEludGVnZXJdCmRpY2VQb3N0ZXJpb3JzIHN1aXRlIHh4cyA9IGYgeHhzCiAgd2hlcmUKICAgIGYgKHg6eHMpID0gbGV0IHpzID0gZm9sZHIgcCAocCB4IFsxLDEuLl0pIHhzIGluIG1hcCAoLyBzdW0genMpIHpzCiAgICBmIF8gICAgICA9IFtdCiAgICBwIHggcHJpb3JzID0gemlwV2l0aCAoKikgcHJpb3JzICQgbWFwIChsaWtlbGlob29kIHgpIHN1aXRlCiAgICBsaWtlbGlob29kIDo6IEludGVnZXIgLT4gSW50ZWdlciAtPiBSYXRpbyBJbnRlZ2VyCiAgICBsaWtlbGlob29kIHggaHlwbyA9IGlmIGh5cG8gPCB4IHRoZW4gMCBlbHNlIDEgJSBoeXBvCg==
[0.0,0.39215686274509803,0.29411764705882354,0.19607843137254902,0.11764705882352941]
[0.0,0.0,0.9432484536722126,5.52061280612909e-2,1.5454182664965531e-3]
[0.0,0.0,0.91584527196901,8.040342579700499e-2,3.7513022339850646e-3]
[0.0,0.0,0.91584527196901,8.040342579700499e-2,3.7513022339850646e-3]