From 0c9538e2f278685c309885aaadeac2be8c9391e4 Mon Sep 17 00:00:00 2001 From: Rowan Torbitzky-Lane Date: Wed, 29 Jan 2025 14:50:05 -0600 Subject: [PATCH] delete learnlens --- src/LearnLens.hs | 30 ------------------------------ 1 file changed, 30 deletions(-) delete mode 100644 src/LearnLens.hs diff --git a/src/LearnLens.hs b/src/LearnLens.hs deleted file mode 100644 index fedd2ab..0000000 --- a/src/LearnLens.hs +++ /dev/null @@ -1,30 +0,0 @@ -{-# LANGUAGE TemplateHaskell #-} - -module LearnLens where - -import Control.Lens hiding (element) -import Control.Lens.TH - -data Atom = Atom {_element :: String, _point :: Point} deriving (Show) - -data Point = Point {_x :: Double, _Y :: Double} deriving (Show) - -$(makeLenses ''Atom) -$(makeLenses ''Point) - -myAtom :: Atom -myAtom = Atom "climberite" (Point 4.0 3.2) - -shiftAtom :: Atom -> Atom -shiftAtom = over (point . x) (+ 1) - -data Molecule = Molecule {_atoms :: [Atom]} deriving (Show) - -$(makeLenses ''Molecule) - -shiftMolecule :: Molecule -> Molecule -shiftMolecule = over (atoms . traverse . point . x) (+ 1) - --- Example without template haskell -defPoint :: Lens' Atom Point -defPoint = lens _point (\atom newPoint -> atom {_point = newPoint})