mlehmk 2017-02-24 04:45:27
especially indentation should be consistent if the examples have it
Aku 2017-02-24 04:52:31
shapr: Thanks
lpaste_ 2017-02-24 04:53:51
Aku pasted "trying" at http://lpaste.net/8840934035556401152
Tuplanolla 2017-02-24 04:55:08
That's incomplete, Aku.
Aku 2017-02-24 04:55:11
This is giving me parse error
Aku 2017-02-24 04:55:34
Tuplanolla : How?
Sornaensis 2017-02-24 04:56:10
Aku: what is Alter a, what is IsRec
Sornaensis 2017-02-24 04:56:19
what is Name
Aku 2017-02-24 04:57:15
Ohh..I have the code for it below and havent pasted in lpaste, it's giving me a parse error
Habib 2017-02-24 04:57:48
Does anyone know a version of fmap that may return a totally different functor?
halogenandtoast 2017-02-24 04:58:10
:t fmap
lambdabot 2017-02-24 04:58:12
Functor f => (a -> b) -> f a -> f b
halogenandtoast 2017-02-24 04:58:15
nope
Tuplanolla 2017-02-24 04:58:24
Lenses come to mind, Habib.
Habib 2017-02-24 04:58:35
Sorry, I mean a function that's similar to fmap.
halogenandtoast 2017-02-24 04:58:51
Tuplanolla: Lenses or Prisms?
Habib 2017-02-24 04:58:53
Thanks, Tuplanolla.
Habib 2017-02-24 04:58:58
I'll take a look.
lyxia 2017-02-24 04:59:12
traverse
halogenandtoast 2017-02-24 04:59:58
traverse :: (Traversable t, Applicative f) => (a -> f b) -> t a -> f (t b)
Tuplanolla 2017-02-24 05:00:08
@info Lens
lambdabot 2017-02-24 05:00:09
Lens
Tuplanolla 2017-02-24 05:00:14
Not useful, lambdabot.
Habib 2017-02-24 05:00:25
Is Lens a typeclass?
Habib 2017-02-24 05:00:34
:i Lens
Tuplanolla 2017-02-24 05:00:49
It's a type alias for `Functor f => (a -> f b) -> (s -> f t)`, Habib.
halogenandtoast 2017-02-24 05:01:30
type Lens s t a b = forall f. Functor f => (a -> f b) -> s -> f t
lpaste_ 2017-02-24 05:01:55
Aku revised "trying": "Getting parse error on |" at http://lpaste.net/8840934035556401152
Habib 2017-02-24 05:02:01
Ah, I'll take a look, guys, thanks. Gotta dash to the library. See ya. Thanks for your help.
Aku 2017-02-24 05:02:05
Help?
Tuplanolla 2017-02-24 05:02:13
Since you want mappings between functors, most likely natural transformations, lenses provide nice ways to define them, Habib.
Aku 2017-02-24 05:03:51
I am getting parse error, I don't know why, can somebody help?
lpaste_ 2017-02-24 05:04:20
Aku annotated "Getting parse error on |" with "Getting parse error on |" at http://lpaste.net/8840934035556401152#a1338909608751661056
halogenandtoast 2017-02-24 05:05:21
Aku: it's probably spacing, I removed the newlines and it compiled for me.
Aku 2017-02-24 05:05:58
halogenandtoast: Ohh..thanks
halogenandtoast 2017-02-24 05:06:19
if you are inconsistent it can hurt you.
halogenandtoast 2017-02-24 05:06:46
well incosistent and don't do it the way haskell is expecting...
Aku 2017-02-24 05:06:54
Can post the code after removing new Lines @ halogenandtoast?
halogenandtoast 2017-02-24 05:07:18
I guess...
Aku 2017-02-24 05:07:34
I don't get how it is inconsistent?
lpaste_ 2017-02-24 05:08:00
halogenandtoast annotated "Getting parse error on |" with "Getting parse error on | (annotation)" at http://lpaste.net/8840934035556401152#a352944
Aku 2017-02-24 05:08:28
halogenandtoast: Thanks
halogenandtoast 2017-02-24 05:09:31
no problem. Heading to bed it's 1:10 am here :[
Geekingfrog 2017-02-24 05:12:27
In the middle of a conduit I'd like to add something which inspect the values and modify some internal state before putting the value back in the stream. Is there a combinator to do that or do I need to use some MVar + await/leftover ?
merijn 2017-02-24 05:13:47
Geekingfrog: You can use StateP or whatever it's called to keep local state inside a conduit
thomasd 2017-02-24 05:14:18
what are the goto lang extensions/type level trickery that allow me to do something like `foo True = 5` and `foo False = "hello"`? or is this just absurd? a coworker mentioned this needs dependent types.
johnhw 2017-02-24 05:15:00
In the first theorem of http://www.cs.cmu.edu/~rwh/papers/chitt/popl17.pdf, what does the notation bool [\cdot] mean?
johnhw 2017-02-24 05:17:27
Context: If M ∈ bool [·] then either M ⇓ true
Geekingfrog 2017-02-24 05:18:27
merijn: there is Data.Conduit.State which may work for what I need. Thanks
tapirus 2017-02-24 05:19:28
Anyone here familiar with the fork and hook constructs of the J programming language? Anyone feel that Haskell would benefit from something similar? (or if it would benefit from any of the other features of J)
rozencrantz 2017-02-24 05:19:43
thomasd: As far as I know this is impossible even with dependent types. Although I may be wrong if anyone would like to correct me.
shapr 2017-02-24 05:20:03
tapirus: I think Haskell needs more APL influence
shapr 2017-02-24 05:20:26
tapirus: but less humorously, I've seen some papers about making everything postfix in Haskell
shapr 2017-02-24 05:21:05
hm, the only one I can find on google is okasaki from 2002, but I'm certain I've seen more recent papers
thomasd 2017-02-24 05:23:02
rozencrantz: damn... yeah I guess runtime values influencing return types is more like dynamic typing. what I want is `foo :: SomeConstraint b => MyType -> b` where `b` is decided upon by which constructor of MyType is supplied. and then to write all other functions in the form of `f :: SomeConstraint a => a -> b`
thomasd 2017-02-24 05:23:23
scratch the part about dynamic typing
tapirus 2017-02-24 05:23:30
taking a look at that Okosaki paper
shapr 2017-02-24 05:25:22
tapirus: Maybe something way more APL would be to mix the GPU array-oriented libraries with some reimplementations of the original APL operators?
mnoonan 2017-02-24 05:28:08
johnhw: I definitely don't know this stuff, but later in the paper (pg 685) they talk about types of the form T[Psi]
shapr 2017-02-24 05:28:38
tapirus: my viewpoint on that is: J and K are spiritual successors to APL, and one of APL's strong points was array operations. Today's popular array ops are done in GPUs.
mnoonan 2017-02-24 05:28:58
Psi is some kind of relation, so presumably . is some kind of trivial case?
Tuplanolla 2017-02-24 05:29:07
My guess is that the dot is a placeholder for a parameter, like `_` in Haskell, johnhw.
tapirus 2017-02-24 05:29:32
shapr: sounds smart to me
mnoonan 2017-02-24 05:29:40
oh, that's probably right
johnhw 2017-02-24 05:30:02
mnoonan: yes, that's indeed it (someone else already told me).
johnhw 2017-02-24 05:31:09
mnoonan: unfortunately, on that same page they are themselves inconsistent in the notation.
mnoonan 2017-02-24 05:31:53
heh
johnhw 2017-02-24 05:31:55
mnoonan: see the reference to M \in bool without the brackets after it.
rozencrantz 2017-02-24 05:35:10
thomasd: Yeah I'm almost certain your example impossible even with dependent types. The return type of functions is known at compile time. You could do something like `foo :: Num a => MyType -> a`. But to actually use foo in the program, you'll need to know the type of a unambiguously.
rozencrantz 2017-02-24 05:35:10
Please let me know if I'm not using IRC correctly, this is my first time ever using it.
thomasd 2017-02-24 05:35:10
rosencrantz: exactly
thomasd 2017-02-24 05:35:10
and unfortunately
stphrolland 2017-02-24 05:35:10
Hi everyone. I'm just wondering if something doing that exists: like we have $ for function application, is there something for type application, that would allow to write something like f :: a -> IO $ Maybe a instead of f :: a -> IO (Maybe a) put the wanted type operator instead of the $ I put there in IO $ Maybe a ???
thomasd 2017-02-24 05:35:10
I'm not convinced, though, that this idea is impossible. maybe with the particular type signatures I gave it is.. but the underlying idea might still be valid
stphrolland 2017-02-24 05:35:10
I'm just wondering if that exists
thomasd 2017-02-24 05:35:11
stphrolland: if it doesn't, you could try to define it as a type level operator that's basically syntactic sugar for parenthesis
mauke 2017-02-24 05:35:24
@let type a $ b = a b
lambdabot 2017-02-24 05:35:26
Defined.
Benzi-Junior 2017-02-24 05:35:26
is it possible to tell ghc to ignore what is exported from a particular module and import it as if everything in it was exported
Geekingfrog 2017-02-24 05:35:26
mmm, wait. The stateful conduit stuff are actually in a very old version of the library. On the most recent ones I couldn't find anything :/
Benzi-Junior 2017-02-24 05:35:36
for testing purposes
mauke 2017-02-24 05:35:56
> return . return :: a -> IO $ Maybe a
mnoonan 2017-02-24 05:35:57
stphrolland: https://hackage.haskell.org/package/type-operators-0.1.0.4/docs/Control-Type-Operator.html
lambdabot 2017-02-24 05:35:59
error:
lambdabot 2017-02-24 05:35:59
• No instance for (Typeable a0)
lambdabot 2017-02-24 05:35:59
arising from a use of 'show_M514524567618444706125178'
thomasd 2017-02-24 05:36:03
mauke: nice
mauke 2017-02-24 05:36:03
neat
stphrolland 2017-02-24 05:36:57
mnoonan ... just wow...
johnhw 2017-02-24 05:37:59
Monad transformer stacks where in vogue a decade ago. Are they replaced by something else in the meanwhile?
byorgey 2017-02-24 05:39:15
johnhw: well, effect handlers are a cool new alternative, but I certainly wouldn't say they have "replaced" monad transformer stacks.
byorgey 2017-02-24 05:39:25
monad transformer stacks are still quite prevalent in practice.
johnhw 2017-02-24 05:39:50
byorgey: are all the action evaluations compiled away?
mauke 2017-02-24 05:40:02
> [] :: [] $ Maybe Int
byorgey 2017-02-24 05:40:04
johnhw: I don't understand your question.
lambdabot 2017-02-24 05:40:06
[]
byorgey 2017-02-24 05:40:32
mauke: wat
byorgey 2017-02-24 05:40:42
oh, I see the @let above
merijn 2017-02-24 05:40:53
Good, I was almost worried
shapr 2017-02-24 05:41:06
Silly question, how do I send money to the people curating libraries for stack? Is there a Patreon or something?
rozencrantz 2017-02-24 05:41:43
thomasd: I may be wrong. But you'll have to define some type class which encapsulates all return values of foo. I think instead you could wrap the return values of foo in a newtype like this: `foo:: Constraint a => MyType -> Wrapper a` then have all f be of the following `f:: Constraint a => Wrapper a -> b'
johnhw 2017-02-24 05:41:57
byorgey: if you compose lots of monads, there is lots of pattern matching going on, which wouldn't exist if one would just write everything in the I/O monad with e.g. Refs. In order for monad transformer stacks to be used in innerloops, they should be a zero cost abstraction.
stphrolland 2017-02-24 05:42:27
mauke I'm not sure [] $ Maybe Int is more readable that [Maybe Int] ... but it's nice to see it possible
byorgey 2017-02-24 05:44:18
johnhw: OK, I see. They are not zero cost, though there are tricks you can use to get the overhead down pretty low (e.g. using CPS-encoded versions of things, etc.)
byorgey 2017-02-24 05:45:01
abstractions are almost never zero cost.