<commit_before>{-# LANGUAGE ConstraintKinds, DataKinds, PolyKinds, RankNTypes, ImpredicativeTypes #-}

-- To have lenses etc. for finally-tagless form we need a
-- way to create custom class dictionaries (and possibly
-- abuse reflection to create them on the fly). But why
-- not create a concept of final dictionaries, where we
-- are not restricted to the concept of finally-tagless
-- to be implemented by Haskell type classes?

class Foo' a where
  bar :: Char -> Bool -> a
  quux :: a -> a -> a

class Dict (d :: [*] -> k) where

--type F = Functor
-- ERROR?! type Foo = forall a . Foo' a => '[Char -> Bool -> a, a -> a -> a]
type Foo = '[forall a . Foo' a => Char -> Bool -> a, forall a . Foo' a => a -> a -> a]


data F (vs :: [*]) = XX
class G (vs :: [*]) where

instance Dict F where
instance Dict G where<commit_msg>the going gets tough<commit_after>{-# LANGUAGE ConstraintKinds, DataKinds, PolyKinds, RankNTypes, ImpredicativeTypes, TypeFamilies
           , MultiParamTypeClasses, TypeSynonymInstances, FlexibleInstances #-}

-- To have lenses etc. for finally-tagless form we need a
-- way to create custom class dictionaries (and possibly
-- abuse reflection to create them on the fly). But why
-- not create a concept of final dictionaries, where we
-- are not restricted to the concept of finally-tagless
-- to be implemented by Haskell type classes?

class Foo' a where
  bar :: Char -> Bool -> a
  quux :: a -> a -> a



class Dict (d :: [*] -> k) (ms :: [*]) where
  type First d ms :: *
  first :: First d ms

--type F = Functor
-- ERROR?! type Foo = forall a . Foo' a => '[Char -> Bool -> a, a -> a -> a]
--type Foo = '[forall a . Foo' a => Char -> Bool -> a, forall a . Foo' a => a -> a -> a]
type Foo a = '[Char -> Bool -> a, a -> a -> a]


data F (vs :: [*]) = Bar Char Bool | Quux (F vs) (F vs)
class G (vs :: [*]) where

instance Dict F (Foo (F a)) where
  --type First F Foo = forall a . Foo' a => Char -> Bool -> a
  type First F (Foo (F a)) = Char -> Bool -> F a
  first = Bar

--instance Dict G (Foo (G a)) where
{'fraction_non_alphanumeric': 0.14537444933920704, 'fraction_numerical': 0.0, 'mean_word_length': 2.7573529411764706, 'pattern_counts': {'":': 0, '<': 3, '<?xml version=': 0, '>': 44, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '4860374', 'n_tokens_mistral': 704, 'n_tokens_neox': 653, 'n_words': 308}