Warning: this is an htmlized version!
The original is here, and
the conversion rules are here.
-- This file:
--   http://angg.twu.net/HASKELL/Classes1.hs.html
--   http://angg.twu.net/HASKELL/Classes1.hs
--           (find-angg "HASKELL/Classes1.hs")
-- Author: Eduardo Ochs <eduardoochs@gmail.com>
--
-- (defun e () (interactive) (find-angg "HASKELL/Classes1.hs"))
-- (find-es "haskell" "class-and-instance")
-- (find-es "haskell" "hutton-book" "8:")
--
-- «.type»	(to "type")
-- «.data»	(to "data")
-- «.newtype»	(to "newtype")
-- «.class»	(to "class")


-- «type»  (to ".type")
-- (find-books "__comp/__comp.el" "haskell-hutton" "8" "Declaring types and classes")
-- (find-huttonbookpage 116 "8.1     Type declarations")
-- (find-huttonbooktext 116 "8.1     Type declarations")
--
type T2 = (Int, Int)
type T3 = (T2, Int)

o3 :: T3
o3 = ((22, 33), 44)

{-
* (eepitch-ghci)
* (eepitch-kill)
* (eepitch-ghci)
:load Classes1.hs
o3

-}

-- «data»  (to ".data")
-- (find-huttonbookpage 117 "8.2    Data declarations")
-- (find-huttonbooktext 117 "8.2    Data declarations")

data D1 = D1ca
        | D1cb
        deriving Show

data D2 = D2ca Int
        | D2cb Int Int
        deriving Show

data D3 a = D3c0
          | D3ca a
          | D3ci Int
          | D3c2 (D3 a) (D3 a)
          deriving Show

{-
* (eepitch-ghci)
* (eepitch-kill)
* (eepitch-ghci)
:load Classes1.hs
D2ca 22
D2cb 22 33
D3ci 22
:t D3c0
:t D3ci 22
:t      33
:t D3ca 33
:t D3ca "foo"
D3c2 (D3ci 22) (D3ca "foo")
D3c2 (D3ca "foo") (D3ca "bar")

-}

-- «newtype»  (to ".newtype")
-- (find-huttonbookpage 119 "8.3    Newtype declarations")
-- (find-huttonbooktext 119 "8.3    Newtype declarations")

newtype N1 = N1c Int

{-
* (eepitch-ghci)
* (eepitch-kill)
* (eepitch-ghci)
:load Classes1.hs

-}


-- «class»  (to ".class")
-- (find-huttonbookpage 124 "8.5     Class and instance declarations")
-- (find-huttonbooktext 124 "8.5     Class and instance declarations")
-- (find-huttonbookpage 125         "Derived instances")
-- (find-huttonbooktext 125         "Derived instances")
-- (find-ghcugdoc  "glasgow_exts#deriving-any-other-class")
-- (find-ghcugdocr "glasgow_exts#deriving-any-other-class")
-- (find-ghcugdoc  "glasgow_exts#inferred-context-for-deriving-clauses")
-- (find-ghcugdoc  "glasgow_exts#extensions-to-the-deriving-mechanism")
-- (find-ghcugdoc  "glasgow_exts#instance-declarations")
-- (find-ghcugdoc  "using-warnings#ghc-flag-Wmissing-methods")
-- (find-fline "~/LOGS/2022oct01.haskell" "have to declare the instance for C1 before")
-- (find-fline "~/LOGS/2022oct01.haskell" "mutually recursive")
-- (find-haskell2010page (+ 20 45) "4.3.2     Instance Declarations")
-- (find-haskell2010text (+ 20 45) "4.3.2     Instance Declarations")

data DD1 = DD1a | DD1b
  deriving Show

data DD2 = DD2a | DD2b
  deriving Show

data DD3 = DD3a | DD3b
  deriving Show

class C1 a where
  m1 :: a -> String
  m2 :: a -> String
  m1 _ = "C1 m1: default"
  m2 _ = "C1 m2: default"

class C1 a => C2 a where
  m3 :: a -> String
  m4 :: a -> String
  m3 _ = "C2 m3: default"
  m4 _ = "C2 m4: default"

instance C1 DD1

instance C1 DD2
instance C2 DD2
  where m3 _ = "C2 m3: modified for DD2"

{-
* (eepitch-ghci)
* (eepitch-kill)
* (eepitch-ghci)
:load Classes1.hs
:t m1
:t DD1a
DD1a
m1 DD1a
m1 DD2a
m3 DD2a
:t m2
:t m2
:info C1
:info C2

-}






-- Local Variables:
-- coding:  utf-8-unix
-- End: