kadoban 2017-01-26 04:50:44
ph88: Should there be?
ph88 2017-01-26 04:52:17
would be a massive help during development
kadoban 2017-01-26 04:53:07
Not sure how ... what parsers are you writing that accidentally don't consume input?
kadoban 2017-01-26 04:53:15
I just don't think I've ever run into that.
Zemyla 2017-01-26 04:58:21
Okay, if I have something like traverseWithKey :: Applicative f => (k -> a -> f b) -> t k a -> f (t k b), then how do I turn it into an IndexedTraversal?
phadej 2017-01-26 05:01:20
Zemyla: http://hackage.haskell.org/package/lens-4.15.1/docs/src/Control.Lens.Indexed.html#line-712
phadej 2017-01-26 05:01:32
if i'm not wrong, your type is IndexedTraversal
phadej 2017-01-26 05:01:55
ah now, it's itraverse, not itraversed
phadej 2017-01-26 05:02:10
itraversed = conjoined traverse (itraverse . indexed)
wz1000 2017-01-26 05:11:53
How do you people feel about a syntactical change to instance declaration that allows multiple classes to be instantiated together?
wz1000 2017-01-26 05:12:36
Eg: allow instance (Eq Foo, Ord Foo) where compare = ...; (==) = ...
merijn 2017-01-26 05:12:56
wz1000: What would the point of that be?
Tuplanolla 2017-01-26 05:13:06
It seems like a hassle without much benefit, wz1000.
wz1000 2017-01-26 05:13:32
merijn: Allowing the breakup of already existing typeclasses
merijn 2017-01-26 05:13:57
wz1000: Which one would you like to breakup? And how would it allow that?
wz1000 2017-01-26 05:14:07
For example, type Num a = (Additive a, Subtractive a, Multiplicative a)
Tuplanolla 2017-01-26 05:14:42
Oh, it's a migration plan.
wz1000 2017-01-26 05:15:41
Also, Applicative could have been introduced as type Applicative a = (Pointed a, FunApp a)
Zemyla 2017-01-26 05:15:46
Okay, this is a problem.
Zemyla 2017-01-26 05:15:48
@let import qualified Numeric.Natural as N
lambdabot 2017-01-26 05:15:50
Defined.
Zemyla 2017-01-26 05:15:52
> clearBit (7 :: N.Natural) 2
lambdabot 2017-01-26 05:15:55
*Exception: Bits.complement: Natural complement undefined
wz1000 2017-01-26 05:17:08
then Monad could have been redefined as type Monad a = (Pointed a, Joinable a) where FunApp is a superclass of Joinable
phadej 2017-01-26 05:17:38
wz1000: FYI, Apply and Bind in https://hackage.haskell.org/package/semigroupoids
merijn 2017-01-26 05:20:47
wz1000: But most of those classes have no laws
merijn 2017-01-26 05:21:01
wz1000: Which defeats your ability to reason about what they do
merijn 2017-01-26 05:21:10
wz1000: Pointed is bad for the same reason Default is bad
phadej 2017-01-26 05:21:43
merijn: but Apply f => Applicative f would be an "improvement"
tabaqui1 2017-01-26 05:23:31
signatures of foldlWithKey and foldrWithKey in Data.IntMap are really confusing
tabaqui1 2017-01-26 05:23:44
foldrWithKey :: (Key -> a -> b -> b) -> b -> IntMap a -> b
wz1000 2017-01-26 05:23:48
merijn: Pointed has fmap f . point = point . f
tabaqui1 2017-01-26 05:23:50
foldlWithKey :: (a -> Key -> b -> a) -> a -> IntMap b -> a
tabaqui1 2017-01-26 05:24:50
Data.Map has the same
phadej 2017-01-26 05:25:34
wz1000: it's a free theorem
phadej 2017-01-26 05:25:45
wz1000: you cannot break it, with non GADTs
phadej 2017-01-26 05:26:14
e.g. both Just and const Nothing "work"
wz1000 2017-01-26 05:27:06
phadej: Ah
phadej 2017-01-26 05:28:41
(not sure, probably you won't have lawful Functor, if you can break it)
ph88 2017-01-26 05:32:15
that TH breaks up your file is so unfortunate :
ph88 2017-01-26 05:32:18
:
ph88 2017-01-26 05:32:21
:'(
wz1000 2017-01-26 05:34:21
tabaqui1: Would it be better if foldr was ((Key, a) -> b -> b) -> b -> IntMap a -> b
wz1000 2017-01-26 05:34:40
s/foldr/foldrWithKey
tabaqui1 2017-01-26 05:36:59
wz1000: nope, it would be better if both functions deal with "IntMap a"
tabaqui1 2017-01-26 05:37:31
maybe a little better if Key always was the first argument of incoming function
wz1000 2017-01-26 05:39:32
tabaqui1: That wouldn't make sense. The current type signature is obtained by taking the type signature of the original fold and replacing a with (Key, a) and currying the final signature
wz1000 2017-01-26 05:40:10
foldr :: (a -> b -> b) -> b -> IntMap a -> b
wz1000 2017-01-26 05:40:37
foldrWithKey' :: ((Key, a) -> b -> b) -> b -> IntMap a -> b
wz1000 2017-01-26 05:40:54
foldrWithKey :: (Key -> a -> b -> b) -> b -> IntMap a -> b
tabaqui1 2017-01-26 05:40:55
wz1000: ah, yeah, right
tabaqui1 2017-01-26 05:41:15
it's fold functions are confusing then