Search Haskell Channel Logs

Friday, February 10, 2017

#haskell channel featuring phadej, opqdonut, nesqi, angerman, bollu, kgadek, and 12 others.

bollu 2017-02-10 03:45:12
angerman: nix-shell errors at error: opening file '/Users/bollu/work/ghc-all/data-bitcode-plugin-env/data-bitcode-plugin/default.nix': No such file or directory
max3 2017-02-10 03:48:34
what does this syntax mean? `instance PGType "segment"` i'm familiar with implementing a type class but i don't understand the string here
c_wraith 2017-02-10 03:49:01
max3: the string is a type. :)
c_wraith 2017-02-10 03:49:20
max3: using the DataKinds extension, String literals are types of kind Symbol
max3 2017-02-10 03:50:16
okay but then what is this `instance Range.PGRangeType "segment" "interval"`
max3 2017-02-10 03:50:27
two types?
c_wraith 2017-02-10 03:50:55
Yes. Are you familiar with multiparameter type classes?
max3 2017-02-10 03:51:15
no
c_wraith 2017-02-10 03:51:48
Ah. It's another GHC extension. It allows you to make classes that take multiple type parameters.
max3 2017-02-10 03:52:00
on compilation i'm getting complaints that `Range.PGRangeType` is being applied to too many type arguments
c_wraith 2017-02-10 03:52:38
Then maybe it's not a multiparameter type class.
lpaste_ 2017-02-10 04:05:09
merijn pasted "And slowly progress is made..." at http://lpaste.net/5100689670237323264
angerman 2017-02-10 04:10:39
bollu did you clone with submodules?
alx741 2017-02-10 04:11:14
hello everyone
alx741 2017-02-10 04:11:53
I'd like to have access to (globally) stack installed packages from normal ghci (not stack ghci) so I can to `ghci file.hs`, is that possible?
alx741 2017-02-10 04:12:04
s/to/do
opqdonut 2017-02-10 04:12:35
alx741: why not "stack ghci file.hs"?
opqdonut 2017-02-10 04:13:21
there's an implicit global stack project that gets used for "stack install" and "stack ghci" etc. if you don't have a stack.yaml
alx741 2017-02-10 04:14:11
opqdonut: according to the stack documentation `stack ghci file.hs` will figure out which component the file is associated with (in a stack project) but if 'file.hs' is a standalone file it doesn't work
alx741 2017-02-10 04:15:15
in particular I get this: "Warning: Couldn't find a component for file target /home/alx/test/t.hs. Attempting to load anyway." and the file seems to not be loaded whatsoever
alx741 2017-02-10 04:15:46
but doing `ghci file.hs` works fine, except I have no access to stack installed packages from there
alx741 2017-02-10 04:18:28
doing `stack ghci file.hs` doesn't load 'file.hs', but then while already in the repl, doing ':l file.hs' works just fine. It's just the file in the command line argument doesn't work
nesqi 2017-02-10 04:21:50
Is there a cleaner way to write 'fromMaybe <$> fail "Error message" <*> maybeExpr ...'
kgadek 2017-02-10 04:23:48
nesqi: do you need custom err msg? if not: fromJust
nesqi 2017-02-10 04:25:19
I this particular case I need the custom error message.
nesqi 2017-02-10 04:25:32
But i could just make my own fromJust
nesqi 2017-02-10 04:25:43
(with some other name)
nesqi 2017-02-10 04:25:53
thanks
merijn 2017-02-10 04:29:41
tbh that code seems like a completely silly use of fromMaybe and fail
Boomerang 2017-02-10 04:33:07
> round (0/0) -- What do you think of this behavior? Does it make sense?
lambdabot 2017-02-10 04:33:09
-269653970229347386159395778618353710042696546841345985910145121736599013708...
Jinixt 2017-02-10 04:33:38
isn't anything fair game once you divide by zero?
Tuplanolla 2017-02-10 04:33:50
Anything is fair game once you introduce floating-point numbers.
Boomerang 2017-02-10 04:33:51
I would expect an error
merijn 2017-02-10 04:34:06
Boomerang: Which error?
kgadek 2017-02-10 04:34:06
dividing by 0 in floats give NaN
nesqi 2017-02-10 04:34:10
merijn: yeah... it's not working...
Boomerang 2017-02-10 04:34:27
NaN shouldn't be convertible to an Int though
merijn 2017-02-10 04:34:28
nesqi: Which Applicative is that and what are you trying to do?
phadej 2017-02-10 04:34:28
> rount (0/0 :: Float)
lambdabot 2017-02-10 04:34:30
error:
lambdabot 2017-02-10 04:34:30
• Variable not in scope: rount :: Float -> t
lambdabot 2017-02-10 04:34:31
• Perhaps you meant one of these:
phadej 2017-02-10 04:34:32
> round (0/0 :: Float)
lambdabot 2017-02-10 04:34:34
-510423550381407695195061911147652317184
phadej 2017-02-10 04:35:20
> round (0/0 :: Rational)
nesqi 2017-02-10 04:35:22
I'm in the Action monad (shake build system) and want to fail with an error message if getEnv fails.
lambdabot 2017-02-10 04:35:24
*Exception: Ratio has zero denominator
Boomerang 2017-02-10 04:35:28
> round (1/0) -- The behavior for infinity is fair enough, it depends on the definition of Int
Prutheus 2017-02-10 04:35:29
Hello! I wanna build a library with stack (stack instal ...) .... how can I do something my ram is not gettting full and the server crashes?
lambdabot 2017-02-10 04:35:32
1797693134862315907729305190789024733617976978942306572734300811577326758055...
phadej 2017-02-10 04:35:47
> round (0/0 :: Float) :: Int
kgadek 2017-02-10 04:35:49
well. If we assume NaN is an error, then even more functions needs rethinking if we want to preserve totality
lambdabot 2017-02-10 04:35:49
0
opqdonut 2017-02-10 04:36:08
in java round NaN => 0, floor NaN => NaN
opqdonut 2017-02-10 04:36:09
weird
phadej 2017-02-10 04:36:26
wedify: floor is :: -> Integral
phadej 2017-02-10 04:36:30
opqdonut: ^
opqdonut 2017-02-10 04:36:30
ah, it's because round returns integral
phadej 2017-02-10 04:36:34
eys
alx741 2017-02-10 04:36:35
Prutheus: have a big enough swap partition, but remember is not a good idea to -build- on the server, build on your machine and then deploy binaries
opqdonut 2017-02-10 04:36:38
(in java too)
Boomerang 2017-02-10 04:36:41
Actually even infinity is weird, where does the value come from? It's not 64bit Int, is it?
phadej 2017-02-10 04:36:47
ah, too late on Friday, cannot type anymore
Prutheus 2017-02-10 04:36:54
okay
phadej 2017-02-10 04:36:57
Boomerang:
phadej 2017-02-10 04:37:03
> maxBound :: Double
lambdabot 2017-02-10 04:37:05
error:
lambdabot 2017-02-10 04:37:05
• No instance for (Bounded Double) arising from a use of 'maxBound'
lambdabot 2017-02-10 04:37:06
• In the expression: maxBound :: Double
phadej 2017-02-10 04:37:14
ah, but somethign like that
Boomerang 2017-02-10 04:37:27
phadej: Ah yes this makes sense
phadej 2017-02-10 04:38:50
The value of this constant is positive 1.7976931348623157E+308
mniip 2017-02-10 04:39:32
that's because it uses bit tricks
mniip 2017-02-10 04:39:39
> properFraction (0/0)
lambdabot 2017-02-10 04:39:41
(-26965397022934738615939577861835371004269654684134598591014512173659901370...
mniip 2017-02-10 04:39:46
> properFraction (0/0 :: Float)
lambdabot 2017-02-10 04:39:49
(-510423550381407695195061911147652317184,0.0)
kgadek 2017-02-10 04:40:07
IEEE754 defines NaN as non-comparable, so the "value of NaN" is implementation detail
Boomerang 2017-02-10 04:40:31
What does properFraction do exactly?
mniip 2017-02-10 04:41:05
> properFraction 3.5
lambdabot 2017-02-10 04:41:08
(3,0.5)
kgadek 2017-02-10 04:41:24
Boomerang: https://hackage.haskell.org/package/base-4.9.1.0/docs/Prelude.html#v:properFraction
Boomerang 2017-02-10 04:42:19
Thanks!
quchen 2017-02-10 04:44:22
?check \x -> let (a,b) = properFraction x in x == fromIntegral a + b
lambdabot 2017-02-10 04:44:25
+++ OK, passed 100 tests.