Filter
Exclude
Time range
-
Near
Replying to @analytichegel
Using Haskell is pretty retro now 😎 yeah I craft my dependent types out of TypeRep, yes I use double colon :: it has character (a single additional one to be precise).
1
3
77
A pattern match on Type (or TypeRep) can never be exhaustive, so if that's what your intution is related to, then I agree. However, the benefit of matching on types is not to match on values of type Type but rather on values of some closed type T which is a data kind.
1
3
96
TypeRep
7 Feb 2024
types are not real btw
4
607
1 Dec 2023
When constructing a generic ADT (like "stack of X") they pass the type argument for X to the constructor just like any other argument. Then checks for push, e.g., are done using dynamic typerep checks.
1
36
Replying to @welltypedwitch
Instead of Map Fingerprint Any, you can use a safe DMap TypeRep Identity. For performance, you might consider type-indexed fingerprints instead of TypeRep there.
1
2
A brief reminder for package authors: If you provide Generic instances remember to add an instance to Generically and Generically1 once they get added to GHC.Generics in base 4.17 Generically: github.com/ghc/ghc/blob/mast… pattern TypeRep: gitlab.haskell.org/ghc/ghc/-…
3
3
14
27 Aug 2021
Me sugeriram usar Map Char (Either Int Bool) ai eu poderia ter ints e booleans, mas eu quero poder ter qualquer quantidade de tipos, aí a segunda sugestão foi usar TypeRep, pelo que entendi esse cara leva uma representação do tipo pro runtime, onde eu posso usar
3
2
Cute pattern that allows you to check the kind of a TypeRep SomeKind (f ::: Fun k1 k2) <- check SomeKind (a ::: k1') <- case eqTypeRep k1 k2 of ..
5
#PatternSynonyms: Is there a way to define a pattern that when given a type application only matches a TypeRep of that type? f :: TypeRep a -> a f (Is @​Int) = 10 f (Is @[] `App` Is @​Int) = [1,2,3,4]
1
1
Replying to @maksbotan @_gilmi
I am team #PatternGuards for this reason, minimal indentation, branching, let declaration, pattern matching that can introduce local constraints foo :: forall a. Typeable a => a foo | App f _ <- TypeRep @a , Just HRefl <- eqTypeRep (TypeRep @[]) f = []
1
2
12 Apr 2021
Replying to @Iceland_jack
If you dig into Data.Typeable.Internal, the TrApp constructor lets you recover the typed TypeReps for each argument from the TypeRep of the applied form. You can access it today (evilly) via template-haskell tricks or by browbeating ghc hq into putting it in an exported module.
2
1
github.com/ENvironmentSet/ts… API 문서 TS internal API를 이용한 monkey patch를 official API로 대체 타입을 값으로 변환해 주는 primitive operation `typeRep`을 추가해 주는 타입스크립트 확장입니다. 이 확장을 사용하시면 다른 확장들에서 제공하는 기능들을 타입스크립트로 구현할 수 있어요
1
3
12
TypeRepからTypeQに変換するの鬼のように面倒くさいな...😰
2
24 Feb 2021
i seem to have gotten ghc to hang while exhaustiveness-checking some pattern guards that analyze a TypeRep
1
7
17 Sep 2020
it's not quite reflection, but i'm quite pleased with how roboservant turned out that way - it uses the typed structure of a servant API, but uses it as data. The internal data structure's just `Map TypeRep Dynamic`.
3
8 Aug 2020
Learned about typerep-map in @chrislpenner ‘s stream. A map with types as keys. Very interesting! hackage.haskell.org/package/… by @kowainik #Haskell

Hey folks! Decided randomly to design a #React Hooks style #TUI in #Haskell on stream today! I've done minimal prep and planning, so we'll discover how it works together (or maybe we won't) :) Come hang out at 10pm UTC (i.e. 4 hrs from now) youtube.com/watch?v=xiBSb0A_…
1
3
6
ではこのとき、fooVal :: TypeRep n → Foo n 1 なる関数を書くことを考える。Data.Type.Equality の testEquality :: TypeRep a → TypeRep b → Maybe (a :〜: b) を使って、 fooVal r = case testEquality r (typeRep @1) of Just Refl → 12 :: Int; Nothing → False と書くとうまくいかない
1
2
5
Heterogeneous structure with logarithmic lookup? Pff. How about a cache-optimized logarithmic binary search in a heterogeneous container? Check out the `typerep-map` #Haskell library by @vronnie911 for the fastest implementation of the Dependent Types map! github.com/kowainik/typerep-…
HLists too slow? @wouterswierstra shows how to implement a heterogeneous datastructure with logarithmic lookup in this Functional Pearl: cambridge.org/core/journals/…
2
10
16 Mar 2020
> :set -XTypeApplications > import Type.Reflection > show $ typeRep @Int "Int"
1
16 Mar 2020
also ideally we'd have a function that takes a *type* as an argument, which we can have now thanks to TypeApplications and ScopedTypeVariables. getTypeRep :: forall a. Typeable a => TypeRep getTypeRep = typeRep (Proxy @a)
1