DART中的一些函子类型
某些函数fmap
fmap :: (a -> b) -> f a -> f b
在Haskell中,类似地说,在Dypescript中的
type F<A> = A[];
const F = // type constructor
<A>(a: A): F<A> => [a];
type map = <A, B> // function => function
(f: (a: A) => B) =>
(Fa: F<A>) => F<B>;
在DART中,我尝试实现,
typedef F<A> = Map<String, A>;
typedef Fmap<A, B> = (F<B> Function(F<A>)) (Function(B Function(A)));
但是第二行有错误,正确的语法是什么?
In Haskell, some Functor fmap
fmap :: (a -> b) -> f a -> f b
In TypeScript,
type F<A> = A[];
const F = // type constructor
<A>(a: A): F<A> => [a];
type map = <A, B> // function => function
(f: (a: A) => B) =>
(Fa: F<A>) => F<B>;
Similarly, in Dart, I try to implement
typedef F<A> = Map<String, A>;
typedef Fmap<A, B> = (F<B> Function(F<A>)) (Function(B Function(A)));
but the second line has errors, what would be the correct syntax?
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
老实说,我没有丝毫想法您要做什么,因为我没有得到两个示例中的任何一个,但是这可以很好地编译:
To be honest I have not the slightest idea what you are trying to do, since I don't get any of the two examples, but this compiles fine: