Search Haskell Channel Logs

Sunday, February 5, 2017

#haskell channel featuring magthe, opqdonut, liste, jle`, recur22, ibrahemgebri, and 8 others.

qmm 2017-02-05 19:57:31
http://lpaste.net/352119 forkProcess :: LocalNode -> Process () -> IO ProcessId ; run :: Port -> Application -> IO () ; how to turn IO () into a Process ()? https://hackage.haskell.org/package/distributed-process-0.6.6/docs/Control-Distributed-Process-Internal-Types.html#t:Process derives a MonadIO
liste 2017-02-05 19:58:26
:t liftIO
lambdabot 2017-02-05 19:58:27
MonadIO m => IO a -> m a
liste 2017-02-05 19:58:38
qmm: ^
magthe 2017-02-05 19:59:11
is there no IRC channel for stack/stackage discussions?
jle` 2017-02-05 19:59:37
magthe: there's #haskell-stack
magthe 2017-02-05 20:00:05
jle`: aha... I'll see about adding it to the wiki then :) thanks!
jle` 2017-02-05 20:00:15
no problem!
marekw2143 2017-02-05 20:09:18
hello, in case of code: "data SuperData a = SuperData { runSuperData :: Maybe a }
marekw2143 2017-02-05 20:09:23
then what is runSuperData /
marekw2143 2017-02-05 20:09:24
?
srhb 2017-02-05 20:09:50
marekw2143: It says what it is right there in the type of the field, it's a Maybe a
marekw2143 2017-02-05 20:10:35
oh, so "superData" is just a field -generally it's field syntax constructor ?
srhb 2017-02-05 20:11:07
marekw2143: There is no superData. SuperData is a value constructor though. Not a field.
srhb 2017-02-05 20:11:14
marekw2143: runSuperData is a field.
marekw2143 2017-02-05 20:11:29
yes, I've meant runSuperData
srhb 2017-02-05 20:11:42
Then yes, it's a field. :)
marekw2143 2017-02-05 20:13:12
but here https://github.com/kqr/gists/blob/master/articles/gentle-introduction-monad-transformers.md#type-classes
marekw2143 2017-02-05 20:13:17
then there's rfield runEitherIO
marekw2143 2017-02-05 20:13:25
but I cannot see it's definitio
srhb 2017-02-05 20:13:44
marekw2143: It has no "definition" beyond that.
marekw2143 2017-02-05 20:14:10
so how it works ?
srhb 2017-02-05 20:14:19
marekw2143: If you make a _value_ of type EitherIO e a, you would _provide_ an IO (Either e a)
dramforever 2017-02-05 20:14:27
@let data SuperData a = SuperData { runSuperData :: Maybe a }
lambdabot 2017-02-05 20:14:28
Defined.
dramforever 2017-02-05 20:14:30
:t runSuperData
lambdabot 2017-02-05 20:14:32
SuperData a -> Maybe a
srhb 2017-02-05 20:14:36
marekw2143: It doesn't "work." I think you're confused by the "run" in the name.
dramforever 2017-02-05 20:14:54
it just gets the 'Maybe a' out of a SuperData
dramforever 2017-02-05 20:15:00
:t SuperData
lambdabot 2017-02-05 20:15:05
Maybe a -> SuperData a
dramforever 2017-02-05 20:15:09
^ basically the reverse of this
marekw2143 2017-02-05 20:15:25
hmm, it seems like just pattern matching
dramforever 2017-02-05 20:15:30
You know record syntax?
marekw2143 2017-02-05 20:15:37
I thought I know
marekw2143 2017-02-05 20:15:38
;)
dramforever 2017-02-05 20:15:46
@let data Point = Point { x :: Double, y :: Double }
lambdabot 2017-02-05 20:15:48
Defined.
dramforever 2017-02-05 20:15:51
:t x
lambdabot 2017-02-05 20:15:52
error:
lambdabot 2017-02-05 20:15:52
Ambiguous occurrence 'x'
lambdabot 2017-02-05 20:15:52
It could refer to either 'Debug.SimpleReflect.x',
dramforever 2017-02-05 20:15:56
Exactly the same here
dramforever 2017-02-05 20:16:05
except I've got another stupid x interfering here
marekw2143 2017-02-05 20:16:20
ok, so in runEitherIO example
dramforever 2017-02-05 20:16:22
@let data BetterPoint = BetterPoint { betterx :: Double, bettery :: Double }
lambdabot 2017-02-05 20:16:23
Defined.
dramforever 2017-02-05 20:16:27
:t betterx
lambdabot 2017-02-05 20:16:28
BetterPoint -> Double
marekw2143 2017-02-05 20:16:30
thne runEitherIO is just a function
marekw2143 2017-02-05 20:16:40
which on the basis of instance EitherIO a e
dramforever 2017-02-05 20:16:47
no basis
dramforever 2017-02-05 20:17:04
oops sorry
dramforever 2017-02-05 20:17:12
marekw2143: What do you mean by basis?
marekw2143 2017-02-05 20:17:40
by "on basis" I mean that having "value of type EitherIO a e"
dramforever 2017-02-05 20:17:52
okay
marekw2143 2017-02-05 20:17:58
so that runEitherIO just unpacks "value of type EitherIO a e"
marekw2143 2017-02-05 20:18:09
to value of type IO (Either a e )
dramforever 2017-02-05 20:18:09
exactly
marekw2143 2017-02-05 20:18:23
so it' s just something like pattern mathicnng ?
dramforever 2017-02-05 20:18:47
('IO (Either e a)' really)
dramforever 2017-02-05 20:19:14
Yeah
dramforever 2017-02-05 20:19:19
Just how records work
marekw2143 2017-02-05 20:19:27
ok
dramforever 2017-02-05 20:19:31
It's kinda like a trick or something
marekw2143 2017-02-05 20:19:35
but how to set that value to it ?
dramforever 2017-02-05 20:19:49
EitherIO is a constructor :P
dramforever 2017-02-05 20:19:54
:t EitherIO
lambdabot 2017-02-05 20:19:56
error: Data constructor not in scope: EitherIO
dramforever 2017-02-05 20:20:08
oh, we've got SuperData
dramforever 2017-02-05 20:20:11
:t SuperData
lambdabot 2017-02-05 20:20:12
Maybe a -> SuperData a
dramforever 2017-02-05 20:20:24
That's how to 'set that value to it'
dramforever 2017-02-05 20:20:44
For record syntax you would probably normally do this:
dramforever 2017-02-05 20:20:53
:t BetterPoint { x = 1, y = 2 }
lambdabot 2017-02-05 20:20:54
error:
lambdabot 2017-02-05 20:20:54
Ambiguous occurrence 'x'
lambdabot 2017-02-05 20:20:54
It could refer to either 'Debug.SimpleReflect.x',
dramforever 2017-02-05 20:21:02
:t BetterPoint { betterx = 1, bettery = 2 }
lambdabot 2017-02-05 20:21:04
BetterPoint
dramforever 2017-02-05 20:21:09
Sorry, the second one is correct
dramforever 2017-02-05 20:21:16
But this works just fine:
dramforever 2017-02-05 20:21:23
:t BetterPoint 1 2
lambdabot 2017-02-05 20:21:25
BetterPoint
dramforever 2017-02-05 20:21:35
> betterx (BetterPoint 1 2) -- You can even get the x out of it
lambdabot 2017-02-05 20:21:38
1.0
dramforever 2017-02-05 20:21:46
but it kinda defeats the purpose of records
marekw2143 2017-02-05 20:21:53
ok, so in example with "EitherIO"
dramforever 2017-02-05 20:21:59
*but* for EitherIO we *know* we have only one field
dramforever 2017-02-05 20:22:07
so it's not going to be any trouble
dramforever 2017-02-05 20:22:10
it's actually easier to do
dramforever 2017-02-05 20:22:22
so I called it sorta a trick above
marekw2143 2017-02-05 20:22:29
ok
marekw2143 2017-02-05 20:23:10
so when I'd have value1 = EitherIo { runEitherIod = IO ( Either 1 "error" } }
marekw2143 2017-02-05 20:23:16
that is the way ?
dramforever 2017-02-05 20:23:28
That's one way
dramforever 2017-02-05 20:23:45
'the' way is usually just 'EitherIO something'
dramforever 2017-02-05 20:24:01
And you are confusing types and values in your construction as well
halogenandtoast 2017-02-05 20:24:10
Anyone here from Tokyo?
dramforever 2017-02-05 20:24:20
'IO ( Either 1 "error")' makes no sense
marekw2143 2017-02-05 20:24:44
because 1 and "error" are values
pikajude 2017-02-05 20:25:16
well they could be Nat and Symbol
pikajude 2017-02-05 20:25:18
or whatever those are called
dramforever 2017-02-05 20:25:36
marekw2143: then what are your IO and Either doing there?
dramforever 2017-02-05 20:25:46
pikajude: go away you're ruining the fun
marekw2143 2017-02-05 20:27:29
hmm, so in example with monad transformers
marekw2143 2017-02-05 20:27:59
for definition of monad like x >>= f = EitherIO $ runEitherIO x >>= either (return .Left) (runEitherIO . f)
recur22 2017-02-05 20:28:14
dose anyone here know if diagrams support hittesting?i tried to google it but no luck
marekw2143 2017-02-05 20:28:46
then first "runEitherIO x" just gives us value of IO (Eitther a e)
marekw2143 2017-02-05 20:29:23
then there's used ">>=" defined for IO monad ?
ertes 2017-02-05 20:31:31
the API of System.Mem.StableName is confusing… why does StableName have a type argument, and why does makeStableName take a value of that type?
marekw2143 2017-02-05 20:31:31
:t either
lambdabot 2017-02-05 20:31:33
(a -> c) -> (b -> c) -> Either a b -> c
ertes 2017-02-05 20:31:43
isn't it basically equivalent to Data.Unique?
ertes 2017-02-05 20:34:57
ah, i see
ertes 2017-02-05 20:35:07
it does actually take sharing into account
ertes 2017-02-05 20:37:25
yet i don't see why StableName would require a type argument
opqdonut 2017-02-05 20:40:13
ertes: yeah it's not really used for anything, except to limit the Eq instance to the same type
ertes 2017-02-05 20:40:42
opqdonut: even that is questionable since there is eqStableName, which doesn't have that limit
opqdonut 2017-02-05 20:41:49
maybe the answer is that GHC.Base.StableName# takes a type argument
ibrahemgebri 2017-02-05 20:42:47
9 11 attacks, Did USA do it itself or it just let it happen?
ibrahemgebri 2017-02-05 20:42:47
Did USA administration murder 3000 American citizen in 9 11 attacks to justify starting a war against iraq?
ibrahemgebri 2017-02-05 20:42:47
If al-qaeda did it, why go to kill 2 million Iraqi?
ibrahemgebri 2017-02-05 20:42:47
http://creatvchaos.blogspot.com.eg/ https://creatvchaos.wordpress.com/
ibrahemgebri 2017-02-05 20:42:47
Some of the benefits Americans say they achieved after 9 11 attacks include:
ibrahemgebri 2017-02-05 20:42:47
*constant flow of oil, which price is in continuous decline. Trump said he will simply take the Iraqi oil, and when he was told that Iraqi oil belongs to iraq he said there is no iraq(after usa destroyed it ).
ibrahemgebri 2017-02-05 20:42:48
*Invasion of afghanstan with construction of not less than 14 american military base which give a close eye on china.
ibrahemgebri 2017-02-05 20:42:48
*Removal of potential threat to isreal represented in iraq which throw isreal with more than 30 rocket after American assault on iraq during 2nd gulf war.
ertes 2017-02-05 20:43:17
opqdonut: it does, but it's not used for anything either
opqdonut 2017-02-05 20:43:38
ertes: well some other use case might use it
ertes 2017-02-05 20:43:59
in base?
opqdonut 2017-02-05 20:44:11
yeah I know of now other use cases :)0~
opqdonut 2017-02-05 20:44:14
if you really really want to know maybe the (-users) mailing list is the best place to ask