Zemyla 2017-02-05 07:48:31
phadej: But yeah, once you have a StateP t u a and a StateP t v b, each of which has a series of states, you can actually take the cartesian product of those states and it'll produce a StateP t (u, v) (a, b).
Zemyla 2017-02-05 07:51:05
And complement involves taking the StatePs and applying maybe (Just $ const ()) (const Nothing) to the accept functions.
muesli4 2017-02-05 07:53:32
Hi, is there something that allows to build with stack on another machine (same architecture)? 1GB doesn't seem to be enough to build with GHC. It's constantly swapping and I fear it will never finish.
hpc 2017-02-05 07:54:24
it'll finish, i used a machine with 1G of ram up until about 2 weeks ago
hpc 2017-02-05 07:54:38
but also can you not just set up stack on the other machine?
Zemyla 2017-02-05 07:54:47
hpc: Had Stack finished compiling by then?
hpc 2017-02-05 07:55:01
haha
muesli4 2017-02-05 07:56:00
hpc: Not in time. It's a netbook.
muesli4 2017-02-05 07:58:37
hpc: Once I compiled on a Raspberry PI 2 (also 1 GB of memory). I couldn't get bytestring to build with a specific version (although with a newer version it worked).
qmm 2017-02-05 08:07:47
there's a tldr example in hackage: >>> get conn "counters" "bucket" "key"
qmm 2017-02-05 08:07:58
get has this signature: get :: Connection -> BucketType -> Bucket -> Key -> IO (Maybe DataType)
qmm 2017-02-05 08:09:08
i guess that is pseudocode since BucketType is a Maybe Data.ByteString.Lazy.Internal.ByteString
qmm 2017-02-05 08:09:51
(guess i don't have a question)
ph88 2017-02-05 08:19:23
how to add optional functions to a class ? functions that don't need to be implemented for the minimal implementation
ph88 2017-02-05 08:19:53
is it also possible to have a condition that either one of two functions need to be implemented ?
opqdonut 2017-02-05 08:20:58
ph88: "optional" functions are just functions that have a default implementation
ph88 2017-02-05 08:21:06
oh ok
opqdonut 2017-02-05 08:21:47
and you can't really encode minimal implementation rules in the language, you just use documentation for that
opqdonut 2017-02-05 08:22:11
GHC will emit a warning if you don't give an implementation to a method that doesn't have a default implementation
ph88 2017-02-05 08:22:37
when i have two functions and implement them in term of each other does that encode that either one of them has to be implemented by the instance ?
sm 2017-02-05 08:22:58
muesli4: there are flags you can set to limit memory usage and avoid swapping
opqdonut 2017-02-05 08:23:58
ph88: no, not really. it might be completely valid mutual recursion for instance
opqdonut 2017-02-05 08:24:32
ah there's a GHC pragma
opqdonut 2017-02-05 08:24:40
for minimal complete definitions
opqdonut 2017-02-05 08:24:56
see e.g. http://hackage.haskell.org/package/base-4.9.1.0/docs/src/GHC.Show.html#Show
ph88 2017-02-05 08:26:22
opqdonut, i have this class and i want to add get2 https://paste.fedoraproject.org/547988/63226901/ most of the time i don't need the extra functionality that get2 offers, but for some situations i MUST give the extra argument that get2 takes .. but when i only implement get2 then ghc is gonna complain that get is not implemented
ph88 2017-02-05 08:27:04
likewise when i have the "normal" situation where get is implemented i don't really care about an implementation for get2
opqdonut 2017-02-05 08:27:31
perhaps it should be two classes then?
ph88 2017-02-05 08:27:36
so i was thinking to give a default implementation for both of them and express on in terms of the other
opqdonut 2017-02-05 08:27:40
right
opqdonut 2017-02-05 08:27:49
that would be typical
ph88 2017-02-05 08:27:56
get2 default implementation is easy get2 _ = get
opqdonut 2017-02-05 08:28:13
ah
opqdonut 2017-02-05 08:28:16
yeah
ph88 2017-02-05 08:28:47
but for get i'm not sure, because get2 will need to be passed some function which doesn't really make sense
ph88 2017-02-05 08:28:57
get = get2 ???
muesli4 2017-02-05 08:28:58
sm: Thanks!
ph88 2017-02-05 08:29:12
get = get2
ph88 2017-02-05 08:29:31
i guess i will have to decode myself what is the default function in this case ?
ph88 2017-02-05 08:29:36
decode -> decide
opqdonut 2017-02-05 08:30:35
if you know nothing of f there is no function f a -> f [a] you can use
opqdonut 2017-02-05 08:30:50
do you really need the default for get? can't you just define get and get2?
ph88 2017-02-05 08:32:01
i have two functions that are f a -> f [a] many and some combinators
opqdonut 2017-02-05 08:32:43
in the context of the class definition you know nothing of f
opqdonut 2017-02-05 08:32:51
so you can't operate on values of type f a at all
opqdonut 2017-02-05 08:33:24
if the class was, say, "class Functor f => Rule f a where ..."
opqdonut 2017-02-05 08:33:41
then you coud use something like "fmap (\x -> [x])"
ph88 2017-02-05 08:36:11
i think i will go with get = undefined actually
ph88 2017-02-05 08:36:49
that way if get2 is implemented and get is not implemented then i will find out really quickly when somewhere else i use get when i'm suppose to use get2
opqdonut 2017-02-05 08:39:00
sounds like two type classes would be a better fit
opqdonut 2017-02-05 08:39:10
but I don't have the context
muesli4 2017-02-05 08:40:01
sm: I'm apparently not able to find any information on how to reduce the amount of used memory of stack and ghc. Could you point me to the right place?
sm 2017-02-05 08:40:58
muesli4: it's a ghc RTS option, something like +RTS -M500m, which you must pass to ghc through the layers of stack/cabal, I can never remember how
muesli4 2017-02-05 08:41:17
sm: Ah, I see.
sm 2017-02-05 08:41:21
stack build --ghc-options='+RTS -M500m' ?
sm 2017-02-05 08:41:51
see also ghc +RTS --help
ClaudiusMaximus 2017-02-05 08:44:32
does ghc still support environment variables for RTS options?
monochrom 2017-02-05 08:44:49
yes