标签: arrows

如何将箭头用于多个元组?

foo (a1,a2) (b1,b2) (c1,c2) = (bar a1 b1 c1, bar2 a2 b2 c2)
Run Code Online (Sandbox Code Playgroud)

我有很多具有不同数量的参数元组的构造.如果是

foo' (a1,a2) = (bar' a1, bar2' a2)
Run Code Online (Sandbox Code Playgroud)

我想"嘿,那是箭头!":

foo' = bar' *** bar2'
Run Code Online (Sandbox Code Playgroud)

但我还不知道具有多个输入元组的函数(如第一个代码行中)是否以及如何映射到箭头样式.什么是处理这些功能的通用方法?理想情况下,我总是想要这样的东西foo = bar ... bar2.

haskell tuples arrows generic-programming

1
推荐指数
1
解决办法
191
查看次数

删除箭头轮播引导程序附近的可点击区域

我使用Carousel bootstrap进行幻灯片放映,我只想点击确切的箭头图标来移动幻灯片,但问题是它可以让你点击箭头附近的任何地方(上方和下方),有什么方法我可以调整它只能在箭头上单击.我做了下面的代码,以删除已经看到阴影的黑暗区域.谢谢

 .carousel-control.left, .carousel-control.right {
   filter: progid: none !important;
   filter:none !important;
   background-image:none;
   outline: 0;
   opacity: 1;
 }
Run Code Online (Sandbox Code Playgroud)

html css arrows carousel twitter-bootstrap

1
推荐指数
1
解决办法
1701
查看次数

为什么输入中的箭头在 proc 块中的箭头命令中不可用?

在学习箭头的过程中,我偶然发现了一个随着时间的推移并没有变得更清晰的点:

从 John Hughes 的论文“Generalizing Monads To Arrows”中,我注意到下面的情况(情况 I)是不可能的,因为参数中的箭头 f不能在箭头过程的本地范围内使用。

-- case I
proc (f,x) -> returnA <- f -< x     --- here the f is illegal   
Run Code Online (Sandbox Code Playgroud)

如果我们otherArrow在其他地方定义了另一个箭头 ,我们可以这样做:

-- case II
proc (f,x) -> returnA <- otherArrow -< x
Run Code Online (Sandbox Code Playgroud)

我理解需要类似-<没有应用箭头才能应用于x其输入。所以我们用-<它来实现这一点(案例二)。

但我不明白无法使用块参数中给出的箭头的原因proc。(fproc (f,x)案例 I 中)。

而我的不理解又和一个经常使用的术语发生了冲突:箭头命令。Papers 坚持认为它并不等同于 Haskell 表达式,并且 Haskell 类型系统不适合使箭头命令成为语言中的一流命令。

我再次不明白是什么事实/属性使它不可能在 Haskell 类型系统中成为一流的。理解这种不可能背后的原因似乎是我需要的洞察力。

鉴于罗斯帕特森论文中的语法:

exp ::=   ...
        | proc pat -> …
Run Code Online (Sandbox Code Playgroud)

haskell arrows

1
推荐指数
1
解决办法
204
查看次数

为什么我不能将(Functor f)=> ConcreteType - > f String转换为实例Functor(( - >)ConcreteType)?

我构建类型的方式,我相信这将遵循Functor法则,该法律规定应该有一个身份函数,fmap返回原始函子.

码:

-- apply a style function to a shell prompt functor
-- e.g.
-- bold & fgColor red `style` gitCurrentBranch
style :: (String -> ShellPromptType -> String) -> ShellPromptSegment String
           -> ShellPromptType -> ShellPromptSegment String
style f segment = \shType -> (flip f) shType <$> segment

-- this is fine
style' :: (String -> ShellPromptType -> String) 
            -> (ShellPromptType -> ShellPromptSegment String)
            -> ShellPromptType -> ShellPromptSegment String
style' f makeSegment = flip f >>= \g shellType -> fmap g …
Run Code Online (Sandbox Code Playgroud)

haskell types arrows functor

0
推荐指数
1
解决办法
76
查看次数

复制图像并设置悬停CSS

我想制作以下动画:

在此输入图像描述

一个带有2个相同箭头且悬停在第一个箭头上的div应该向左/向右移动.我试着这样做,但没有成功.我正在设置2个图像的背景,但我如何设置像gif这样的图像的动画?

.arrow-right2 {
    content: "";
    background: transparent url(https://i.imgur.com/u7cYXIo.png) 0 -185px no-repeat, transparent url(https://i.imgur.com/u7cYXIo.png) 0 -185px no-repeat;
    height: 35px;
    position: absolute;
    top: -5%;
    left: 0;
    width: 35px;
}
Run Code Online (Sandbox Code Playgroud)

css arrows css-animations

0
推荐指数
1
解决办法
122
查看次数