Skip to main content
Filter by
Sorted by
Tagged with
3 votes
2 answers
124 views

Since closed type families have all their clauses appearing together and therefore can't be extended with other clauses, and since GHC can detect violations of injectivity annotations anyway (even for ...
Enlico's user avatar
  • 30.8k
Advice
1 vote
16 replies
284 views

We're avid Perl programmers but we have been really wanting to get into Haskell or Erlang or something similar, though we don't know where to start. Any languages you guys recommend? if so, send some ...
tungstengmd's user avatar
1 vote
1 answer
95 views

My question comes for the fact that I don't fully understand the nuances of declaring datatypes. I think I get lost in all the degrees of freedom out there: do I use GADT syntax or not? Do I spell out ...
Enlico's user avatar
  • 30.8k
3 votes
1 answer
107 views

Section §13.2 from Haskell in Depth is about "faking" dependent types in Haskell via singletons. Below is one snippet of code from that section: doorState :: forall s. Door s -> DoorState ...
Enlico's user avatar
  • 30.8k
Best practices
0 votes
18 replies
169 views

Typically typeful programming uses Proxy to signal to the reader this is used for its type, not its value. Indeed there might not be any usable value/it's typically undefined. Here's a previous q ...
AntC's user avatar
  • 2,846
2 votes
1 answer
122 views

I have the following function which splits a list in half: halve :: [a] -> ([a], [a]) halve xs = go xs xs where go (x : xs) (_ : _ : ys) = mapFst (x :) $ go xs ys go xs _ = (...
Wheat Wizard's user avatar
  • 4,268
-2 votes
1 answer
145 views

My wordle solver seems to be slow, i would like to ask your opinions on how i can speed it up further I did some optimizations i could think of, but speed still seems to be bad As far as i understand, ...
kavasak's user avatar
  • 29
4 votes
0 answers
200 views

This "warning sign" character, ⚠️, corresponds to the sequence of codepoints U+26A0 U+FE0F (if I understand correctly, it is ⚠ followed by a variation selector character), so I can render it ...
Enlico's user avatar
  • 30.8k
2 votes
2 answers
140 views

Say I define this datatype in my library data Foo = Foo (String, String, String, String) and that I expose a bunch of things do use it, but that the client really only needs to construct a Foo and ...
Enlico's user avatar
  • 30.8k
Best practices
0 votes
7 replies
93 views

Assuming a length-indexed list/GADT as per this recent Q: {-# LANGUAGE GADTs, DataKinds, KindSignatures #-} data Vec a (n :: Nat) where Nil :: Vec a Zero Cons :: a -> Vec a n -> Vec a (...
AntC's user avatar
  • 2,846
2 votes
1 answer
105 views

I used ghcup to install the Haskell build tool "stack". When setting up ghcup, it gives you an option to configure stack to use ghcup to manage ghc versions, this is handy because it makes ...
Joe's user avatar
  • 1,679
5 votes
0 answers
159 views

tl;dr (hopefully) While writing the question below, I think I've come up with a simpler way to ask it. Assume this senario: you've never seen Maybe in Haskell before, so you don't know it's ...
Enlico's user avatar
  • 30.8k
6 votes
1 answer
175 views

tl;dr Is it always possible to desugar a GADT data type into an "ordinary" data type? (Similar question from 2018, but the ansewer (same age) doesn't address the general case, and the ...
Enlico's user avatar
  • 30.8k
3 votes
3 answers
170 views

I have manually defined the following Haskell functions: --disregardNextZero x = x disregardNextZero = id --disregardNextOne _ x = x disregardNextOne = const id --disregardNextTwo _ _ x = x ...
Antonielly's user avatar
4 votes
3 answers
191 views

This question springs from another earlier question of mine: How can a type with all constructors having a field mapped to Void via a type family have any values at all?, because one implication of ...
Enlico's user avatar
  • 30.8k

15 30 50 per page
1
2 3 4 5
3456