python (65.1k questions)
javascript (44.2k questions)
reactjs (22.7k questions)
java (20.8k questions)
c# (17.4k questions)
html (16.3k questions)
r (13.7k questions)
android (12.9k questions)
Is it possible to have elements of a heterogeneous list depend on the type of preceding elements?
Context
I want to model the routes of a web application such that it satisfies the following requirements:
Can enforce complete definitions
Can create incomplete definitions
Can check if an incomplet...
glennsl
Votes: 0
Answers: 1
How to define a function that uses a list which product of numbers is the same as the amount of element in matrix in Haskell using GADTs?
I have a matrix representation of
data ListN (dim :: Nat) a where
Nil :: ListN Zero a
Cons :: a -> ListN n a -> ListN (Succ n) a
infixr 5 `Cons`
data Tensor (dims :: [Nat]) a where
...
Joes de Jonge
Votes: 0
Answers: 1
Haskell data type definition depended on GADTs and function output
I would like to have a tensor data structure
data Nat where
Zero :: Nat
Succ :: Nat -> Nat
-- | A list of type a and of length n
data ListN a (dim :: Nat) where
Nil :: ListN a Zero
...
Joes de Jonge
Votes: 0
Answers: 1
type level constraint encoding
So I have a data constructor that I only use at the type level which contains a Nat. Normally if I pass this around at the type level and I want to reflect the Nat to the term level I need a KnownNat ...
CryptoNoob
Votes: 0
Answers: 1