I would like to import two functions from a module (RatOps) which are in the Datatype (type Rat). How can i do this without editing what is being exported in the module RatOps.
I would like to import two functions from a module (RatOps) which are in the Datatype (type Rat). How can i do this without editing what is being exported in the module RatOps.
You can import the attributes attr1 and attr2 of the `Rat type with:
import RatOps(Rat(attr1, attr2))
If the Rat type is for example defined as:
data Rat = Rat {
attr1 :: Bool
, attr2 :: String
}
you can import these as items from the Rat type.