Обсуждение:Haskell
Примеры жгутъ! С удовольствием разгрёб третий уровень --grep 19:52, 4 апреля 2007 (UTC)
Четвёртый пример не компилируется:
cata.hs:58:48:
Couldn't match expected type `. (forall a)'
against inferred type `f' (a rigid variable)
`f' is bound by the type signature for `gcata' at cata.hs:54:18
Expected type: f (n1 a1) -> . (forall a) (f (n a))
Inferred type: f (n1 a1) -> f (n1 (n1 a1))
In the second argument of `(.)', namely `fmap dupl'
In the second argument of `(.)', namely `dist . (fmap dupl)'
cata.hs:60:18:
Occurs check: cannot construct the infinite type: a = Prod c a
Expected type: Prod (forall a) (Prod (forall a) (Prod c a))
-> Prod c (Prod (forall a) a)
Inferred type: Prod (forall a) (Prod (forall a) (Prod c a))
-> Prod c (Prod (forall a) (Prod c a))
In the first argument of `gcata', namely
`(fork (fmap outl) (chi . (fmap outr)))'
In the expression: gcata (fork (fmap outl) (chi . (fmap outr)))
GHC 6.6.1 --Beroal 12:05, 7 мая 2008 (UTC)
- Млин, наши себе проблему... --╔▲╠☼╚╡∩║▀⌠⅜⌡├┤∩ 12:41, 7 мая 2008 (UTC)
- Используйте компилятор Перельмана. Хотя это вряд ли поможет. В статье явным образом указано, что четвёртый уровень доступен только Перельману :-( Morley Dotes 14:07, 7 мая 2008 (UTC)
- Ага, надо убрать сигнатуру gcata и instance Show (Mu N), тогда будет компилироваться в GHC. Компилятор выводит более общий тип для gcata, чем указано в сигнатуре. --Beroal 14:21, 9 мая 2008 (UTC)