Ik wil een window maken met Haskell(GHC). Daar stond in de definitie van het type van de functie iets ongebegrijpelijks voor mij(nl. de ls, de wdef, en de ps).
class Windows wdef where
Methods
openWindow :: ls -> wdef ls ps -> ps -> GUI ps ps
Instances
(Controls c) => Windows (Window c)
Toen heb ik maar een paar tutorials doorgespit, en daar stond het volgende in
class Functor f where
fmap :: (a -> b) -> f a -> f b
The fmap function generalizes the map function used previously. Note that the type variable f is applied to other types in f a and f b. Thus we would expect it to be bound to a type such as Tree which can be applied to an argument. An instance of Functor for type Tree would be:
instance Functor Tree where
fmap f (Leaf x) = Leaf (f x)
fmap f (Branch t1 t2) = Branch (fmap f t1) (fmap f t2)
f lijkt me een functie in de instance, maar wat is f in het type?
Hieruit concludeer ik dat ik een instantie van een Window moet maken, maar ik weet niet van welk type die wfed,ls en ps zijn, dus ook niet hoe ik het dan werkend kan krijgen. Kan iemand me hierover iets uitleggen?
Ik heb ook FranTk en een aantal andere GUI-libs gedownload, maar ik vind het een beetje irritant, dat je voor bijv. GTK+HS geloof ik wel een stuk of 6 of 7 dingen moet downloaden, voordat je zelfs kunt beginnen(niet erg uitnodigend).
In Hugs hebben ze een voorbeeld van HelloWorld gemaakt, maar ze hebben die GUI-lib van hun weer half ingebouwd, zodat je hem niet direct met GHC kunt gebruiken.
Het is misschien iets te sterk uitgedrukt, maar het lijkt net of niemand wil dat je Haskell gebruikt.
class Windows wdef where
Methods
openWindow :: ls -> wdef ls ps -> ps -> GUI ps ps
Instances
(Controls c) => Windows (Window c)
Toen heb ik maar een paar tutorials doorgespit, en daar stond het volgende in
class Functor f where
fmap :: (a -> b) -> f a -> f b
The fmap function generalizes the map function used previously. Note that the type variable f is applied to other types in f a and f b. Thus we would expect it to be bound to a type such as Tree which can be applied to an argument. An instance of Functor for type Tree would be:
instance Functor Tree where
fmap f (Leaf x) = Leaf (f x)
fmap f (Branch t1 t2) = Branch (fmap f t1) (fmap f t2)
f lijkt me een functie in de instance, maar wat is f in het type?
Hieruit concludeer ik dat ik een instantie van een Window moet maken, maar ik weet niet van welk type die wfed,ls en ps zijn, dus ook niet hoe ik het dan werkend kan krijgen. Kan iemand me hierover iets uitleggen?
Ik heb ook FranTk en een aantal andere GUI-libs gedownload, maar ik vind het een beetje irritant, dat je voor bijv. GTK+HS geloof ik wel een stuk of 6 of 7 dingen moet downloaden, voordat je zelfs kunt beginnen(niet erg uitnodigend).
In Hugs hebben ze een voorbeeld van HelloWorld gemaakt, maar ze hebben die GUI-lib van hun weer half ingebouwd, zodat je hem niet direct met GHC kunt gebruiken.
Het is misschien iets te sterk uitgedrukt, maar het lijkt net of niemand wil dat je Haskell gebruikt.