diff options
author | Joe Crayne <joe@jerkface.net> | 2019-07-16 20:59:39 -0400 |
---|---|---|
committer | Joe Crayne <joe@jerkface.net> | 2019-07-16 21:00:19 -0400 |
commit | 89b10a78c24513b125fc505c78533a4ad6febd4c (patch) | |
tree | 7851e91eb3a75b24cbd0b83b46bab4d994d03364 /src/Wavefront.hs | |
parent | eb13dbaed4a2e6483870f09dfc4e5a7f743e664f (diff) |
Refactor Wavefront.parse.
Diffstat (limited to 'src/Wavefront.hs')
-rw-r--r-- | src/Wavefront.hs | 10 |
1 files changed, 7 insertions, 3 deletions
diff --git a/src/Wavefront.hs b/src/Wavefront.hs index 2131d96..638b849 100644 --- a/src/Wavefront.hs +++ b/src/Wavefront.hs | |||
@@ -152,6 +152,10 @@ mzeroOBJ = OBJ | |||
152 | parse :: L.ByteString -> OBJ Vector | 152 | parse :: L.ByteString -> OBJ Vector |
153 | parse bs = Rank2.fmap (Vector.fromList . DList.toList) obj | 153 | parse bs = Rank2.fmap (Vector.fromList . DList.toList) obj |
154 | where | 154 | where |
155 | b = objBookKeeping buildOBJ | 155 | go = parseCustom buildOBJ (const $ return ()) bs |
156 | substvars = ObjConfig IntMap.empty | 156 | (obj,_) = execState go (mzeroOBJ,blankElement) |
157 | (obj,_) = execState (runStateT (parseOBJ b substvars bs) emptyCounts) (mzeroOBJ,blankElement) | 157 | |
158 | parseCustom :: Monad m => ObjBuilder m -> (OBJ Count -> m b) -> L.ByteString -> m b | ||
159 | parseCustom builder finish bs = do | ||
160 | counts <- execStateT (parseOBJ (objBookKeeping builder) (ObjConfig IntMap.empty) bs) emptyCounts | ||
161 | finish counts | ||