Search Haskell Channel Logs

Wednesday, March 8, 2017

#haskell channel featuring bezirg, tsahyt, byorgey, cris_, Aruro, lyxia,

cris_ 2017-03-08 03:47:09
this is my ~/.nixpkgs/config.nix
Aruro 2017-03-08 03:47:40
is it possible to run servant in sate monad? so the server can print its own log?
cris_ 2017-03-08 03:48:18
i want to install my own library into nix ; i search over google and come up with above , but it still not working anot working
cris_ 2017-03-08 03:48:53
after i run $ nix-env -iA nixpkgs.myHaskellEnv
bennofs 2017-03-08 03:49:08
cris_: it should look like https://hastebin.com/ilujoqaxif.m
bennofs 2017-03-08 03:50:01
cris_: also if you want to have carbonara in the env, you should add to the list of packages in the ghcWithPackages call
bennofs 2017-03-08 03:50:25
cris_: like https://hastebin.com/hutepuxeqi.m
bezirg 2017-03-08 03:50:47
hello, I have a type erro: ambiguous type, with only one potential instance. Can I force ghc to pick that instance, even if that means that the open world assumption of type classes will be broken?
jan_path 2017-03-08 03:52:59
bezirg: Is an explicit type signature an option?
Aruro 2017-03-08 03:54:46
does cabal have option of installing all libraries with prefix ? like : cabal install lens*
cris_ 2017-03-08 03:54:46
thanks bennofs
bezirg 2017-03-08 03:54:46
jan_path: nope
lyxia 2017-03-08 03:56:19
bezirg: can you show us the instance and the use site
cris_ 2017-03-08 03:56:51
bennofs: i got this error $ nix-env -iA nixpkgs.myHaskellEnv error: value is a set while an integer was expected, at /home/hp/.nixpkgs/config.nix:4:18
bennofs 2017-03-08 03:59:33
cris_: try https://hastebin.com/ayutuyibif.m, nix does not support ~ i believe
lpaste_ 2017-03-08 03:59:37
bezirg pasted "A subtyping ambiguity error" at http://lpaste.net/353312
tsahyt 2017-03-08 04:09:47
well I want to write a function [0,1] -> a, representing the (interpolated) frequency domain of a signal
tsahyt 2017-03-08 04:09:56
so really querying it would be enough I suppose
byorgey 2017-03-08 04:10:07
tsahyt: sure, it's pretty easy, which is probably why there's no standard library for it (and because there are lots of choices one could make for the operations and no obvious "right" choice)
tsahyt 2017-03-08 04:10:14
fair enough
cris_ 2017-03-08 04:10:23
hi bennofs , i believe i should have installed my carbonara library to my nix ; when i enter ghci and type this ghci> :m + Data.Carbonara , then this error msg shows: Could not find module `Data.Carbonara' It is a member of the hidden package `carbonara-0.0.1@carbonara-0.0.1-9mRaHjrFnefKzrLX1w1WSO'.
tsahyt 2017-03-08 04:10:25
I'll think about whether this is a smart idea and possibly implement my own if it makes sense
byorgey 2017-03-08 04:10:30
tsahyt: who cares about wasting the range of Double? If you really care about memory usage, then use Float instead of Double
jan_path 2017-03-08 04:10:50
bezirg: Would a functional dependency do: class Sub a b | a -> b. So any type can only be subtype of at most one supertype?
bezirg 2017-03-08 04:10:51
lyxia: I added instance (a ~ I_) => Sub a I_ where up = id , but it didn't work
lyxia 2017-03-08 04:10:53
bezirg: it won't. Let's say you had instance {-# OVERLAPPABLE #-} b ~ I_ => Sub I_ b, but also instance Sub I_ I, then the first instance will never be selected as long as b is unknown
lyxia 2017-03-08 04:11:04
because it overlaps with the second.
tsahyt 2017-03-08 04:11:05
byorgey: well I could have better precision within the same number of bits. not that it really matters in practice I guess
byorgey 2017-03-08 04:11:23
tsahyt: sure, you just have to decide what you care about.
lyxia 2017-03-08 04:11:28
bezirg: it will only be selected if you know in advance that b ~ I_, which defeats the whole point of the trick.
tsahyt 2017-03-08 04:11:42
first I need to figure out how to interpolate the spectrum in the first place
tsahyt 2017-03-08 04:13:40
this is simultaneously an attempt at learning more about DSP, so I'm writing this code as I go and discover the concepts.
byorgey 2017-03-08 04:14:13
sounds like fun
tsahyt 2017-03-08 04:14:13
it's been quite entertaining so far. I have no idea how well my code would run in the real world yet and there are quite a few challenges to be solved still to make this actually usable
bezirg 2017-03-08 04:14:13
lyxia: y, you are right
bezirg 2017-03-08 04:14:13
jan_path: I don't think functional dependency works, because there is not a single mapping from a to b. There may be many a's mapping to different b's
lyxia 2017-03-08 04:15:18
bezirg: Oh I didn't realize instance a ~ I_ => Sub a I_ overlaps with the previous one, that's pretty bad.
bezirg 2017-03-08 04:15:18
lyxia: I also tried ClosedTypeFamilies, AllowAmbiguityTypes but it didn't work
lyxia 2017-03-08 04:16:06
I can't see how these extensions would help
bezirg 2017-03-08 04:17:56
lyxia: I thought maybe I can close somehow the Sub typeclass through ClosedTypeFamilies, but it didn't work. AllowAmbiguityTypes can be used to "delay?" ambiguity resolution to the call site. Also didn't work
lyxia 2017-03-08 04:20:06
bezirg: you don't have definitions with ambiguous types though. The ambiguity is only at the call site.
bezirg 2017-03-08 04:20:26
lyxia: I thought maybe "default" could help here, but that is restricted to single parameter type classes of Eq,Ord,Num,Show
lyxia 2017-03-08 04:20:49
bezirg: This kind of explicit subtyping relation looks like an antipattern, because of this kind of issues and hacks involved.
cris_ 2017-03-08 04:33:45
bennofs: I have resolved the issue, it was due to my old version of carbonara still lie in the system, which interfere with my current version; i just $ ghc-pkg unregister ...
cris_ 2017-03-08 04:34:15
bennofs: thanks v much for your help
bezirg 2017-03-08 04:35:22
lyxia: what about IncoherentInstances?