Skip to content

Instantly share code, notes, and snippets.

@kreshikhin
Created February 16, 2014 14:27
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save kreshikhin/9035097 to your computer and use it in GitHub Desktop.
Save kreshikhin/9035097 to your computer and use it in GitHub Desktop.
data AbstractProduct = AbstractProduct{
getNameOf :: String
}
data AbstractFactory = AbstractFactory{
createProductABy :: AbstractProduct,
createProductBBy :: AbstractProduct
}
factory1 = AbstractFactory{
createProductABy = AbstractProduct{
getNameOf = "ProductA1"
},
createProductBBy = AbstractProduct{
getNameOf = "ProductB1"
}
}
factory2 = AbstractFactory{
createProductABy = AbstractProduct{
getNameOf = "ProductA2"
},
createProductBBy = AbstractProduct{
getNameOf = "ProductB2"
}
}
factory3 = factory1{
createProductABy = AbstractProduct{
getNameOf = "ProductB2"
}
}
main = putStrLn ("show " ++ (show $ getNameOf $ createProductABy $ factory3))
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment