records-run.hs 383 Bytes
Newer Older
Matthew Pickering's avatar
Matthew Pickering committed
1
{-# LANGUAGE PatternSynonyms #-}
2
3
{-# LANGUAGE TypeApplications #-}
{-# LANGUAGE ViewPatterns #-}
Matthew Pickering's avatar
Matthew Pickering committed
4
5
6
7
8
9
10

module Main where

pattern Bi{a, b} = (a, b)

foo = ("a","b")

11
12
13
pattern ReadP :: Read a => a -> String
pattern ReadP {readp} <- (read -> readp)

Matthew Pickering's avatar
Matthew Pickering committed
14
15
16
17
18
19
main = do
  print foo
  print (a foo)
  print (b foo)
  print (foo {a = "c"})
  print (foo {a = "fst", b = "snd"})
20
21

  print (readp @Int "5")