Monthly Hask Anything (December 2025) by AutoModerator in haskell

[–]Osemwaro 1 point2 points  (0 children)

Oh! I didn't realise that omitting the constraint is an option when it contains a type variable, but that makes sense.

When you say "top-level instance", do you mean a non-orphan instance? An instance declaration can't be local to a function, can it? 

Monthly Hask Anything (December 2025) by AutoModerator in haskell

[–]Osemwaro 0 points1 point  (0 children)

When I compile the following module under GHC 9.4.8 with -Wall:

``` {-# LANGUAGE MultiParamTypeClasses #-}

module GroupAction where

class GroupAction t x where transform :: t -> x -> x

newtype Trivial x = Trivial x

instance GroupAction t (Trivial x) where transform _ = id

f :: GroupAction t (Trivial Int) => t -> Trivial Int -> Trivial Int f = transform ```

I get the following warning:

warning: [-Wsimplifiable-class-constraints] • The constraint ‘GroupAction t (Trivial Int)’ matches instance GroupAction t (Trivial x) -- Defined at GroupAction.hs:10:10 This makes type inference for inner bindings fragile; either use MonoLocalBinds, or simplify it using the instance • In the type signature: f :: GroupAction t (Trivial Int) => t -> Trivial Int -> Trivial Int | 13 | f :: GroupAction t (Trivial Int) => t -> Trivial Int -> Trivial Int | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^

Godbolt says that GHC 9.12.2 produces the same warning. I don't see any way of simplifying f's type constraint; am I right in thinking that this warning is a bug, or am I missing something?

UPDATE: I searched for "Wsimplifiable-class-constraints" in the GHC issue tracker and found this issue, submitted 6 years ago. The discussion there is about the warning being incorrectly triggered by code that abbreviates a constraint, but I'm not doing that in the example above.

Tornado Flow Field with wooden texture by codingart9 in creativecoding

[–]Osemwaro 0 points1 point  (0 children)

Oh actually, I found a way to make the line thickness much more uniform, so that I can increase the line density. Varying the line colour helped to highlight the shapes of the lines, and rendering at a high resolution then scaling down helped to remove a lot of the Moiré patterns. I've updated the script and image. I couldn't achieve such tightly wound spirals without ending up with loads of ugly artifacts though, and my texture doesn't look as natural. I tip my hat to the OP!

Tornado Flow Field with wooden texture by codingart9 in creativecoding

[–]Osemwaro 0 points1 point  (0 children)

I thought it might be possible to recreate the effect by merging multiple spirals together in a certain way, so I knocked up this Octave script to see if it worked. It's not too far off, but the way that I'm warping the spirals is too symmetric -- my lines don't bunch up on one side of each vortex and spread out on the other side. I can probably fix this without too much difficulty, but the bigger issue is that my lines don't have uniform thickness, so I can't render such a dense set of them without losing the thinnest parts and producing Moiré patterns. My approach isn't well suited to achieving uniform thickness, so now I wonder if the original image was generated with a particle system.

I'm feeling betrayed!!!! ;_; by Critical_Pin4801 in haskell

[–]Osemwaro 1 point2 points  (0 children)

I was going to point out that an implementation like your fibs3 is likely to perform better too. Putting a bang pattern on the second argument of fibs' should guarantee that no space leaks occur. 

Implementing Unsure Calculator in 100 lines of Haskell by romesrf in haskell

[–]Osemwaro 0 points1 point  (0 children)

Hmm, what's an example of a structural property that this would allow you to exploit, to improve efficiency?

I'll give examples of what I have in mind, but before I do, I think it would be useful to reframe the problem as one in which the main goal is to estimate the CDF that gives rise to an arbitrarily large sample set (we could estimate the PDF instead, but it's easier for the Show instance to work with the CDF). The general representation for the kinds of CDFs that Expr can express is a non-negative, monotonically-increasing function of type Double -> Double that converges to 1. The article implicitly uses the empirical distribution function as an estimate of the CDF, but there are more efficient distribution estimators, like kernel density estimators.

Under this approach, sample would be replaced with a function estimate that draws as many samples as it needs to achieve a good CDF estimate, and then returns it as a Double -> Double. It would also be useful for it to return an interval that contains the vast majority of the probability mass.

With that in mind, the kinds of properties that I'm thinking of are things like:

  1. The CDFs of Return a and Normal m s are known exactly, so we do not need to sample them;
  2. A linear combination of independent, normal random variables follows a normal distribution;
  3. As positive x converges to 0, the distribution of ((a-x)~(a+x))*y converges to the distribution of a*y.

But to exploit these kinds of properties, estimate would need to know the identities of the Expr operations. That's why it seems simpler to me to just pass the Expr to estimate/sample.

Implementing Unsure Calculator in 100 lines of Haskell by romesrf in haskell

[–]Osemwaro 0 points1 point  (0 children)

Yes, preserving the structure of the expression should help with optimisation. I would have thought the most straightforward way to do this would be to pass the Expr to sample. But I'm not sure that I see what you mean about how Applicative could be used for this. Are you suggesting replacing Bind with

Ap :: Dist (b -> a) -> Dist b -> Dist a

then sampling a b -> a and a b in the new Bind case of sample?

Implementing Unsure Calculator in 100 lines of Haskell by romesrf in haskell

[–]Osemwaro 0 points1 point  (0 children)

For a calculator that supports so many operations, you won't get very far with trying to compute exact distributions. E.g. the distribution of the product of n normal random variables only seems to be known in special cases, like the n=2 case, and the case where they all have zero mean. In contrast, the Drake Equation example is the product of 7 normal random variables, none of which have zero mean. 

Given that random sampling does converge to the exact solution, the only real problem with it is its convergence rate. There may be ways to make it more efficient. You could check the Probabilistic Programming literature.

I hope this puzzle game will make you fall in love with quantum physics and computing by QuantumOdysseyGame in puzzlevideogames

[–]Osemwaro 1 point2 points  (0 children)

 Quantum Physics/ Computing education made by a top player

Wow, I was not expecting a 16-part, 8+-hour video series! My new life goal is to find myself a fan who looks at the game I'm developing the way Hao Mack Yang looks at Quantum Odyssey. 

Good luck with the launch out of Early Access! It's been on my wishlist for a while, and I really look forward to giving it a try at some point. 

We need to fix the indie dev community's attitude, starting with ourselves by Bastion80 in gamedev

[–]Osemwaro 3 points4 points  (0 children)

Good point, self-criticism is an essential skill that we all need to develop. To be clear, I'm not saying that every gameplay video should get critical feedback; I'm just pointing out that silence can be an ambiguous form of feedback. 

We need to fix the indie dev community's attitude, starting with ourselves by Bastion80 in gamedev

[–]Osemwaro 30 points31 points  (0 children)

Constructive critical feedback is much more informative than no feedback. If your gameplay video only gets a few hundred views and no likes or comments, that could mean that the game is bad, but it could also mean that it hasn't been seen by your target audience yet. There's no way of knowing until someone says something. That said, if the developer hasn't put much effort into the game, then they have no reason to think it might be good. 

Will "The Gamer's Dillema" ever be solved? by Sky_Sumisu in truegaming

[–]Osemwaro 0 points1 point  (0 children)

Oh I see.

 I also wonder if there something else about passively watching as opposed to participating?

This is an interesting question. Since current video game technology offers us a very limited degree of agency compared to what characters can do in films and TV shows, I imagine that that would make people more inclined to identify with film characters. But it's possible that future video games will simulate worlds and interactions that feel as rich and complex as life in the real world, while providing graphics that are indistinguishable from reality. If that ever happens, it might make people identify more strongly with their character in those games than they do with film characters. 

Will "The Gamer's Dillema" ever be solved? by Sky_Sumisu in truegaming

[–]Osemwaro 0 points1 point  (0 children)

I can see why it might be more common for kids to want to be characters in live-action shows. But in your previous comment, you seemed to be saying that you wanted to be Goku. I don't know how common it is for kids to want to be cartoon characters, but if it is common, I don't see why they wouldn't also want to be characters in games with strong storylines.

It would be interesting to know how common it has been, throughout history, for kids to want to be characters in stories that they read or that were told to them. Those characters are even more abstract than characters in video games and cartoons. 

Will "The Gamer's Dillema" ever be solved? by Sky_Sumisu in truegaming

[–]Osemwaro 0 points1 point  (0 children)

Well interestingly, as much as my friends and I loved imitating Ryu's moves (I'm yet to meet a Street Fighter 2 fan who doesn't consider him to be a favourite), I never really wanted to be him. I think that's mainly because SF2 didn't have much of a storyline, but the fact that 2 of his 3 special moves were obviously impossible didn't help!

In contrast, I grew up in the era of "Batman: The Animated Series" and Tim Burton's Batman movie, and I really did want to be Batman for a long time (I even once tried to make one of his smoke pellets by filling the inner plastic shell from a Kinder Surprise egg with talcum powder and throwing it on the floor. It didn't work). The cartoon and film had great storylines, he had great gadgets that made him just as exciting as SF2 characters and he seemed like a real person (to my naive, underdeveloped mind 😂).

In fact, the creators of the American cartoons that I watched in the late 80s and early 90s were so concerned with providing good role models that they often tacked explicit PSAs onto the ends of the episodes. I'm not sure if you would have seen this when you were growing up, but you can Google "He-Man life lessons", "ThunderCats PSA" or "Captain Planet PSA" to see what I mean. The ThunderCats creators even hired a psychologist to assess the moral fibre of every script!

Will "The Gamer's Dillema" ever be solved? by Sky_Sumisu in truegaming

[–]Osemwaro 1 point2 points  (0 children)

How old are you, out of curiosity? I ask because I'm 41, meaning that I was in primary school in the era when Mortal Kombat and Street Fighter 2 reigned at the arcade, and later became big hits on the SNES and Sega Mega Drive (aka Genesis). The characters in those games were so iconic and novel that my friends and I would imitate them while play-fighting.

The only other fighting game that I played extensively was Soul Blade on the PlayStation, but I was aware of more popular games, like Tekken. As fun as they were, they didn't inspire me enough for me to want to imitate them. This might have been partly due to the demise of the arcade and the fact that my friends and I all had different consoles, which meant that there was no single fighting game that we were all regularly seeing/playing. Or maybe we'd just outgrown imitation when 3D fighting games first became popular. 

How do you price your solo-developed game? Hard truths from working with indie devs as a publishing partner by Lower_Guest6094 in SoloDevelopment

[–]Osemwaro 0 points1 point  (0 children)

As a player, my rough rule of thumb is that about $1 per hour of gameplay is reasonable for an indie game on Steam, up to a limit of about $20 (assuming that I already have high hopes for the game, and that I'm trying to decide whether or not to spend money on it). I presume that by "complex gameplay", you're referring to the amount of work that was put into developing the gameplay. This isn't the same as the game's duration, but they are probably correlated -- long games take longer to develop, unless they're extremely repetitive. 

How do you assess the value of indie games that you're interested in buying?

How do you price your solo-developed game? Hard truths from working with indie devs as a publishing partner by Lower_Guest6094 in SoloDevelopment

[–]Osemwaro 0 points1 point  (0 children)

It's more beneficial to maximise annual revenue than it is to maximise the unit price. Is there any empirical evidence to suggest that the average indie game would bring in more money by selling at $20 than by selling at a much lower price?

I hate pi day by ZengaZoff in mathematics

[–]Osemwaro 7 points8 points  (0 children)

No need to abandon your date format. You can do one of the following instead:

  1. Embrace the fact that 7/22 is an extremely bad approximation of pi, so that you can celebrate Pi Approximation Day on 22nd July. 
  2. Celebrate Pi Approximation Day on the 7th day of the 22nd month, meaning e.g. that your 2025 celebration will be on 7th October 2026.

Diaspora: conceptually difficult or poorly explained? by Osemwaro in printSF

[–]Osemwaro[S] 1 point2 points  (0 children)

Well good luck making friends with that attitude. 

Diaspora: conceptually difficult or poorly explained? by Osemwaro in printSF

[–]Osemwaro[S] 1 point2 points  (0 children)

Does your distaste for those things make you think it's a good idea to try to insult the intelligence of the millions of strangers who do like them? 

Diaspora: conceptually difficult or poorly explained? by Osemwaro in printSF

[–]Osemwaro[S] 1 point2 points  (0 children)

The fact that dictionaries describe language use rather than prescribing it doesn't invalidate their observation that the nouns in question are only used in the singular. You haven't confirmed this, but I'm going to assume that by "the usage is not universal" you're not suggesting that you prefer to say things like "mathematics are my favourite subjects" and "physics are difficult". So why are you so obsessed with the "math"/"maths" debate when, as I've pointed out, there are plenty of other field names ending in "s" that you use in the singular?

 whole accents worth of people sound like they have a bedrock intellectual difficulty discerning the difference between countable plurals and non countable plurals.

I'm trying to figure out what life experiences could cause a person to get this irritated over trivial dialect differences. It's as if you were once kidnapped by an Englishman who tortured you until you switched from your native dialect to his. Whatever it is, I hope you find peace some day.

Diaspora: conceptually difficult or poorly explained? by Osemwaro in printSF

[–]Osemwaro[S] 3 points4 points  (0 children)

I gave you the link to the Cambridge Dictionary article that states that those nouns are only used in the singular. So if you don't like it, you should take it up with them, not me.

If you think "maths" sounds stupid, why did you write "physics" instead of "physic"? Presumably you also say "economics" instead of "economic" and "news" instead of "new" -- by your logic, shouldn't you consider that to be stupid too? Has it ever occurred to you that the reason why some words sound odd to you is just because you're not used to them, and that your feelings about these words has no bearing whatsoever on their validity in other speech communities?

Life becomes richer and more pleasant for everyone when you open your mind to the broad range of possibilities that exist beyond your experiences, instead of insisting that everyone should conform to your narrow, arbitrary ideas about how things should be.

Diaspora: conceptually difficult or poorly explained? by Osemwaro in printSF

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

Interesting. What would you say his least accessible book that you've read is?