haskell - Getting datakind recognised in GADT -
I'm not sure how I really look at my design, but to my GADT to see that the Mt must be in the MarketType , because of the reason for MarketIndex ?
I think the current type of investigation is going on mt :: * hence MarketIndex mt fails, instead we have a MarketIndex mt requires bulid, so it should restrict mt :: MarketType .
{- # LANGUAGE Datacunds # -} {- # Language Type Females # -} Modules Market.TypesDK Where Data MarketType = WinDrawWin | Asian Handicrafts Derivative (Show) Type Family Market Index (Mount :: MarketType) :: Type Type MarketIndex WinDrawWin = () Type Example MarketIndex AsianHDAP = Double Data Market :: MarketType - & gt; * Where instances :: MT - & gt; Market Index MT - & gt; Market Mt The error I get is:
[1 of 1] Consolidating the market. Type DK (Type DK.hs, Explanation) Type DK.hs: 32: 33: The first argument of 'Market Index' should be 'MarketType', but 'MT' type '*' type 'Market index MT' in the Data Constructor Failed to declare data for 'instant' market in the definition, loaded modules: None Maybe I have a syntax wrong or maybe I'm asking too much?
Your GADT syntax is fine, but only type of type * And since mt is used as a field, it gets kindened by * by typing notation, whatever you are trying to do, This is a measure of that AA is the so-called singleton type that maps your custom type type to the value level.
Data SMarketType mt where SWinDrawWin :: SMarketType WinDrawWin SAsianHandicap :: SMKet Type Asian Exception Data Markets :: MarketType - & gt; * Example: SMarketType mt - & gt; Market Index MT - & gt; Market MT
Comments
Post a Comment