Last active
March 14, 2019 12:42
-
-
Save Lazzlo2096/289e1e0e85be5dff300c5e4597780fce to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
{-# LANGUAGE ExistentialQuantification #-} | |
{-# LANGUAGE GADTSyntax #-} | |
--https://stackoverflow.com/questions/3643172/using-maybe-type-in-haskell | |
-- https://en.wikibooks.org/wiki/Haskell/Classes_and_types | |
-- https://en.wikibooks.org/wiki/Haskell/Existentially_quantified_types | |
-- https://wiki.haskell.org/Data_declaration_with_constraint | |
-- https://stackoverflow.com/questions/22622399/how-to-fix-illegal-datatype-context-use-xdatatypecontexts/22622591#22622591 | |
-- https://stackoverflow.com/questions/22622399/how-to-fix-illegal-datatype-context-use-xdatatypecontexts/22622591#22622591 | |
-- https://stackoverflow.com/questions/7438600/datatypecontexts-deprecated-in-latest-ghc-why/7438716#7438716 | |
-- https://www.schoolofhaskell.com/school/to-infinity-and-beyond/pick-of-the-week/guide-to-ghc-extensions/data-type-extensions#gadtsyntax | |
-- https://en.wikibooks.org/wiki/Haskell/GADT | |
main = putStrLn $ show $ asdf rrr | |
rrr = Just 5 | |
asdf rrr = case rrr of | |
Just value -> value | |
--zxcv:: forall s. ShowBox -> s --?? | |
zxcv yyy = case yyy of | |
SB value -> value | |
{- | |
data Vl a = V a | G | |
s :: forall a. a->a | |
s x = x | |
-- 1 | |
--aa :: [a -> Vl a] | |
--aa = [V, G] -- ?? | |
-- 2 | |
bbInt :: [Vl Integer] | |
bbInt = [V 5, V 6] | |
{- | |
bb :: forall a. [a -> Vl a] | |
bb = [V 5, V 6] | |
-} | |
--bbHetero = [V 5, V (), V 6.5] | |
-} | |
-- ========================= | |
data ShowBox = forall s. Show s => SB s | |
heteroList :: [ShowBox] | |
heteroList = [ SB (), SB 5, SB True ] | |
data ShowBox'' where | |
SB'' :: forall a. Show a => a -> ShowBox'' | |
heteroList'' :: [ ShowBox'' ] | |
heteroList'' = [ SB'' 4, SB'' (), SB'' 6 ] | |
----------------------- | |
data ShowBox' where | |
SB' :: Show a => a -> ShowBox' | |
heteroList' :: [ShowBox'] | |
heteroList' = [ SB' 4, SB' (), SB' 6 ] |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment