From 98faf732052c24766b0abfc38ce6b7178c226a61 Mon Sep 17 00:00:00 2001 From: stuebinm Date: Sun, 2 Jan 2022 01:55:17 +0100 Subject: playing around with types --- lib/KindLinter.hs | 29 +++++++++++++++++++++++++++++ stack.yaml | 1 + stack.yaml.lock | 7 +++++++ walint.cabal | 4 +++- 4 files changed, 40 insertions(+), 1 deletion(-) create mode 100644 lib/KindLinter.hs diff --git a/lib/KindLinter.hs b/lib/KindLinter.hs new file mode 100644 index 0000000..4ecf067 --- /dev/null +++ b/lib/KindLinter.hs @@ -0,0 +1,29 @@ +{-# LANGUAGE DataKinds #-} +{-# LANGUAGE RankNTypes #-} +{-# LANGUAGE PolyKinds #-} +{-# LANGUAGE ConstraintKinds #-} +{-# LANGUAGE TypeApplications #-} + +module KindLinter where + +import Data.Map.Strict +import Data.HList +import GHC.TypeLits (Symbol, KnownSymbol) + + +func :: a -> HList [Int, String] +func _ = hBuild 10 "test" + +field :: forall a. KnownSymbol a => Label a +field = Label + + +record = + Label @"test" .=. 10 .*. + field @"x" .=. 20 .*. + emptyRecord + +-- TODO: these should be limited to Tagged "symbol" (LintWriter a) +tileLints = + field @"test" .=. (\a -> a) .*. + emptyRecord diff --git a/stack.yaml b/stack.yaml index a72e0cd..78836a8 100644 --- a/stack.yaml +++ b/stack.yaml @@ -41,6 +41,7 @@ extra-deps: - semialign-1.2.0.1@sha256:5efc30d6f53f8d2a8a26d9bf3a57c0f20f4ba3086797ccaa615f644abc21d42e,2814 - text-short-0.1.4@sha256:4f7a76e78baf391d262883007e8f8d8fb23a2805d56d9725d6abdf1428542e11,3575 - time-compat-1.9.6.1@sha256:381a2e8ed6e41d20ff5929d12d25c1d9337d459de5964ef1d90b06d115b31f07,5033 + - HList-0.5.1.0@sha256:3ecb2d10ad2b3d36ad28e2f08505f9c3d7143ca737ef13b3e64db503635966c2,7525 allow-newer: true # - acme-missiles-0.3 diff --git a/stack.yaml.lock b/stack.yaml.lock index 71eec11..77b02f5 100644 --- a/stack.yaml.lock +++ b/stack.yaml.lock @@ -39,6 +39,13 @@ packages: sha256: dd54303f712dd2b8dc05942061921b0d06e0bd501b42c965a9ac6a0a37cd3128 original: hackage: time-compat-1.9.6.1@sha256:381a2e8ed6e41d20ff5929d12d25c1d9337d459de5964ef1d90b06d115b31f07,5033 +- completed: + hackage: HList-0.5.1.0@sha256:3ecb2d10ad2b3d36ad28e2f08505f9c3d7143ca737ef13b3e64db503635966c2,7525 + pantry-tree: + size: 5800 + sha256: fe9d53555847bd16ffd46e3fb6013751c23f375a95d05b4d4c8de0bb22911e72 + original: + hackage: HList-0.5.1.0@sha256:3ecb2d10ad2b3d36ad28e2f08505f9c3d7143ca737ef13b3e64db503635966c2,7525 snapshots: - completed: size: 586286 diff --git a/walint.cabal b/walint.cabal index a62f7a7..fd8db2f 100644 --- a/walint.cabal +++ b/walint.cabal @@ -41,6 +41,7 @@ library Badges LayerData Dirgraph + KindLinter build-depends: base, aeson, bytestring, @@ -58,7 +59,8 @@ library dotgen, text-metrics, uri-encode, - network-uri + network-uri, + HList -- TODO: move more stuff into lib, these dependencies are silly executable walint -- cgit v1.2.3