recursion-ninja 2017-02-07 06:46:22
muzzle: It looks like calling `encode` on an `Integer` isn't O(1), but O(log_8(n)). It'll work I guess, but just "getting" a copy of the `Integers` already existing `ByteArray` would be better.
geekosaur 2017-02-07 06:46:27
if for some reason you need to "unpack" into a different format, you can use the unsafe* ByteString functions to access the packed byte array directly and decompose it as you need using the Foreign.Marshal.Array stuff
lyxia 2017-02-07 06:46:33
"logarithmic complexity" is the same no matter the base
recursion-ninja 2017-02-07 06:48:11
lyxia: Thanks for the pedantic remark. A higher logrithmic base will require fewer computational steps than a lower logrithmic base. I was inquiring if a more efficient option was readily available.
Tuplanolla 2017-02-07 06:48:25
Suddenly base `1 + 1 / n`.
nitrix 2017-02-07 06:48:52
stephaner: https://hackage.haskell.org/package/deepseq-1.4.2.0/docs/Control-DeepSeq.html#v:force
lyxia 2017-02-07 06:50:55
recursion-ninja: how about unpacking the Integer http://hackage.haskell.org/package/integer-gmp-1.0.0.1/docs/GHC-Integer-GMP-Internals.html#t:Integer
lyxia 2017-02-07 06:51:13
BigNat is a ByteArray#
recursion-ninja 2017-02-07 06:52:16
lyxia: Every time I try to use functions from that module I get compilation errors about "lifted" and "unlifted" types.
recursion-ninja 2017-02-07 06:52:44
lyxia: I'd appreciate a tutorial that explains how to use funtions with '#' in them.
thatguy 2017-02-07 06:54:02
can anyone tell me why this here gives me parse error on ')' (the last ) is meant) : satisfy (=='C') <|> (pure '')
glguy 2017-02-07 06:54:17
thatguy: '' is invalid
glguy 2017-02-07 06:54:21
there's no "empty" character
EvanR 2017-02-07 06:54:47
empty set is a subset of every type
Tuplanolla 2017-02-07 06:54:48
Since `IPV6_V6ONLY` is not guaranteed to be supported, is it a better idea to run different socket types separately and concurrently?
EvanR 2017-02-07 06:55:21
you want ipv6 only?
thatguy 2017-02-07 06:55:25
glguy: EvanR thanks
Tuplanolla 2017-02-07 06:55:30
I want both, EvanR.
EvanR 2017-02-07 06:55:35
lol i didnt help you at all
EvanR 2017-02-07 06:55:51
Tuplanolla: right, so you wouldnt ONLY
EvanR 2017-02-07 06:56:08
the only system i know of that doesnt allow listening on both with one server socket is netbsd
Tuplanolla 2017-02-07 06:56:24
Good to know.
EvanR 2017-02-07 06:56:44
and that fact is over 10 years old now
thatguy 2017-02-07 06:57:14
how do I do what I need then: I want a parser which will parse a ')', the parser satisfy (==')') does exactly this. the problem is, that it will return Nothing in case it does not find a ')', I need it to resurn Just '' in case it does not parse anything
thatguy 2017-02-07 06:57:29
ah thats really not possible probably
EvanR 2017-02-07 06:57:30
you cant need to return Just ''
EvanR 2017-02-07 06:57:37
'' doesnt make any sense
EvanR 2017-02-07 06:57:45
a char is exactly 1 char
thatguy 2017-02-07 06:57:45
yeah I get what is the problem now
lyxia 2017-02-07 06:58:13
recursion-ninja: Okay, so you unwrap your Integer, and get a ByteArray#, then you can wrap it back in ByteArray (http://hackage.haskell.org/package/primitive-0.6.2.0/docs/Data-Primitive-ByteArray.html) and you're back in the lifted world.
recursion-ninja 2017-02-07 06:58:50
lyxia: So just use the `ByteArray` constructor?
thatguy 2017-02-07 06:58:55
Yeah well I have this big parsing thing and I just want the whole expression to eat up any ')' at the end of my line, so I thought "<* satisfy (==')' )" would do, the problem is, if this returns Nothing, the whole expression will turn to nothing what I can't have
thatguy 2017-02-07 06:59:00
can anyone help me out?
recursion-ninja 2017-02-07 06:59:31
lyxia: I wish that hoogle helped me when I searched for that: https://www.haskell.org/hoogle/?hoogle=ByteArray%23+-%3E+ByteArray
recursion-ninja 2017-02-07 07:00:20
lyxia: Thank you VERY VERY MUCH. I'm goign to go try and see if I can get this to work :)
EvanR 2017-02-07 07:00:26
thatguy: use optional to parse something that might not be there
lyxia 2017-02-07 07:01:39
recursion-ninja: the hackage hoogle is pretty outdated indeed.
lyxia 2017-02-07 07:01:42
recursion-ninja: https://www.stackage.org/lts-7.19/hoogle?q=ByteArray%23+-%3E+ByteArray
thatguy 2017-02-07 07:01:48
EvanR: hmm, satisfy (==')' ) will return Nothing in case there is no ')'
thatguy 2017-02-07 07:01:51
but that is the problem
thatguy 2017-02-07 07:02:00
since usefulStuff <* Nothing == Nothing
thatguy 2017-02-07 07:02:09
and I want usefulStuff <* Nothing = usefulStuff
recursion-ninja 2017-02-07 07:02:20
lyxia: I guess I
lyxia 2017-02-07 07:02:31
recursion-ninja: there's hoogle.haskell.org which has been hidden in alpha forever, and hayoo is a pretty comprehensive alternative, with weaker type search IIRC.
recursion-ninja 2017-02-07 07:02:31
lyxia: I guess I'll use that one from now on
EvanR 2017-02-07 07:03:03
thatguy: optional (char ')')
thatguy 2017-02-07 07:03:44
EvanR: thanks
EvanR 2017-02-07 07:03:46
satisfy doesnt return a Maybe
EvanR 2017-02-07 07:03:52
optional does
EvanR 2017-02-07 07:04:01
satisfy might fail, optional wont
thatguy 2017-02-07 07:04:03
but I forgot to mention I am doing it with an own implemented class (I am doing the CIS 194, Spring 2013 course)
EvanR 2017-02-07 07:04:14
oh well then i dont know whats what
thatguy 2017-02-07 07:05:19
EvanR: yeah probably its hard to answer that question without knowing what the class implementations are
thatguy 2017-02-07 07:05:35
thanks anyway
thatguy 2017-02-07 07:05:40
:)
lyxia 2017-02-07 07:05:57
recursion-ninja: when you get an error about lifted vs unlifted, it's a type mismatch. Like you put an Int# where an Int was expected. Int# and Int are different types, like Bool and String, but Int# also has a different kind and that's what GHC is complaining about.
uros 2017-02-07 07:07:11
Hey all, i'm still kinda haskell noob and i have small problem. I don't have $ and <$> in my module. What could be a reason for that?
recursion-ninja 2017-02-07 07:07:31
lyxia: I gathered that from the documentation, but there was no explanation about how to convert between lifted and unlifted types.
recursion-ninja 2017-02-07 07:08:06
lyxia: It'll probably be different for every set of values but a few examples would have been nice.
geekosaur 2017-02-07 07:08:21
@index (<$>)
lambdabot 2017-02-07 07:08:21
Data.Functor, Control.Applicative, Prelude
lyxia 2017-02-07 07:08:50
recursion-ninja: oh, yeah they're somewhat spread out in various modules.
geekosaur 2017-02-07 07:09:04
in older ghc you probably won;'t have <$> from Prelude. $ should be there. can you show full source (i.e. including imports) that fails?
geekosaur 2017-02-07 07:09:08
@paste
lambdabot 2017-02-07 07:09:08
Haskell pastebin: http://lpaste.net/
MarcelineVQ 2017-02-07 07:09:13
recursion-ninja: don't forget to bone up on the manual in such cases https://downloads.haskell.org/~ghc/latest/docs/html/users_guide/glasgow_exts.html#primitives
Tuplanolla 2017-02-07 07:09:24
@index (&)
lambdabot 2017-02-07 07:09:24
Data.Function
Tuplanolla 2017-02-07 07:09:35
Does this thing not index `lens`?
uros 2017-02-07 07:10:09
geekosaur: sure, in a sec
geekosaur 2017-02-07 07:10:10
lens is not a bootlib
geekosaur 2017-02-07 07:10:21
(it only indexes things that come with ghc)
uros 2017-02-07 07:11:05
by the way, it's a yesod app and it excludes prelude so it would be nice to include $ only or something like that
geekosaur 2017-02-07 07:12:20
excluding Prelude is usually a bad idea unless you are using a Prelude replacement (which should have at least ($))
lpaste_ 2017-02-07 07:12:51
uros pasted "MyAuth" at http://lpaste.net/352180
uros 2017-02-07 07:13:29
geekosaur: lines 22 and 32
geekosaur 2017-02-07 07:15:07
ok, you probably want to add ($) and (<$>) to the import on line 8
uros 2017-02-07 07:17:14
geekosour: that's it. I tried that earlier, but forgot parents so it didt'n work. now is's ok
uros 2017-02-07 07:17:52
i have a feeling that ghc it's messing with me.. "The import of '$' from module 'Prelude' is redundant"
uros 2017-02-07 07:17:59
*is
Enigmagic 2017-02-07 07:18:37
recursion-ninja: run `:info Int` in ghci to display the constructors for Int. Int/Double/etc are wrappers around the unlifted primitives
Enigmagic 2017-02-07 07:20:12
:t GHC.Ext.I#
lambdabot 2017-02-07 07:20:15
error:
lambdabot 2017-02-07 07:20:15
Not in scope: data constructor 'GHC.Ext.I#'
lambdabot 2017-02-07 07:20:15
No module named 'GHC.Ext' is imported.
Enigmagic 2017-02-07 07:20:26
:t GHC.Exts.I#
lambdabot 2017-02-07 07:20:28
GHC.Prim.Int# -> Int