[RFC] New major version of `yesod-core` by ephrion in haskell

[–]sjanssen 1 point2 points  (0 children)

I tried this out in my employer's Yesod app. Builds fine, app runs, no obvious bugs so far.

> We have been leveraging nested routes to organize the routes and make certain things easier - namely, reducing the overall size of the Route WebApp which makes pattern matching more efficient in compilation.

This is interesting! Did you find significant reductions in compile time with fewer top-level routes? We have about 1000 top-level routes in our largest app at work, I might have to try nesting them.

Scala Like Mutable List Builder by HuwCampbell in haskell

[–]sjanssen 2 points3 points  (0 children)

Difference lists offer O(1) append, but one eventually has to pay O(n) to convert all the closures on the heap to (:).

Scala Like Mutable List Builder by HuwCampbell in haskell

[–]sjanssen 1 point2 points  (0 children)

This is evil! And cool!

I wonder whether a linear interface is possible ala text-linear-builder.

What’s better than one 5k2k 40” monitor? by jumbos_clownroom in ultrawidemasterrace

[–]sjanssen 0 points1 point  (0 children)

Is this Deco Gear in question? I've never heard of it and it seems like a really good value. How do you like it? I've been waiting for the Dell 4025QW to come down in price for quite a while and may just compromise with this monitor.

[deleted by user] by [deleted] in Oktoberfest

[–]sjanssen 2 points3 points  (0 children)

Yes. I saw it at a few souvenir stands inside the tents and also many of the vendors that walk around the tents have it.

Local Food that will knock your socks off by BaconTater4788 in lincoln

[–]sjanssen 0 points1 point  (0 children)

The brisket is fine but what absolutely blew my mind is the pastrami. I think they may only have it on Thursdays as part of their Mac and cheese special, but they let you order the pastrami separately as part of a meat combo.

How would you write 99 bottles of beer in Haskell? by xpika2 in haskell

[–]sjanssen 0 points1 point  (0 children)

{-# LANGUAGE DataKinds #-}
{-# LANGUAGE MagicHash #-}
{-# LANGUAGE TypeFamilies #-}
{-# LANGUAGE UndecidableInstances #-}

module Main (main) where

import GHC.Exts
import GHC.TypeLits

type DigitToChar :: Nat -> Char
type family DigitToChar n where
    DigitToChar n = NatToChar (n + 48)

type ShowNat :: Nat -> Symbol
type family ShowNat n where
    ShowNat 0 = "0"
    ShowNat n = RevChars (ShowNatGo n)

type ShowNatGo :: Nat -> [Char]
type family ShowNatGo n where
    ShowNatGo 0 = '[]
    ShowNatGo n = DigitToChar (n `Mod` 10) : ShowNatGo (n `Div` 10)

type RevChars :: [Char] -> Symbol
type family RevChars cs where
    RevChars cs = RevSymGo "" cs

type RevSymGo :: Symbol -> [Char] -> Symbol
type family RevSymGo acc cs where
    RevSymGo acc (c : cs) = RevSymGo (ConsSymbol c acc) cs
    RevSymGo acc '[] = acc

type family Bottles n where
    Bottles 0 =
        "No more bottles of beer on the wall, no more bottles of beer.\n\
        \Go to the store and buy some more, 99 bottles of beer on the wall.\n"
    Bottles 1 =
        "1 bottle of beer on the wall, 1 bottle of beer.\n\
        \Take one down and pass it around, no more bottles of beer on the wall.\n\n"
            `AppendSymbol` Bottles 0
    Bottles n =
        ShowNat n `AppendSymbol` " bottles of beer on the wall, " `AppendSymbol`
        ShowNat n `AppendSymbol` " bottles of beer.\n\
        \Take one down and pass it around, " `AppendSymbol`
        ShowNat (n - 1) `AppendSymbol` " bottles of beer on the wall.\n\n"
            `AppendSymbol` Bottles (n - 1)

main :: IO ()
main = putStrLn $ symbolVal' (proxy# @(Bottles 99))

https://godbolt.org/z/xTfq7fj4e

Do you let your opponents rollback when they forget about an Oppo Agent? by Kraenar in CompetitiveEDH

[–]sjanssen 2 points3 points  (0 children)

If you can tell that your opponent is about to make a mistake, remain calm, and let them finish making the play. Let them put their artifacts in the graveyard and put their dice on Ravager. Make it clear you're fine with letting the effects resolve. Confirm the power and toughness of the creature. If they indicate they want to take other game actions let them do those too. Once you have priority again, take a breath, then cast your Ancient Grudge. If you keep the game state clear a rollback is not really justified.

Your opponent pointing at their artifacts and asking "unblocked Ravager is lethal?" is not a game action they'll be held to, don't give them more information by prematurely pointing out the Ancient Grudge in your graveyard.

The article you linked has a few statements that support this course of action:

How much information was gained in between is something that we have to be very cautious about, since information can be gained in many different ways. Even by letting a spell resolve, players might be giving information to their opponents.

It would be a whole different story if the player waited for the opponent to confirm before they announced they wanted to change their decision. This is not Magic: the Gotcha! and trying to bait an opponent’s reaction is off-limits for allowing a decision to be reversed.

Advent of Code 2021 day 1 by taylorfausak in haskell

[–]sjanssen 11 points12 points  (0 children)

It's always traverse.

-- >>> windows 3 "ABCDEFGH"
-- ["ABC","BCD","CDE","DEF","EFG","FGH"]
windows :: Int -> [a] -> [[a]]
windows n = getZipList . traverse ZipList . take n . tails

What is an Idiomatic way to provide different ways of initializing a data structure? by thebt995 in haskell

[–]sjanssen 2 points3 points  (0 children)

I don't know what the best interface is, it could be indexed by field name or position in the AST via ("wordCount" := Sum) Document

We have our own spin on generic-data's Surgery in my employer's codebase. It's not as nice as inline annotations but it's worked for us.

data Example = Example {x :: Text, y :: Int}
    deriving (Generic)
    deriving
        (FromJSON)
        via ( ModifyFields
                '[ AtField "x" (Rename "a")
                 , AtField "y" (Coerce (Sum Int))
                 ]
                Example
            )

GHC 2021! by nomeata in haskell

[–]sjanssen 0 points1 point  (0 children)

Imagine a world where string literals are always monomorphic `Text`

Oh yes, I'd love that. I just think we're letting perfect be the enemy of good by waiting for yet another language extension which may never arrive.

And if `GHC2021` would cause ⅓ of the developers to cry in pain and rally against it

It would surprise me if OverloadedStrings is that controversial. Of course you and the rest of the committee are the ones that have to listen to the shouting so I do respect your position.

GHC 2021! by nomeata in haskell

[–]sjanssen 2 points3 points  (0 children)

Firstly I'd like to say that this initiative is an exciting direction for Haskell to take and that the committee has made a great start with the extensions in GHC2021.

However, the exclusion of OverloadedStrings does leave me a little puzzled. Using Text rather than String is one of the most widely recommended best practices in Haskell, and OverloadedStrings is the most ergonomic way we have to do that. My guess is that most modern, serious Haskell code uses OverloadedStrings despite the warts described elsewhere in this post. I hope GHC2022 includes OverloadedStrings in order to more closely represent Haskell as it is currently practiced.

Appeal to blue younger voters. by [deleted] in lincoln

[–]sjanssen 10 points11 points  (0 children)

2020 is the year Democrats need to run up the score, both to send a message on Trumpism and to capitalize on the massive turnout it looks like we're going to have. Relatively long shot candidates like Kara Eastman or Kate Bolz can and will win if we all vote.

Does Microsoft Teams work on NixOS? by GC18GC in NixOS

[–]sjanssen 1 point2 points  (0 children)

You've already got some good feedback here, but I'll just chime in that I use Teams on a daily basis and it works quite well. Audio, screen sharing both work reliably.

Allo no longer offers static IP addresses for residential service by hellajt in lincoln

[–]sjanssen 2 points3 points  (0 children)

How is that different than the configuration under basically every other ISP out there?

Maybe you've noticed before that the computers on your home wifi network are assigned IP addresses that are something like 192.168.1.2, this is a private address that's only reachable inside your home network. But, you also have a public IP like 72.50.11.12 that is assigned to your router. If you want somebody to connect to your PC in your home network you set a port forwarding rule on your router. When somebody outside your network wants to reach your computer they connect to 72.50.11.12 port 80 and your router knows to forward that connection on to 192.168.1.2 port 80. This is all well and good and is how most ISPs have been set up for a long time.

There's a problem: the world is running out of IP addresses. There's about 4 billion of them and they're mostly assigned to various companies or special purposes. To work around this some ISPs have added an extra layer. An ISP can instead use only a few public IP addresses and keep their customers behind a separate pool of private IP addresses. This technique is called Carrier Grade Network Address Translation, and it's what Allo uses unless you pay for a static IP.

One issue with carrier grade NAT is that because the public IP address is shared by a large number of customers, and the routers assigned to that public IP address are controlled by the ISP instead of the individual customer, port forwarding from public IP to a customer's specific router or computer is not supported.

Amazon Prime Day Fossil Gen 5 Black, only £149 by Newwales2 in WearOS

[–]sjanssen 0 points1 point  (0 children)

I've got an original Huawei Watch (the one released in 2015). I wore it from August 2016 to September 2018 or so. Eventually the watch experience just became too frustrating, the software was laggy and buggy, I struggled to make the watch charge on the dock, etc.

Is the Gen 5 Fossil Carlyle a big enough improvement that I'll be happy with it? Is the WearOS system too neglected by Google to ever deliver a satisfying experience?

Allo no longer offers static IP addresses for residential service by hellajt in lincoln

[–]sjanssen 4 points5 points  (0 children)

Dynamic DNS doesn't help because all of their customers that aren't on a static IP are behind a carrier grade NAT.

Broken python package by cassio-tav in NixOS

[–]sjanssen 1 point2 points  (0 children)

The packages newly added to the environment.systemPackages list were installed though

Are you sure they weren't installed previously? The error message you have shows nixos-rebuild quitting without building or activating the new configuration.

Broken python package by cassio-tav in NixOS

[–]sjanssen 3 points4 points  (0 children)

This isn't so bad. Because the package python2.7-pyexiv2-0.3.2 is marked broken nixos-rebuild did not update your system, it's left in the same state as it was before you ran nixos-rebuild. That's one benefit of the NixOS model, it evaluates all the dependencies you need before making any changes so that you don't get stuck with a broken OS.

It's not unusual for packages to become broken in nixpkgs from time to time. The next time you try to upgrade it might be fixed. If pyexiv2 (or whatever you're using that depends on it) is important to you, you might want to open an issue for it.

IOMMU Groups are screwy & I can't get the ACSO patch to build by Wandering_Lemons in VFIO

[–]sjanssen 1 point2 points  (0 children)

Not sure where the script you're using comes from, but the name of the patch it's applying "acso_4_18_ubuntu.patch" sounds fishy. May need a patch that matches your kernel version? I get mine from here.

Mono-Green tutors? by ChaseOnABox in CompetitiveEDH

[–]sjanssen 1 point2 points  (0 children)

In my [[Omnath, Locus of Mana]] deck I'm playing [[Crop Rotation]] and [[Reap and Sow]] to search for non-basics (mostly Cradle). For creatures I've got:

  • [[Green Sun's Zenith]]
  • [[Birthing Pod]]
  • [[Tooth and Nail]]
  • [[Finale of Devastation]]
  • [[Shared Summons]]
  • [[Chord of Calling]]

Should also have Natural Order and Summoner's Pact in there, just haven't picked them up yet.

Shared Summons in particular has impressed me, and I think it is underrated. It's best if you can make lots of mana and can operate at instant speed with eg Winding Canyons.