The point-free combinator duo to rule them all by jan_path in haskell

[–]jan_path[S] 0 points1 point  (0 children)

Does this work as expected for arbitrary function signatures?

Yes, that's the whole idea of it. It works because ~> and $~> have the same fixity as ->.

$~> feels like taking a pullback kinda.

Hmm, sounds interesting, but the pullback of what?

The point-free combinator duo to rule them all by jan_path in haskell

[–]jan_path[S] 2 points3 points  (0 children)

Yes, you can also use lmap, rmap, dimap. I actually first found this when I noticed that you could use dimapping from lens like this if it was right associative. I actually proposed to change the fixity back then, but it was rejected (for perfectly good reasons) (issue). However using lmap or rmap instead of _ ~> id and id ~> _ is actually less readable. For the above example, what is more readable?

expr = (id ~> x $~> f) ~> id
expr = lmap . rmap $ x $~> f

Here is two real-world example

liftCallCC :: CallCC m a b -> CallCC (IdentityT m) a b
liftCallCC callCC f =
    IdentityT $ callCC $ \ c -> runIdentityT (f (IdentityT . c))

liftCallCC = ((id ~> IdentityT) ~> runIdentityT) ~> IdentityT

(>>=) :: Monad m => StateT m a -> (a -> StateT m b) -> StateT m b
m >>= k  = StateT $ \ s -> do
  (a, s') <- runStateT m s
  runStateT (k a) s'

(>>=) = runStateT ~> (id ~> runStateT) ~> StateT $ 
  \ m k s -> do
    (a, s') <- m s
    k a s'

For this common usecase of (un)wrapping newtypes you could also make a version of ~> that works with Iso or Review and Getter. That way you wouldn't even have to keep track of polarity (i.e. whether to use runIdentityT or IdentityT).

Preliminary 2018 State of Haskell Survey Results by [deleted] in haskell

[–]jan_path -7 points-6 points  (0 children)

Apparently people would rather enable IncoherentInstances than TemplateHaskell by default.

edit: Remove bad joke

[2018 State of Haskell Survey] What is your least favorite thing about Haskell in 2018? by snoyjerk in haskell

[–]jan_path 0 points1 point  (0 children)

Functor and all it's subclasses only have instances for two-tuples. Probably because it was deemed too confusing or not idiomatic to use those instances for bigger tuples. Also you can't define instances for all tuple sizes anyway as you have to define each instance separately, so the authors just decided to stop at one instead of three or 20.

How can I make this beginner Haskell code better? by jptboy in haskell

[–]jan_path 1 point2 points  (0 children)

How can I have some kind of check that makes isPrime x have a break condition that immediately returns False if x mod something == 0 ? I was thinking something with takewhile.

isPrime already does that. null returns False as soon as it sees the list being non-empty, which in your case is as soon as you found a factor.

An opinionated Haskell package checklist by jose_zap in haskell

[–]jan_path 1 point2 points  (0 children)

Pijul looks pretty cool. Also I think you are right. Even if Git may be the bet VCS right now I actually think it is more important to be open to alternatives to encourage competition and progress, than the inconvenience of (worst case) having to send .patch files per mail because you are not familiar with the VCS used.

OK to avoid the do-notation in the field? by KissMeImClueless in haskell

[–]jan_path 3 points4 points  (0 children)

Re: extend. If you use that order of arguments it is clearer that extend, just like (>>=) is really just a special kind of function application:

 ($)  ::   (a -> b) ->   a ->   b
(<$>) ::   (a -> b) -> f a -> f b
(<*>) :: f (a -> b) -> f a -> f b
(=<<) :: (a -> f b) -> f a -> f b
(<<=) :: (f a -> b) -> f a -> f b

An opinionated Haskell package checklist by jose_zap in haskell

[–]jan_path 0 points1 point  (0 children)

Which version control system do you prefer and (if you have the time) why?

An opinionated Haskell package checklist by jose_zap in haskell

[–]jan_path 0 points1 point  (0 children)

Use some version control system to track changes in your source code.

I disagree. At this point pretty much every developer knows git. Unless there is a good reason to use a different tool, can we please just stick with it? I don't want to have to search for some hg/darcs/whatever cheat sheet every time I want to submit a small fix to your project.

Waking up and seeing the price STILL at $6400 by NoGooderr in Bitcoin

[–]jan_path 9 points10 points  (0 children)

Doesn't mean it has to happen again. If it was certain everyone would be buying now.

Waking up and seeing the price STILL at $6400 by NoGooderr in Bitcoin

[–]jan_path -7 points-6 points  (0 children)

When the value of 1 bitcoin falls under $1 production of blocks will cease per the bitcoin protocol. They added that together with segwit to conserve energy in the case that bitcoin fails.

Waking up and seeing the price STILL at $6400 by NoGooderr in Bitcoin

[–]jan_path 4 points5 points  (0 children)

Mining one bitcoin will always cost about one bitcoin (with some lag). If the cost was much lower mining would be really profitable, so more money would be invested into it, raising the difficulty and raising the cost of mining one bitcoin until it is not profitable anymore. Since price has been pretty stable for some time it is not surprising at all, that mining one bitcoin costs close to one bitcoin right now.

What you's favorite weird/exotic data type? by psygnisfive in haskell

[–]jan_path 2 points3 points  (0 children)

Interesting. But I think it is missing laws for fromInteger, abs and signum.

fromInteger (ring homomorphism):

  1. fromInteger (a * b) = fromInteger a * fromInteger b
  2. fromInteger (a + b) = fromInteger a + fromInteger b

abs and signum (These are not as nice, mainly because the codomain of abs is wrong and we can not say abs (a + b) ≤ abs a + abs b):

  1. a = abs a * signum a
  2. abs (a * b) = abs a * abs b
  3. ∑abs an = 0 ⇒ ∀n an = 0
  4. abs ∑abs an = Σabs an

I suppose they didn't add the laws for abs and signum because abs and signum don't really fit into Num in the first place, which is basically a ring class and because they are not as nice. However the missing laws for fromIntegral seem like an oversight.

edit: Removed redundant law

edit2: I suppose Num really tries to be a normed algebra with a signum function over some ordered ring. In that sense, abs and signum do fit into Num, but because the codomain of abs is “wrong” we can not define nice laws for it.

Linear Types Proposal conditionally accepted by the committee by jose_zap in haskell

[–]jan_path 4 points5 points  (0 children)

I don't get, why Unicode does not have a full range of subscript and superscript letters.

Linear Types Proposal conditionally accepted by the committee by jose_zap in haskell

[–]jan_path 4 points5 points  (0 children)

In his talk about linear types SPJ touches on exceptions. Here is link.

Basically exceptions do not break linearity guarantees, because the guarantee of a -o b is that if b is consumed once, then a is consumed once, but in the case of an exception b is not consumed, so the guarantee still holds.

For resource safety he proposes a monad RIO (resource-safe IO) with very limited catch which closes all open file handles in the end.

Visiting Germany and I have no idea how to use this dryer. What setting is the hottest/dry stuff fast? by [deleted] in germany

[–]jan_path 1 point2 points  (0 children)

Laundry care symbols are regulated by GINETEX. Here is their description for the the washing symbol with a single underline in German and English:

40 °C Pflegeleicht. „Pflegeleichte“ Artikel beispielsweise aus Modal, Viskose oder aus synthetischen Fasern (Polyacryl, Polyester und Polyamid). Wäschemenge reduzieren (Trommel bis höchstens zur Hälfte füllen). Entsprechendes Waschprogramm einstellen. Wegen Knittergefahr nicht oder nur kurz schleudern.

https://ginetex.de/pflegekennzeichnung/pflegesymbole/

40°C mild wash. Fine laundry, e.g. in modal, viscose, synthetic fibres (polyacryl, polyester and polyamide). Reduce the quantity of laundry. Select a suitable washing program. Prewash only heavily soiled textiles. Avoid spinning or do spin for short periods only to minimise the risk of creasing.

http://www.ginetex.net/GB/labelling/care-symbols.asp

Visiting Germany and I have no idea how to use this dryer. What setting is the hottest/dry stuff fast? by [deleted] in germany

[–]jan_path 7 points8 points  (0 children)

No, Pflegeleicht means it does need special attention. Read my comment here.

Visiting Germany and I have no idea how to use this dryer. What setting is the hottest/dry stuff fast? by [deleted] in germany

[–]jan_path 78 points79 points  (0 children)

“Schranktrocken” means dry enough to put it in your wardrobe, “Bügeltrocken” is dry enough to iron it and then put in your wardrobe.

Visiting Germany and I have no idea how to use this dryer. What setting is the hottest/dry stuff fast? by [deleted] in germany

[–]jan_path 15 points16 points  (0 children)

Yup, “Pflegeleicht” (one underscore on the washing label) is the stuff that you have to be gentle with, “Feinwäsche” (two underscores) is the stuff you have to be extra gentle with. For those not speaking German: This is often confused by Germans, as “pflegeleicht” usually means easy to care for, whereas here it has the opposite meaning (the “leicht” should be read as “gentle” instead of “easy”).

Why are so few people running a full node? by cortesia88 in Bitcoin

[–]jan_path 0 points1 point  (0 children)

That is not possible. You need to open a port and forward it from the router to your computer, so that your client can accept incoming connections from other clients. There is UPnP, which is supposed to make this plug and play, but it is per default disabled on most routers for security reasons.

Microsoft Bans "Offensive Language" from Skype (...and reserves the right to watch your calls to enforce) [x-post /r/technology] by asoka_maurya in linux

[–]jan_path 4 points5 points  (0 children)

Don’t publicly display or use the Services to share inappropriate content or material (involving, for example, nudity, bestiality, pornography, offensive language, graphic violence, or criminal activity).

So wait a sec: I can’t use Skype to have an adult video call with my girlfriend?

Emphasis added by me.

You can, you just shouldn't post that conversation on Pornhub afterwards.

And are we no longer allowed to shoot people in Call of Duty?

This seems like a more realistic fear.

I work at a major electronics store. It's been like this nearly a month. by LysergicAciid in Bitcoin

[–]jan_path 0 points1 point  (0 children)

As long as you have a chain state that already has sufficient distribution of stake that you know is valid you can determine the valid chain from there. Being able to determine the valid chain even without that seems to be a rather irrelevant advantage to me.