marrenarre 2017-02-18 23:47:22
I'm having the same problem with GHC using old code that's not in the file anymore again. GHC says: "`Association operation (Left number)'" Vim shows me: "pairUp (GroupedOperation operation _:GroupedNumber number _:others) = fmap (Association operation (AssociatedNumber number):) $ pairUp others"
marrenarre 2017-02-18 23:48:08
Notice how the code after "= fmap" differs. It was originally the same, but I modified the file.
lyxia 2017-02-18 23:49:30
marrenarre: can you give more context
MarcelineVQ 2017-02-18 23:53:37
such as the rest of your code and the full ghc error in a paste, and what you're doing to get the error, such as saving and manually compiling, or some automated feature
Bish 2017-02-18 23:59:07
hi, i am making my first real haskell steps, i always start with tcpip servers when doing that
Bish 2017-02-18 23:59:16
so, can you tell me, why i cant import the network package?
Bish 2017-02-18 23:59:20
do i have to install it first?
lyxia 2017-02-19 00:00:02
yes
Bish 2017-02-19 00:00:17
with.. cabal?
lyxia 2017-02-19 00:00:39
That's it
Bish 2017-02-19 00:00:43
woo~
ertes 2017-02-19 00:00:46
Bish: depends on your toolchain… cabal-install? nix? stack?
ertes 2017-02-19 00:00:46
Bish: or none of those?
Bish 2017-02-19 00:01:03
i just noticed gentoo has it in it's package manager
Bish 2017-02-19 00:01:11
but usually cabal would be the way to go i guess
ertes 2017-02-19 00:01:22
Bish: then i suggest that you familiarise yourself with cabal sandboxes
ertes 2017-02-19 00:01:41
go into a directory and type: cabal sandbox init
Bish 2017-02-19 00:01:59
> test.hs:7:1: Warning: Tab character really!?
lambdabot 2017-02-19 00:02:02
lambdabot 2017-02-19 00:02:02
parse error (possibly incorrect indentation or mismatched brackets)
Bish 2017-02-19 00:02:19
i am not allowed to use tabs in haskell?
lyxia 2017-02-19 00:02:21
We don't like tabs.
MarcelineVQ 2017-02-19 00:02:26
you're allowed but tabs will cause you all kinds of greif with haskell
ertes 2017-02-19 00:02:29
yes, really… avoid tabs in haskell… they are peaceful until you turn around
lyxia 2017-02-19 00:02:30
Because Haskell is indentation sensitive
Bish 2017-02-19 00:02:41
hm
marrenarre 2017-02-19 00:02:50
MarcelineVQ: Yeah hold on maybe soon.
lyxia 2017-02-19 00:03:01
alignment would depend on a certain fixed tabwidth
Bish 2017-02-19 00:03:24
oh wow, the tcp server just worked instantly
ertes 2017-02-19 00:03:25
also indentation in haskell tends to be highly non-uniform
Bish 2017-02-19 00:03:27
im surprised
ertes 2017-02-19 00:03:40
but of course that's a style choice
Bish 2017-02-19 00:03:53
how can i see assembly created?
Bish 2017-02-19 00:03:58
or even the IR stuff of llvm?
ertes 2017-02-19 00:05:44
Bish: https://downloads.haskell.org/~ghc/latest/docs/html/users_guide/flags.html#which-phases-to-run
Bish 2017-02-19 00:06:21
ertes: yeah found that in ghc --help already
osa1 2017-02-19 00:06:21
what is the non-operator version of lens's (%~) ?
Bish 2017-02-19 00:06:28
but i thought it uses llvm
Gurkenglas 2017-02-19 00:06:45
osa1, over
osa1 2017-02-19 00:07:06
oh, right. thanks Gurkenglas
MarcelineVQ 2017-02-19 00:07:08
osa1: what Gurkenglas said :> note also the docs for lens should mention this for them
ertes 2017-02-19 00:07:10
osa1: alternatively (%~) =)
ertes 2017-02-19 00:07:29
Bish: you can make it use LLVM via -fllvm
ertes 2017-02-19 00:07:35
Bish: it's not the default though
ertes 2017-02-19 00:07:54
LLVM sometimes produces better code, especially when large array operations are involved
Bish 2017-02-19 00:07:55
hm, guess thats something my package management does not support :
Bish 2017-02-19 00:10:13
oh you're not talking about the building process of ghc, i get it
Bish 2017-02-19 00:10:44
why isn't llvm default then? too many problems?
ertes 2017-02-19 00:10:46
oh, no =)
Bish 2017-02-19 00:10:59
since i just had one
ertes 2017-02-19 00:11:01
i don't know why… the LLVM backend is rock-solid as far as i can tell
ertes 2017-02-19 00:11:07
but it doesn't always produce better code
Bish 2017-02-19 00:11:10
You are using a new version of LLVM that hasn't been tested yet!
ertes 2017-02-19 00:11:20
most of the time it will just be an extra dependency in your toolchain
Bish 2017-02-19 00:11:20
opt: /tmp/ghc1438_0/ghc_2.ll:7:6: error: unexpected type in metadata definition
cocreature 2017-02-19 00:11:32
until llvm is bundled with ghc it can't be the default backend
ertes 2017-02-19 00:12:06
and there is actually no way to properly depend on LLVM until then
Bish 2017-02-19 00:12:10
would it be always do better if ghc produced better IR with llvmß
Bish 2017-02-19 00:12:30
s/be//g
Bish 2017-02-19 00:13:04
so much overhead in ghc, but guess it has to be this way because GC and all
osa1 2017-02-19 00:13:23
anyone know a library that provides something like this: https://gist.github.com/osa1/f7d240a38213b18efc92b635f9e119e9
ertes 2017-02-19 00:13:25
what kind of overhead are you referring to?
Bish 2017-02-19 00:13:33
size of assembly
ertes 2017-02-19 00:14:08
osa1: if you separate the read end from the write end, then it's just Coyoneda IORef from kan-extensions
osa1 2017-02-19 00:14:45
ertes: you mean if I have two separate types, one only allowign reads and another one for writes?
ertes 2017-02-19 00:15:19
Bish: not sure if it has to be that way, but yes, GHC tends to produce larger code, partly because of aggressive inlining
ertes 2017-02-19 00:15:37
osa1: yeah
ertes 2017-02-19 00:15:52
osa1: it's basically what you have, except not a lens, but only a getter function
osa1 2017-02-19 00:15:57
well the read-only type could be made Functor
ertes 2017-02-19 00:16:06
exactly
ertes 2017-02-19 00:16:19
and it's a functor for free, if you use kan-extensions =)
osa1 2017-02-19 00:16:25
I guess for the write-only part I could use something less general than lens because I only need setter
ertes 2017-02-19 00:16:45
for the write-only part you could just use an IORef
osa1 2017-02-19 00:17:38
but how do I write `Setter a b -> WriteOnlyIORef a -> WriteOnlyIORef b` if I just use an IORef ?
ertes 2017-02-19 00:18:13
well, if you want that, you can't use plain IORef =)
osa1 2017-02-19 00:18:36
OK
ertes 2017-02-19 00:19:07
but i'm pretty sure there is a contravariant functor somewhere that does exactly what you need
osa1 2017-02-19 00:19:49
so write-only type would be contravariant, read-only part would be functor
ertes 2017-02-19 00:19:49
yeah, in fact there is a contravariant version of Coyoneda, which you can use for the write end, as far as i see
ertes 2017-02-19 00:19:54
yeah
ertes 2017-02-19 00:20:04
https://hackage.haskell.org/package/kan-extensions-5.0.1/docs/Data-Functor-Contravariant-Coyoneda.html
osa1 2017-02-19 00:20:12
but is there anything that combines these two? like in the example I just showed
osa1 2017-02-19 00:22:12
ertes: can I just use Data.Functor.Contravariant for the write-only part?
osa1 2017-02-19 00:22:25
(from contravariant package)
ertes 2017-02-19 00:22:43
osa1: that's how i'd imagine it
ertes 2017-02-19 00:22:58
i haven't thought this through though
Bish 2017-02-19 00:38:11
in network.socket why is it called iNADDR_ANY
Bish 2017-02-19 00:38:14
that really bugs me
Bish 2017-02-19 00:38:17
why is the first letter small
MarcelineVQ 2017-02-19 00:39:51
things starting with a capital letter are Types or Constructors rather than values, I agree that that's a weird way to write that though
pavonia 2017-02-19 00:43:35
Bindings that want to stick to the original naming scheme usually do it this way