Sornaensis 2017-02-08 18:47:58
ahh I found the solution: pkg-config was mismatched
excelsiora 2017-02-08 18:50:13
runnign stack setup
excelsiora 2017-02-08 18:51:30
ertes: thanks - but I think ob-haskell hard-codes "inf-haskell" - so I'm going to look into haskell-interactive-mode
ertes 2017-02-08 19:00:44
i have a function of the following shape: f x = unsafePerformIO . IO $ \s0 -> …
ertes 2017-02-08 19:00:59
will NOINLINEing that function be enough to make it safe? i'm a bit worried about CSE
ertes 2017-02-08 19:02:35
the IO action only creates a MutVar# and populates a constructor, nothing else
c_wraith 2017-02-08 19:03:16
why unsafePerformIO at all?
jle` 2017-02-08 19:04:34
ertes: the fact that it's function might make it difficult to be safe
jle` 2017-02-08 19:05:02
would 'f 10' return the same thing every time it is called?
ertes 2017-02-08 19:05:44
c_wraith: because the API is going to be pure, but relies heavily on non-local side effects for efficiency
ertes 2017-02-08 19:06:02
jle`: semantically yes
ertes 2017-02-08 19:06:19
but duplicating it would be less efficient
c_wraith 2017-02-08 19:06:37
ertes: if you're worrying about CSE, you're not in a situation unsafePerformIO is good for.
dramforever 2017-02-08 19:07:38
ertes: Can you just keep the bad parts in IO and put unsafePerformIO on the pure API?
dramforever 2017-02-08 19:07:53
because otherwise it's not a pure API
c_wraith 2017-02-08 19:10:50
ertes: I mean, "non-local effects" sounds like it would completely break persistent uses of the API, which a pure API should support transparently.
ertes 2017-02-08 19:11:07
c_wraith: that's the plan
ertes 2017-02-08 19:11:29
it's basically a self-propagating version of Coyoneda IORef
c_wraith 2017-02-08 19:11:30
then the API isn't pure?
dramforever 2017-02-08 19:11:51
c_wraith: I can think of an example I think
dramforever 2017-02-08 19:12:01
Attoparsec!
ertes 2017-02-08 19:12:34
one IORef at the write end, multiple (Coyoneda IORef)s at the read ends
dramforever 2017-02-08 19:12:42
Where I totally do not understand why the docs say this: http://hackage.haskell.org/package/attoparsec-0.13.1.0/docs/Data-Attoparsec-ByteString.html#v:Partial
c_wraith 2017-02-08 19:13:52
ertes: IORef needs IO to write to, Coyoneda IORef needs IO to read from - where's the part that can't be in IO?
ertes 2017-02-08 19:14:18
c_wraith: e.g. fmap
c_wraith 2017-02-08 19:14:23
that's not reading
c_wraith 2017-02-08 19:14:46
It also doesn't require duplicating the mutvar#
c_wraith 2017-02-08 19:14:57
I fail to see where unsafePerformIO becomes a requirement
dramforever 2017-02-08 19:15:23
Is it just 'pure but unsafe' is easier than IO?
dramforever 2017-02-08 19:15:49
oh wait a sec you're trying to squeeze IO into some other function?
dramforever 2017-02-08 19:15:49
huh
ertes 2017-02-08 19:15:57
c_wraith: i'm creating a variant of Coyoneda IORef that caches the values
ertes 2017-02-08 19:17:26
simplified: data Var a = Var (IO a) (IORef (Maybe a)) -- when the value is already known, the IORef is a Just, otherwise the IO action will compute the value based on other Vars
c_wraith 2017-02-08 19:17:29
so your goal is to reduce recalculation of intermediate results in a tree of fmaps?
ertes 2017-02-08 19:17:36
(of course this isn't exposed)
ertes 2017-02-08 19:17:39
yeah
ertes 2017-02-08 19:17:45
not just fmaps
ertes 2017-02-08 19:17:55
basically a fully monadic interface
c_wraith 2017-02-08 19:20:26
dunno. It seems bad if a result is cached, then the upstream IORef is updated. Where's the cache invalidation?
ertes 2017-02-08 19:21:06
this is simplified… the real update action is a (Codensity IO a) that invalidates the cache at the end
c_wraith 2017-02-08 19:21:32
"at the end" isn't good enough in a concurrent environment. :)
c_wraith 2017-02-08 19:22:43
I guess it's OK if you don't demand 100% atomic updates
c_wraith 2017-02-08 19:22:50
dirty reads are ok sometimes
c_wraith 2017-02-08 19:23:41
but once you introduce potential dirty reads, the burden for using the structure properly goes way up..
ertes 2017-02-08 19:23:42
again: this is highly simplified… there is going to be proper locking as well… i'm even considering TVar# instead of the current MutVar# =)
ertes 2017-02-08 19:24:11
and yes, i realise that this needs a comprehensive test suite =)
c_wraith 2017-02-08 19:24:49
Why not simplify things and not use unsafePerformIO? :)
ertes 2017-02-08 19:24:58
how?
ertes 2017-02-08 19:25:42
i don't feel very confident about using runRW# directly =P
orion 2017-02-08 19:27:50
Does anyone know which primitive of optparse-applicative I would need for "cmd --foobar -- a b c", where I am looking to collect 'a', 'b', and 'c' in a list of Strings
c_wraith 2017-02-08 19:28:17
ertes: Just don't support things that don't work without invisible allocation. This just sounds like a problem that needs a different solution design.
ezyang 2017-02-08 19:37:45
Hey reflex users: why is the Reflex type class on (a :: *) and not (a :: * -> *)?
MarcelineVQ 2017-02-08 19:39:42
idk about that stuff but leave a message in #reflex-frp too, the dev's hang out in there