advent-0.1.0.0: Advent of Code common library
Copyright(c) Eric Mertens 2022
LicenseISC
Maintaineremertens@gmail.com
Safe HaskellNone
LanguageHaskell2010

Advent.Tokenize

Description

>>> autoTokenize [("A", [("A",40,["B"])])] :: [(Int, [(Int, Integer, [Int])])]
[(0,[(0,40,[1])])]
>>> autoTokenize ("A","A","B","B") :: (Int, Int, String, Int)
(0,0,"B",1)

Documentation

newtype Tokenize a Source #

Constructors

Tokenize (State (Map String Int) a) 

Instances

Instances details
Applicative Tokenize Source # 
Instance details

Defined in Advent.Tokenize

Methods

pure :: a -> Tokenize a #

(<*>) :: Tokenize (a -> b) -> Tokenize a -> Tokenize b #

liftA2 :: (a -> b -> c) -> Tokenize a -> Tokenize b -> Tokenize c #

(*>) :: Tokenize a -> Tokenize b -> Tokenize b #

(<*) :: Tokenize a -> Tokenize b -> Tokenize a #

Functor Tokenize Source # 
Instance details

Defined in Advent.Tokenize

Methods

fmap :: (a -> b) -> Tokenize a -> Tokenize b #

(<$) :: a -> Tokenize b -> Tokenize a #

Monad Tokenize Source # 
Instance details

Defined in Advent.Tokenize

Methods

(>>=) :: Tokenize a -> (a -> Tokenize b) -> Tokenize b #

(>>) :: Tokenize a -> Tokenize b -> Tokenize b #

return :: a -> Tokenize a #

autoTokenize :: AutoToken a b => a -> b Source #

class AutoToken a b where Source #

Minimal complete definition

Nothing

Methods

autoToken :: a -> Tokenize b Source #

default autoToken :: (Generic a, Generic b, GAutoToken (Rep a) (Rep b)) => a -> Tokenize b Source #

Instances

Instances details
AutoToken String Int Source # 
Instance details

Defined in Advent.Tokenize

AutoToken a a Source # 
Instance details

Defined in Advent.Tokenize

Methods

autoToken :: a -> Tokenize a Source #

AutoToken (Set String) IntSet Source # 
Instance details

Defined in Advent.Tokenize

(Ord b, AutoToken a b) => AutoToken (Set a) (Set b) Source # 
Instance details

Defined in Advent.Tokenize

Methods

autoToken :: Set a -> Tokenize (Set b) Source #

AutoToken a b => AutoToken (Maybe a) (Maybe b) Source # 
Instance details

Defined in Advent.Tokenize

Methods

autoToken :: Maybe a -> Tokenize (Maybe b) Source #

AutoToken a b => AutoToken [a] [b] Source # 
Instance details

Defined in Advent.Tokenize

Methods

autoToken :: [a] -> Tokenize [b] Source #

AutoToken a b => AutoToken (Map String a) (IntMap b) Source # 
Instance details

Defined in Advent.Tokenize

(AutoToken a1 b1, AutoToken a2 b2) => AutoToken (a1, a2) (b1, b2) Source # 
Instance details

Defined in Advent.Tokenize

Methods

autoToken :: (a1, a2) -> Tokenize (b1, b2) Source #

(AutoToken a1 b1, AutoToken a2 b2, AutoToken a3 b3) => AutoToken (a1, a2, a3) (b1, b2, b3) Source # 
Instance details

Defined in Advent.Tokenize

Methods

autoToken :: (a1, a2, a3) -> Tokenize (b1, b2, b3) Source #

(AutoToken a1 b1, AutoToken a2 b2, AutoToken a3 b3, AutoToken a4 b4) => AutoToken (a1, a2, a3, a4) (b1, b2, b3, b4) Source # 
Instance details

Defined in Advent.Tokenize

Methods

autoToken :: (a1, a2, a3, a4) -> Tokenize (b1, b2, b3, b4) Source #

class GAutoToken (f :: Type -> Type) (g :: Type -> Type) where Source #

Methods

gautoToken :: f x -> Tokenize (g x) Source #

Instances

Instances details
GAutoToken (U1 :: Type -> Type) (U1 :: Type -> Type) Source # 
Instance details

Defined in Advent.Tokenize

Methods

gautoToken :: U1 x -> Tokenize (U1 x) Source #

GAutoToken (V1 :: Type -> Type) (V1 :: Type -> Type) Source # 
Instance details

Defined in Advent.Tokenize

Methods

gautoToken :: V1 x -> Tokenize (V1 x) Source #

(GAutoToken f1 f2, GAutoToken g1 g2) => GAutoToken (f1 :*: g1) (f2 :*: g2) Source # 
Instance details

Defined in Advent.Tokenize

Methods

gautoToken :: (f1 :*: g1) x -> Tokenize ((f2 :*: g2) x) Source #

(GAutoToken f1 f2, GAutoToken g1 g2) => GAutoToken (f1 :+: g1) (f2 :+: g2) Source # 
Instance details

Defined in Advent.Tokenize

Methods

gautoToken :: (f1 :+: g1) x -> Tokenize ((f2 :+: g2) x) Source #

AutoToken a b => GAutoToken (K1 i a :: Type -> Type) (K1 i b :: Type -> Type) Source # 
Instance details

Defined in Advent.Tokenize

Methods

gautoToken :: K1 i a x -> Tokenize (K1 i b x) Source #

GAutoToken f g => GAutoToken (M1 i c f) (M1 j d g) Source # 
Instance details

Defined in Advent.Tokenize

Methods

gautoToken :: M1 i c f x -> Tokenize (M1 j d g x) Source #