From bfec4ec2fb4ea629cd0f93234ff4fd04f097ff5d Mon Sep 17 00:00:00 2001 From: Zebulun Arendsee Date: Sat, 24 Feb 2018 22:20:15 -0600 Subject: [PATCH] Add notes on parameterized Bool and Chance --- docs/types.md | 52 +++++++++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 52 insertions(+) diff --git a/docs/types.md b/docs/types.md index d2aa5105..0a274010 100644 --- a/docs/types.md +++ b/docs/types.md @@ -209,3 +209,55 @@ Syntactically, I will probably use a '?' for Maybe, for example: `?Int` * ? column metadata * ? row metadata * ? cell metadata + +### Parameterized Boolean + +This is a odd type, but something important I want to express: a boolean with +semantic annotation. For example: + +``` +Filename -> Is Readable +Image -> Is Dog +String -> Is Integer +Integer -> Is Odd +Audio -> Is HipHop +``` + +``` +-- general +filterImage :: (Image -> Is Thing) -> [Image] -> [Image] + +-- more specific +filterImage :: (Image -> Is Airplane) -> [Image] -> [Image] + +-- most specific +filterImage :: (Image -> Is Boeing747) -> [Image] -> [Image] +``` + +These would have the more general types: + +``` +Filename -> Bool +Image -> Bool +String -> Bool +Integer -> Bool +Audio -> Bool +``` + +But these lack semantic meaning. + +'Is' implies an equivalence of some sort. 'Has' implies a `has_part` relation. +For example: + +``` +[Integer] -> Has 45 +Image -> Has Dog +``` + +### Parameterized Probability + +First there is the `ChanceOf` type + +``` +FeatureTable -> ChanceOf Win +```