arrows

No Arrow buttons in Scrollbar after writing webkit Css

梦想的初衷 提交于 2019-12-12 07:58:36
问题 Please refer to the table here. http://www.funkkopfhoerer-test.com/vergleichstabelle-funkkopfhoerer/ I'm using Table Plugin and created a custom scrollbar on top of it. But It wasn't showing up on Safari browsers until it is enabled in Safari Browser settings. So, I wrote this Css (see below) and It is now showing up in Safari regardless of browser settings. But doing so, I can't see scrollbar arrows in Chrome and Safari. `.wmd-view-topscroll::-webkit-scrollbar { -webkit-appearance: none; }

HXT: Can an input change with the arrow syntax?

醉酒当歌 提交于 2019-12-11 09:24:50
问题 With the following code {-# LANGUAGE Arrows #-} {-# LANGUAGE NoMonomorphismRestriction #-} import Text.XML.HXT.Core parseXml :: IOSArrow XmlTree XmlTree parseXml = getChildren >>> getChildren >>> proc x -> do y <- x >- hasName "item" returnA -< x main :: IO () main = do person <- runX (readString [withValidate no] "<xml><item>John</item><item2>Smith</item2></xml>" >>> parseXml) putStrLn $ show person return () I get the output [NTree (XTag "item" []) [NTree (XText "John") []]] So it seems

Arrow to add one element at a time

点点圈 提交于 2019-12-11 02:54:40
问题 This question is about HXT, but I guess it's applicable to conception of ArrowPlus in general. Consider the following program: module Main (main) where import Text.XML.HXT.Core import Control.Monad (void) main :: IO () main = void $ runX $ root [] [foo] >>> writeDocument [withIndent yes] "test.xml" foo :: ArrowXml a => a XmlTree XmlTree foo = selem "foo" [bar >>> bar >>> bar] bar :: ArrowXml a => a XmlTree XmlTree bar = this <+> eelem "bar" Can you tell what will be saved in test.xml ? My

How can I use &&& with a -> Maybe a

旧街凉风 提交于 2019-12-10 17:34:35
问题 I had two functions f1:: String -> Int f2:: String -> Int f3:: String -> (Int,Int) f3 = f1 &&& f2 then they was changed to String -> Maybe Int f1:: String -> Maybe Int f2:: String -> Maybe Int f3:: String -> (Maybe Int,Maybe Int) Is there pointfree way to get function f4:: String -> Maybe (Int, Int) So if both f1 and f2 return Just, f4 will also return Just otherwise Nothing 回答1: import Control.Arrow import Control.Applicative h :: (Applicative f) => (a -> f b) -> (a -> f c) -> a -> f (b, c)

How to get haskell code after desugaring arrow syntax?

这一生的挚爱 提交于 2019-12-10 17:07:12
问题 I currently try to solve my problem HXT: Can an input change with the arrow syntax? and therefore and want to see the haskell code after the ghc compiler desugars the Arrow syntax. How can I do this? I already tried -ddump-ds but with this flag I get a horrible long code because also all types are resolved. Is there a way to see the code with just arrow syntax desugaring? 回答1: The original arrow project provided a parser, called arrowp , which is available on Hackage and translates the arrow

Are there any useful abstractions for Haskell's record syntax?

醉酒当歌 提交于 2019-12-10 13:40:07
问题 To try and simplify this problem I have defined these arrow functions: splitA :: (Arrow arr) => arr a b -> arr a (b,a) splitA ar = ar &&& (arr (\a -> id a)) recordArrow :: (Arrow arr) => (d -> r) -> (d -> r -> d) -> (r -> r) -> arr d d recordArrow g s f = splitA (arr g >>^ f) >>^ \(r,d) -> s d r Which then let's me do something like this: unarrow :: ((->) b c) -> (b -> c) -- unneeded as pointed out to me in the comments unarrow g = g data Testdata = Testdata { record1::Int,record2::Int

How to work with types that change under composition?

亡梦爱人 提交于 2019-12-10 04:00:00
问题 I recently read the very interesting paper Monotonicity Types in which a new HM-language is described that keeps track of monotonicity across operations, so that the programmer does not have to do this manually (and fail at compile-time when a non-monotonic operation is passed to something that requires one). I was thinking that it probably would be possible to model this in Haskell, since the sfun s that the paper describes seem to be 'just another Arrow instance', so I set out to create a

Why there isn't a Functor instance for Kleisli in Control.Arrow?

可紊 提交于 2019-12-08 17:00:49
问题 While trying to familiarize myself with Control.Arrow, I have noticed that the Kleisli newtype would seem to admit a Functor instance, something like: instance Monad m => Functor (Kleisli m a) where fmap f (Kleisli k) = Kleisli $ liftM f . k Is there a reason why this instance isn't provided? Does it exist in some package as an orphan instance? 回答1: Every arrow can be made into a valid Functor by defining fmap f a = a >>> arr f However it's not possible to declare a Functor to be a superclass

Convert from arrow notation

故事扮演 提交于 2019-12-06 00:36:35
问题 I'm still trying to get a hang of the parallels between arrow notation and the semantics of the Arrow typeclasses defined in Haskell. In particular, this question seems to have a very canonical example of a small counter written with arrow notation: counter :: ArrowCircuit a => a Bool Int counter = proc reset -> do rec output <- returnA -< if reset then 0 else next next <- delay 0 -< output+1 returnA -< output Can someone show me how to convert this back into Haskell2010 without arrow

How to work with types that change under composition?

╄→гoц情女王★ 提交于 2019-12-05 04:23:25
I recently read the very interesting paper Monotonicity Types in which a new HM-language is described that keeps track of monotonicity across operations, so that the programmer does not have to do this manually (and fail at compile-time when a non-monotonic operation is passed to something that requires one). I was thinking that it probably would be possible to model this in Haskell, since the sfun s that the paper describes seem to be 'just another Arrow instance', so I set out to create a very small POC. However, I came across the problem that there are, simply put, four kinds of 'tonicities